[VB4Linux-Dev] OCXs
Status: Planning
Brought to you by:
luke-jr
From: James C. <ja...@st...> - 2000-11-22 10:22:56
|
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. 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"); ... 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. |