|
I am always getting a return value of E_INVALIDARG when the function AddNamedCommand is called:
CComPtr<envdte::command> pCreatedCommand;
hr = pCommands->AddNamedCommand(m_pAddInInstance, CComBSTR(commandname), CComBSTR(commandtext), CComBSTR(tb_name), VARIANT_FALSE, IDB_LOGO, NULL, EnvDTE::vsCommandStatusSupported+EnvDTE::vsCommandStatusEnabled, &pCreatedCommand);
IDB_LOGO is a 16x16 Bitmap.
I am using Visual Studio .NET 2003 on Win XP SP2. I have looked at the documentation and at other examples but I can't find where I am going wrong. I have exactly the same code as everybody else, but theirs works fine.
Any ideas?
I am the handsome one in the crowd.
|
|
|
|
|
Hello,
I want to implement an ActiveX Control (made in VB6) in VB 6 application.
It is working fine on my system, but if i am going to implement it on different computer it giving error like "The connection cannot be used to perform this operation. It is either closed or invalid in its context."
abc
|
|
|
|
|
Hi,
I'm pretty new to all this interop stuff, and I've come up against a bit of an obstacle. In my method I'm trying to return an instance of another class from C# assembly. Great! Except it doesn't work. I keep getting Error 5 "Object variable or with block not set" in my VB client. Here's some sample code I knocked together to demonstrate...
C# COM Server
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
<br />
namespace COMReturnTest<br />
{<br />
[Guid("883EF833-3874-4831-9757-B44E987E80DF")]<br />
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]<br />
public interface _ReturnType<br />
{<br />
string TestString { get; }<br />
int TestInt { get; }<br />
}<br />
<br />
[Guid("29B3F02E-27A6-4535-8835-62D23BA2DA1E")]<br />
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]<br />
public interface _TestClass<br />
{<br />
COMReturnTest._ReturnType StringEmptyTest();<br />
COMReturnTest._ReturnType StringNullTest();<br />
COMReturnTest._ReturnType StringSetTest();<br />
System.String StringReturn();<br />
}<br />
<br />
[Guid("01A699E1-05ED-404e-A5B9-7C2735F97268")]<br />
[ClassInterface(ClassInterfaceType.None)]<br />
[ProgId("COMReturnTest.ReturnType")]<br />
public class ReturnType : COMReturnTest._ReturnType<br />
{<br />
#region class members<br />
<br />
private string _teststring = String.Empty;<br />
private int _testint = 0;<br />
<br />
#endregion<br />
<br />
#region class constructors<br />
<br />
public ReturnType(string TestString, int TestInt)<br />
{<br />
_teststring = TestString;<br />
_testint = TestInt;<br />
}<br />
<br />
#endregion<br />
<br />
#region _ReturnType Members<br />
<br />
public string TestString<br />
{<br />
get { return _teststring; }<br />
}<br />
<br />
public int TestInt<br />
{<br />
get { return _testint; }<br />
}<br />
<br />
#endregion<br />
}<br />
<br />
[Guid("73FB94E2-23EA-4e2c-A366-B234415FB4FE")]<br />
[ClassInterface(ClassInterfaceType.None)]<br />
[ProgId("COMReturnTest.TestClass")]<br />
public class TestClass : COMReturnTest._TestClass<br />
{<br />
<br />
public TestClass()<br />
{<br />
}<br />
<br />
#region _TestClass Members<br />
<br />
public COMReturnTest._ReturnType StringEmptyTest()<br />
{<br />
COMReturnTest.ReturnType rt = new COMReturnTest.ReturnType(String.Empty, 100);<br />
return rt;<br />
}<br />
<br />
public COMReturnTest._ReturnType StringNullTest()<br />
{<br />
COMReturnTest.ReturnType rt = new COMReturnTest.ReturnType(null, 100);<br />
return rt;<br />
}<br />
<br />
public COMReturnTest._ReturnType StringSetTest()<br />
{<br />
COMReturnTest.ReturnType rt = new COMReturnTest.ReturnType("bugger", 100);<br />
return rt;<br />
}<br />
<br />
public String StringReturn()<br />
{<br />
return "Buggeration!!!";<br />
}<br />
<br />
#endregion<br />
}<br />
}<br />
The StringReturn function is just in there to make sure I can return something. Which I can!
VB6 Client
<br />
Option Explicit<br />
<br />
Private Sub Command1_Click()<br />
On Error GoTo Command1_Click_Err<br />
<br />
Dim tc As New COMReturnTest.TestClass<br />
Dim rt As COMReturnTest.ReturnType<br />
rt = tc.StringEmptyTest<br />
<br />
Command1_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub<br />
<br />
Private Sub Command2_Click()<br />
On Error GoTo Command2_Click_Err<br />
<br />
Dim tc As New COMReturnTest.TestClass<br />
Dim rt As COMReturnTest.ReturnType<br />
rt = tc.StringNullTest<br />
<br />
Command2_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub<br />
<br />
Private Sub Command3_Click()<br />
On Error GoTo Command3_Click_Err<br />
<br />
Dim tc As COMReturnTest.TestClass<br />
Dim rt As COMReturnTest.ReturnType<br />
Set tc = New COMReturnTest.TestClass<br />
rt = tc.StringSetTest<br />
<br />
Command3_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub<br />
<br />
Private Sub Command4_Click()<br />
On Error GoTo Command4_Click_Err<br />
<br />
Dim tc As COMReturnTest.TestClass<br />
Dim str As String<br />
Set tc = New COMReturnTest.TestClass<br />
str = tc.StringReturn<br />
<br />
Command4_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub<br />
Now having extensively googled (and I do mean extensively!) I've come to the conclusion that all I'm missing is some kind of attribute decoration, probably on the methods in the class. Infact I've been tinkering with the MarshalAs attribute with the UnmanagedType.IDispatch , UnmanagedType.Interface and UnmanagedType.IUnknown parameters. (With the return: override of course.) These don't seem to have much of an effect.
Has anyone done this kind of thing before? If you have, how did you do it? And if not, any pointers? Please?!?
Cheers, Steve
|
|
|
|
|
Of course after about twenty hours looking at this I discovered what the error was immediately after posting!!!
steve_hocking wrote:
Private Sub Command3_Click()<br />
On Error GoTo Command3_Click_Err<br />
<br />
Dim tc As COMReturnTest.TestClass<br />
Dim rt As COMReturnTest.ReturnType<br />
Set tc = New COMReturnTest.TestClass<br />
SET rt = tc.StringSetTest<br />
<br />
Command3_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub
You need to SET objects in wonderful vb...
Thanks anyway, I'm just getting me coat, if you can call a taxi for me...
|
|
|
|
|
Hi!
I'm trying to use WIA Automation component to use a web cam (a standard Logitech USB) in a .Net app.
The API makes it very straightforward to grab one picture from the camera or to get a video preview (OCX) automatically embedded in a window. Neat.
Now my problem is that I actually want to get a video stream -- that is images, possibly between 1 and 10 frames per second. The "TakePicture" command is the only command support by the device, it cannot work at the same time than the VideoPreview and anyway taking one snapshot takes between 3 and 10 seconds (it seems to reinitialize the camera each time!)
So... how am I supposed to use this API to do anything useful with a video device besides automatic preview?
|
|
|
|
|
I want to use Band in Box with the rme Digi96/8 PAD but i cant get a virtual MIDI device running.
I tried Roland Virtual Sound Canvas or otherwise the Microsoft GS Wavetable SW Synth.
Using DxDiag i can test Microsoft GS Wavetable SW Synth and Tadaa it works over the Digi96 but its not possible to use it in System Audio Settings.
After hours searching the registry to activate SW Synth working with my Digi96, i gave up!!
I need help!!!!!
|
|
|
|
|
Hi All!
I am new in C++ but I am mad to listen voice of Telephone line via a Sound Card in my PC...
How can I write soft to forward voice (normal voice of telephone user)from the modem to the PCI Sound Card??? And then my microphone sound from Sound Card into the modem connected to the phone line...
Any idea? for Visual C++6 or Borland C++...
I do love comments a lot...in code...
Thanks
Vova
vovik@indiatimes.com:
sigh:
|
|
|
|
|
I think You are looking For TAPI i.e. Telephone API,you will good reference for it in DEVELOPER GUIDE to Visual C++ and MSDN
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
if you wanna start programming you should run away from windows
and thy b*!"#%!#$%
|
|
|
|
|
|
I'm very new to COM. For some reason I just cannot seem to create this object CLSID_VideoMixingRenderer9. I'm basically using code copied right out of the DirectX SDK. The program compiles fine but when the program runs CoCreateInstance returns doesnt create the object. I've compaired the HRESULT returned from CoCreateInstance to the possible return values listed for CoCreateInstance but none of them match. The value of HRESULT is -2147220877.
PLEASE HELP THIS IS DRIVING ME OUT OF MY MIND.
|
|
|
|
|
Either DirectDraw has not been installed or the Video Card capabilities are not suitable. Make sure the display is not in 16 color mode.
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hello,
I know the CLSID of the COM- object and I would like to retrieve the TypeLibrary ID of the Type Library describing it. (I want to get the ITypeLib interface of the typelib..)
I noticed in the Windows registry that the TypeLib ID is present in a subkey of the CLSID so I could get it from there, but I think that might not be the correct way to get to it... So if anybody knows I`ld be gratefull if you would share your knowledge.
Greetings,
Davy
|
|
|
|
|
I would probably use that way you described - seek in registry and load it by LoadRegTypeLib getting the ITypeLib interface.
Other possibility, but somehow limited is that if you have an object, who support IDispatch interface, you can create the object using the CLSID you know, asking for the IDispatch .
Then you can use the IDispatch::GetTypeInfo , returning the ITypeInfo , which in turn you can ask for the ITypeLibrary by using ITypeInfo::GetContainingTypeLib .
But this requires the component to support IDispatch .
Another way, I got from the head is getting the path to the dll or exe, where the object resides and use the LoadTypeLib function.
Hope this helps
|
|
|
|
|
hi
i have embeded an ActiveX control in a web page, when the page is accessed the control downloads and registers successfully on client's machine but it is not shown on the web page, instead a cross icon comes at its place
what might be wrong
plz help me its urgent
regards.
Muhammad Azam
|
|
|
|
|
Is your client using WinXP SP2 ?
modified 21-Apr-21 21:01pm.
|
|
|
|
|
hi Mr.Sohail Kadiwala
No, Windows 2000 professional is installed on client machine.
thanks for quering me, i have been looking for some solution from my MFCian mates but stll no responce.
Thanks in anticipation
i have to do it at earliest so plz help me out.
best wishes
Muhammad Azam
|
|
|
|
|
Hello everybody,
(For starters I'm new at COM and such so bear with me)
I am writing projects for handheld devices (PocketPC, ARM, MIPS, etc..) these devices need to access a COM - component on a desktop PC. So after some reading about COM it seemed that DCOM(communication over network with COMcomponents) was what I need. Allas DCOM apparantly is not supported on the WindowsCE (if I'm wrong here please let me know..)
So now I'm thinking about writing a desktop app that will capture messages from the handheld devices it would then, depending extra data it sends, contact the requested COM component and execute certain methods, and finally the app would send data back to the device (communication with device using windows sockets).
My documentation concerning COM is not the latest stuff that's out there (1996 ), so I will very quickly lay out my plan and I would like to ask you if my ideas are outdated or not (better ways to get where I want and how or URL's are welcome).
My idea roughly outlined:
(desktop app needs to be able to handle all kind of com-componentes so should be kind of generic)
The device makes a connection to a predefined port on the PC where the app is listening (Windows sockets). After connection is succesfully established:
Step 1: Device sendsCLSID or ProgID of the COM-class it wants to use-> the desktopApp searches for CLSID and checks if Component is known and accessible
Step 2: Device sends method it wants to invoke(optional sends also the Interface) -> The desktop app searches (incase no interface was passed)using the ITypeLib and ITypeInfo for an interface that implements the method and if it is found calls the method. Afterwards the desktop app return any data to the device.
Step 3: after device is finished with all its method calls it sends a quit or smthing-> desktop app releases the COM-obj.
This is a very brief layout of my idea(I know implementing it will get much more complicated but I just want to get your comments on the basic idea)... Is this the way to get the job done? Is there a better technology out there that does this?
Thanks to anyone that might help,
Greetings,
Davy
|
|
|
|
|
You don't say which version on WinCE you're using, and whether you can alter the build of the devices (your own products based on SBCs), or if they are 'canned' (like HP iPaq).
Steve S
Developer for hire hired!
|
|
|
|
|
I have created a com server in a dll and when I attempt to register the server using regsvr32 I recieve an error message stating that the module could not be found. I was wondering if anyone new of the cause for that (I have checked the path and it is correct). Thanks in advance.
|
|
|
|
|
Well check following things,
1) Try to load your DLL like ordinary DLL . If loadlibrary does not work out then your DLL is in incorrect .
2)Now next try will be check out wether your DLL is having all basic COM functions needed (exports).
Look for MSDN if u dont know the basic COM exports
|
|
|
|
|
Thanks for the information. I got past the cannot find module error but not I am receiving a cannot find DllRegisterServer entry point error. I have tried removing the macros and explicitly defining the function types. I forward defined them like this:
<br />
extern "C" __declspec(dllexport) HRESULT STDAPICALLTYPE DllRegisterServer();<br />
extern "C" __declspec(dllexport) HRESULT STDAPICALLTYPE DllUnregisterServer();<br />
The function bodies look like this:
<br />
extern "C" __declspec(dllexport) HRESULT STDAPICALLTYPE DllRegisterServer() {<br />
<br />
return RegisterServer(g_hModule, CLSID_Component1, g_szFriendlyName, g_szVerIndProgID, g_szProgID);<br />
}<br />
<br />
extern "C" __declspec(dllexport) HRESULT STDAPICALLTYPE DllUnregisterServer() {<br />
<br />
return UnregisterServer(CLSID_Component1, g_szVerIndProgID, g_szProgID);<br />
}<br />
Again thanks for the help.
|
|
|
|
|
After creating the uploads directory I still get ADODB.Stream error
'800a0bbc'
Write to file failed
help me
nokiphuc
|
|
|
|
|
Ich habe unter Borland C++ einen Server geschrieben, der savecall Methoden exportiert, um auch Exceptions vom Server zum Client zu übertragen. Borland kapselt in diesem Fall den Rückgabewert HRESULT. Wie ist es mir nun möglich vom Client eine Unterbrechung oder das schließen der Server-Anwendung zu erkennen?
Steffen
|
|
|
|
|
Entschuldigung, meine Deutsch und Borlandkentnisse sind schlecht.
Kannst du nicht die einkapselte Fehlerkode der Exceptions analysieren? Wenn der Server geschlossen ist, der HRESULT ist RPC_E_xxxx.
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
I blog too now[^]
|
|
|
|