CompuServe Thread

#win16 app to win32 dll

4 messages in this thread
#50502From: DowellAug 3, 1993 7:56 AM
I am trying to create a DLL under Windows NT so that it can be used by an application created under Visual C++ and run under windows 3.1 using win32s. After reading the WIN32S manual and an article I found on the Network developer CD I understand that it can be done using a universal THUNK to translate 16 to 32 bits and vice-versa. However, I am still a little unsure how do do this as I have not seen an example. The article I read, "Calling a Win32 DLL from a Windows 3.x Application" showed in the diagram three modules that I would have to create in addition to my Win 3.x application and my Win32 DLL; a 16-bit DLL (UT), a Win32 EXE (stub), and a Win32 DLL (UT). What exactly goes into each of these modules? If I do these correctly I shouldn't have to change my Win 3.x application or my Win32 DLL? Please point me to an example or template I can start from for this task as I am fairly new to windows programming.. Thank you very much! There is 1 Reply.
#50559From: Lee Hart [Microsoft]Aug 3, 1993 1:39 PM
>>>The article I read, "Calling a Win32 DLL from a Windows 3.x Application" showed in the diagram three modules that I would have to create in addition to my Win 3.x application and my Win32 DLL; a 16-bit DLL (UT), a Win32 EXE (stub), and a Win32 DLL (UT). What exactly goes into each of these modules? If I do these correctly I shouldn't have to change my Win 3.x application or my Win32 DLL? Please point me to an example or template I can start from for this task as I am fairly new to windows programming.. I have not yet written a sample that shows this (it is high on my list of priorities, but answering questions on CIS is even higher). I believe the article describes generally what goes where. The Win16 DLL, when it initializes, looks to see if the Win32 EXE has been loaded (for example you could use a unique atom to indicate this.) If it has not, it WinExecs the Win32 EXE. The Win32 EXE, on init, will call UTRegister to set up the 2 way link to the Win16 DLL, including a 16->32 CallBack proc. It is via this proc that the Win16 DLL will call services in the Win32 DLL. When the Win16 DLL calls this proc (in the exact same manner as a Win32 DLL calling the Win16 UTProc), the dispatcher on the 32 bit side (that you write) will extract the arguments from the passed array and call the appropriate function in the Win32 DLL. Does this make sense? If not, please ask specific questions. If you have suggestions on hwo I could improve that article, please let me know. Lee There is 1 Reply.
#51169From: John ZempelAug 7, 1993 8:42 AM
Mike, I have an example of doing this in the current (August 1993) issue of WinTech Journal. It shows how to call 32 bit Dll's from a VB application, but is really just from the Win16 side. There is 1 Reply.
#51216From: Lee Hart [Microsoft]Aug 9, 1993 12:33 AM
>>>Mike, I guess I'll forgive this transgression this time <g> >>>I have an example of doing this in the current (August 1993) issue of WinTech Journal. It shows how to call 32 bit Dll's from a VB application, but is really just from the Win16 side. I read that article – fairly good. I must admit I was suprised to learn that you sliced brains for a living. Richard Hale Shaw's sidebar had a few errors as I recall (it said that a future Win32s would support threads and Structured Exception Handling – as you know, we support the tls APIs in 1.0, and the __declspec(thread) storage class modifier in 1.1, but Win32s won't support CreateThread. We've supported Structured Exception Handling from the beginning) – I don't know where he became confused. Lee