Click to See Complete Forum and Search --> : Get h, idll, c files from ocx


Foo
May 18th, 2001, 12:03 PM
If I have a OCX, how do I produce the .IDL, .H, .C files? I used OleViewer, it worked for .IDL file but it doesn't work for .H and .C. Is there any other ways?

coolbiz
May 18th, 2001, 01:38 PM
Not sure if you can. I might be wrong since I'm also new in this OCX thingy. But if we look at the logic, it kinda make sense not to be able to get .C and .H (at least .C) out of the .OCX. The idea is to allow a programmer to pass a functional DLL to others without exposing the algorithm/code itself. So if you can convert back from OCX to .C, then it is not cool.

Just my 2 cents,
-Cool Bizs

Foo
May 18th, 2001, 02:06 PM
Ok, I want to use the .h, and .c file to be able to use the object in my app. See, I can’t use MFC, or ATL, in my app. So, I have to do declare the whole interface in my code, and then use it.
I need the .h and .c file to declare the interface. I don’t want to reverse engineer the binary ocx file. The .c file in this case is a _i.c file this file contains the actual definitions of the IIDs and CLSIDs.

But I think I have found the solution, you can declare the IIDs by just copy and past the IIDs form OleViewer to your project, and use #import directive to generate the .tlh and .tli files. Basically link to the object through type library.

coolbiz
May 18th, 2001, 03:22 PM
Yes you're right. You can use the IMPORT directive and VC++ IDE will create the .H and .C which will allow you to use smartpointers and all. I thought that you're talking about getting the .C which is the implementation file for the OCX.

-Cool Bizs