Creating a 16-bit Window From Within a 32-bit Module

32-bit Module

#pragma stack16(8192)

HWND MakeMyWindow(void);                   /* 16-bit function prototype  */
#pragma linkage (MakeMyWindow, far16 pascal)

HWND _Seg16 hWindow;                       /* 16:16 window handle        */
  :
  :
hWindow = MakeMyWindow();                  /* Call registration routine  */

16-bit Module

HWND EXPENTRY MakeMyWindow(void)           /* Registration routine       */
{
     HWND hCurrWindow;                     /* 16:16 window handle        */

     WinRegisterClass(...);                /* Register window class      */
     hCurrWindow = WinCreateWindow(...);   /* Create window              */

     return(hCurrWindow);                  /* Return 16:16 window handle */
}


[Back: Declaring a 16-Bit Function in 32-Bit Code]
[Next: Passing a 16:16 Pointer as a Message Parameter]