Getting the Address of the DLL Function

Before you can call the target function, MyPrint, from the 16-bit code that loaded DLL32, you must get its address using the GetProcAddress32W function. For example:

// Get the address of the MyPrint routine in the Win32-based DLL
typedef void (FAR PASCAL *MYPROC)(LPSTR);
MYPROC hProc;

if( NULL == (hProc = (MYPROC)GetProcAddress32W( ghLib, "MyPrint" ))) 
{
    MessageBox( hWnd, "Cannot call DLL function", "App16", MB_OK );
    ...
}
 

If you are isolating your thunking code into DLL16, put the call to GetProcAddress32W in the MyPrint function of the DLL16 code.