Re: [VB4Linux-Dev] OCXs
Status: Planning
Brought to you by:
luke-jr
From: Martino S. <ms...@ti...> - 2000-11-22 13:51:44
|
----- Original Message ----- From: "James Cooper" <ja...@st...> To: "VB4Linux Project" <vb4...@li...> Sent: Wednesday, November 22, 2000 11:15 AM Subject: [VB4Linux-Dev] OCXs > I'm lead to believe that OCX's are basically glorified DLL's. > > To see if they are, open one up in a text editor and check if the first > two characters are 'MZ' or 'PE' (i can't as i'm running linux only). > Portable in PE means that the file is portable among the Windows family > of OS's, not different OS's or processor architectures. Perfect. > Perhaps someone could try messing around with one in VB: > As far a i know, DLLs all have one function, called DllMain(). (Even if > you do not write this function when you are creating a DLL in VC++, an > empty one is automatically compiled anyway). You can think of this as a > constructor in Java. When the DLL is loaded, the OS calls DllMain (just > like it calls WinMain in applications). I'm sure there are some API > functions to get the functions a DLL exports but i don't know what they > are, GetProcAddress() i think). For example gdi32.dll exports > CreateCompatibleDC, so the code should be something like this: > > (Function names are not necessarily correct!) > Dim hModule as Long > Dim lpProc as Long > > hModule = LoadModule("c:/windows/system32/gdi32.dll"); > lpProc = GetProcAddress(hModule, "CreateCompatibleDC"); > ... This is correct if you have a Common DLL written by C. You get the proc address and use it, but the OCX use the COM interface (like CORBA) to share objects to any application that request them. Beside this, you must know the objects that the OCX share. If you don't know, the OCX share, with a common interface, a Type Library (.TLB), that have stored the object definition. P.S.: I don't know if my english is plain. I'm sorry. > > Note: this is completely useless in VB as VB cannot Call pointers! > > All this is just off the top of my head, check out msdn.microsoft.com > for better info. > Hope this helps somewhat. > _______________________________________________ > VB4Linux-Dev mailing list > VB4...@li... > http://lists.sourceforge.net/mailman/listinfo/vb4linux-dev |