Can somebody please answer this?
-
Ok. I'm trying to use a COM OCX object in a C program. I've done some research and found out how to call and instantiate a COM object from C. However, I do not know how to generate a header file for object type or interface declarations. SOPTEST replied with some useful info but all I can find out is info on how to develop a COM object using C and not how to use an existing one that is already in the registry that I didn't develop. I want to use MSCOMM32.OCX in a C program. How do I get the declaration for the IMSComm and other interfaces? I know how to get the IUknown interface, call QueryInterface, etc. And, I know that getting an interface pointer is really a void** so I could create a void pointer and call it anything I like and use it but that doesn't seem right or is it???? I've learned how to view the typelib, CLASSID, etc. from OLE/COM Object viewer so I don't think I'm an idiot, I just need some help. Is there someway of interpreting the type library and converting it into a header file that I am not aware of? Anybody??
-
Ok. I'm trying to use a COM OCX object in a C program. I've done some research and found out how to call and instantiate a COM object from C. However, I do not know how to generate a header file for object type or interface declarations. SOPTEST replied with some useful info but all I can find out is info on how to develop a COM object using C and not how to use an existing one that is already in the registry that I didn't develop. I want to use MSCOMM32.OCX in a C program. How do I get the declaration for the IMSComm and other interfaces? I know how to get the IUknown interface, call QueryInterface, etc. And, I know that getting an interface pointer is really a void** so I could create a void pointer and call it anything I like and use it but that doesn't seem right or is it???? I've learned how to view the typelib, CLASSID, etc. from OLE/COM Object viewer so I don't think I'm an idiot, I just need some help. Is there someway of interpreting the type library and converting it into a header file that I am not aware of? Anybody??
-
Ok. I'm trying to use a COM OCX object in a C program. I've done some research and found out how to call and instantiate a COM object from C. However, I do not know how to generate a header file for object type or interface declarations. SOPTEST replied with some useful info but all I can find out is info on how to develop a COM object using C and not how to use an existing one that is already in the registry that I didn't develop. I want to use MSCOMM32.OCX in a C program. How do I get the declaration for the IMSComm and other interfaces? I know how to get the IUknown interface, call QueryInterface, etc. And, I know that getting an interface pointer is really a void** so I could create a void pointer and call it anything I like and use it but that doesn't seem right or is it???? I've learned how to view the typelib, CLASSID, etc. from OLE/COM Object viewer so I don't think I'm an idiot, I just need some help. Is there someway of interpreting the type library and converting it into a header file that I am not aware of? Anybody??
If you're using MSVC++ (and what else would you be using :) !!), you can use '
#import
' to import COM objects. This will generate the required header files automatically when you compile the code. The one pain is that (with VC6, but not VC.NET, IIRC) you need to enter an absolute path to the DLL or OCX or whatever. (I've just looked it up - VC++NET lets you use a progid to say what class you want). MSDN (the one you get with VC++) should hopefully have enough info to get you started. Just one thing - by default, VC++ will generate wrappers for the COM class - this may not be what you want. Stuart Dootson 'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p' -
If you're using MSVC++ (and what else would you be using :) !!), you can use '
#import
' to import COM objects. This will generate the required header files automatically when you compile the code. The one pain is that (with VC6, but not VC.NET, IIRC) you need to enter an absolute path to the DLL or OCX or whatever. (I've just looked it up - VC++NET lets you use a progid to say what class you want). MSDN (the one you get with VC++) should hopefully have enough info to get you started. Just one thing - by default, VC++ will generate wrappers for the COM class - this may not be what you want. Stuart Dootson 'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'Whoops - just read your message properly - you say you're using C, as opposed to C++, so this may have been of no use whatsoever :( Stuart Dootson 'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
-
Use "oleview" to open type library. From "File" menu you can "Save as" *.IDL, *.H or *.C file. If you save it as *.IDL file then compile it with MIDL compiler to generate proxy/stub files. soptest
I used "oleview". I did not know you could save .c or .h files from there but when I tried, it didn't work. Apparently, it uses a console window but the error happens so fast and the console window closes before I can see it. However, I was able to save the .idl file. But, going from using VC++ before with Add To Project | Components and Controls that generates all C++ wrapper classes and as you say proxy/stub files for out of process.
-
Use "oleview" to open type library. From "File" menu you can "Save as" *.IDL, *.H or *.C file. If you save it as *.IDL file then compile it with MIDL compiler to generate proxy/stub files. soptest
I think I got it now. I was finally able to save a .c and .h files to the default directory (system32). I still got warnings or errors but I couldn't tell what they were. Looking at the contents it has the proper extern "C" declarations :laugh: Cool! Thanks again, SOPTEST