How do I use the 16-bit EPM toolkit?

Since there were a few requests, here are the changes I made to get the ESIMPLE example from the EPM Toolkit to work with the C-Set++ compiler. The ETK DLLs are 16-bit and need to be thunked to be called from a 32-bit app. Since I was playing around, some of the changes were not necessary to get the program to run. Changes are in DIFF format.

**** Changes to EDLL.H ****
254a255
> #pragma pack(2)
259,263c260,264
<    PSWP   pswp;         // positioning of edit window
<    PSZ    filename;     // file to be edited (with wildcard)
<    PVOID  hEditPtr;     // handle to editor pointer icon.
<    PVOID  hMarkPtr;     // handle to mark pointer icon.
<    PVOID  hEditorIcon;  // editor ICON.
>    PSWP _Seg16   pswp;         // positioning of edit window
>    PSZ _Seg16    filename;     // file to be edited (with wildcard)
>    HPOINTER  hEditPtr;  // handle to editor pointer icon.
>    HPOINTER  hMarkPtr;  // handle to mark pointer icon.
>    PVOID _Seg16  hEditorIcon;  // editor ICON.
267,269c268,270
<    PSZ    exfile;       // pre-compiled macro code file (EPM.EX)
<    PSZ    topmkr;       // top and bottom of file marker
<    PSZ    botmkr;       //
---
>    PSZ _Seg16    exfile;       // pre-compiled macro code file (EPM.EX)
>    PSZ _Seg16    topmkr;       // top and bottom of file marker
>    PSZ _Seg16    botmkr;       //
271,272c272,273
<    PSZ    exsearchpath; // a set of paths to search for ex's files
<    PSZ    exe_path;     // path where the application started
---
>    PSZ _Seg16    exsearchpath; // a set of paths to search for ex's files
>    PSZ _Seg16    exe_path;     // path where the application started
275c276,277
< typedef EDITORINFO far *PEDITORINFO;
---
> typedef EDITORINFO * PEDITORINFO;
> #pragma pack()
280c282
< #define ETKENTRY _loadds
---
> #define ETKENTRY CDECL16
285,286c287,288
< PSZ	 ETKENTRY EtkRegister( HAB hab, ULONG class_style );
< USHORT ETKENTRY EtkCreate( PEDITORINFO epm_p, PHWND hEwnd_p);
---
> PSZ _Seg16    ETKENTRY EtkRegister( HAB hab, ULONG class_style );
> USHORT ETKENTRY EtkCreate( PEDITORINFO _Seg16 epm_p, PHWND _Seg16 hEwnd_p);
304c306,307
< SHORT  ETKENTRY EtkSetSelection( HWND  hwndClient, LINE_INDEX_G  firstline,
---
> SHORT  ETKENTRY EtkSetSelection( HWND  hwndClient, LINE_INDEX_G  firstline,
>    FIDType fileid);

**** Changes to ESIMPLE.C ****
28a29,30
>
> #include "thunk.h"
47a50
>    HWND hwndEditFrame;
52c55
<
---
>    swp.fl = SWP_MOVE | SWP_SIZE;
58c61
<    epm.filename    = (PSZ)Fname;      // file to be edited (with wildca
---
>    epm.filename    = Fname;           // file to be
> edited (with wildca
64,65c67,70
<    epm.editorstyle = EDIT_STYLE_ACTIVATEFOCUS | EDIT_STYLE_DISABLEOWNERAFFECT
<                      EDIT_STYLE_CURSORON;
---
>    epm.editorstyle = EDIT_STYLE_ACTIVATEFOCUS |
>                      EDIT_STYLE_CURSORON |
>                      EDIT_STYLE_STATUSLINE |
>                      EDIT_STYLE_MESSAGELINE;
67,68c72,73
<    epm.pmstyle     = FCF_TITLEBAR | FCF_SIZEBORDER | FCF_VERTSCROLL;
<
---
>    epm.pmstyle     = FCF_TITLEBAR | FCF_SIZEBORDER |
> FCF_VERTSCROLL | FCF_MIN
>    epm.font = TRUE;  // large font
70,71c75,76
<    epm.topmkr      =                        // top and bottom file indicator
<    epm.botmkr      = (PSZ)" ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈";
---
>    epm.topmkr      = (PSZ)"<Top>";
> // top and bottom fi
>    epm.botmkr      = (PSZ)"<Bottom>";
75c80
<
---
>    epm.hini = NULLHANDLE;
77,79c82,86
<    EtkCreate( (EDITORINFO far *)&epm, (PHWND)&hwndEdit );
<
<    return( (HWND)hwndEdit );
---
>    EtkCreate( &epm, &hwndEdit );
>       hwndEditFrame = WinQueryWindow(hwndEdit, QW_PARENT);
>       WinSetWindowPos(hwndEditFrame, NULLHANDLE, swp.x, swp.y,
>           swp.cx, swp.cy, SWP_MOVE | SWP_SIZE);
>    return( hwndEdit );
95c102
< MRESULT FAR PASCAL TestWndProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2
---
> MRESULT EXPENTRY TestWndProc( HWND hwnd, USHORT msg,
> MPARAM mp1, MPARAM mp2 )
144,146c151,155
<   case EPM_EDIT_ACTIVEHWND:
<      WinSetActiveWindow(HWND_DESKTOP,(HWND)mp1 );
<      break;
---
> case EPM_EDIT_ACTIVEHWND:
>   {
>      WinSetActiveWindow(HWND_DESKTOP,(HWND)mp1 );
>   }
>   break;
160c169
<                     (PSZ)mp1,
---
>                     (PSZ)_DosSelToFlat(mp1),
162c171
<                     NULL,
---
>                     NULLHANDLE,
235c244
<     hab = WinInitialize(NULL);              // Initialize app as a PM app
---
>     hab = WinInitialize(NULLHANDLE);        // Initialize app as a PM app
247c256
<

Credit: Mat Kramer


[Back: How do I take control of frame sizing?]
[Next: How do I get error info after using WinGetLastError()?]