Re: [VB4Linux-Dev] OCXs
Status: Planning
Brought to you by:
luke-jr
From: Scott B. <js...@go...> - 2000-11-22 13:42:25
|
On Wed, 22 Nov 2000, James Cooper wrote: > I'm lead to believe that OCX's are basically glorified DLL's. They are. > > 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. Thats correct. > > 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: A point dug out of this blurb.... I would not try and keep binary compatibility between the OS platforms. To me, the goal of this project is to have a VB like system you can recompile your VB code on Linux or some other Unix like OS, we want to use Wine, not be it. Past that, you may want to think about a VM, but I think most of this is beyond the scope of this project, at first anyway. > > (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! For this, all we will do is generate the load .so function for the specified function. scott |