Category : C Source Code
Archive   : JFKLIB.ZIP
Filename : DIALOG.CPP

 
Output of file : DIALOG.CPP contained in archive : JFKLIB.ZIP

/*
DIALOG.CPP - Generic DialogBox-Class
(C) 1991 by Joachim Kainz 'On a mission from Bhudda'
*/
#include "dialog.hpp"
#include "dlgtemp.hpp"

FARPROC2 DIALOG::lpFnOOPWndProc = NULL;

EXPORT DIALOG::DIALOG (
LPSTR lpDlg,
HWND hWndParent,
HICON hIcon,
FARPROC lpfnProc,
DWORD dwParam
): WINDOW (
NULL,
LoadCursor (NULL, IDC_ARROW),
hIcon,
COLOR_WINDOW+1,
0,
DLGWINDOWEXTRA,
"jfk",
DefDlgProc
)
{
DLGTEMPLATE dlg (lpDlg);

dlg.SetClass ("jfk");

PSTR pDlg = (PSTR) dlg;

if (!pDlg)
return;

hWnd = CreateDialogIndirectParam (
GetInstance (),
(LPSTR) pDlg,
hWndParent,
lpfnProc,
dwParam
);

LocalFree ((HANDLE) pDlg);

if (!hWnd)
return;

SetWindowLong (GetWindowHandle (), DLGWINDOWEXTRA, (long) this);

lpDefWndProc =
(FARPROC2) SetWindowLong (
GetWindowHandle (),
GWL_WNDPROC,
(long) GetOOPWndProc ()
);

SendMessage (self, WM_INITDIALOG, NULL, dwParam);

wResult = NULL;
}

FARPROC2 DIALOG::GetOOPWndProc () const
{
if (!lpFnOOPWndProc)
lpFnOOPWndProc = (FARPROC2) MakeProcInstance (
(FARPROC) DefOOPDlgProc,
GetInstance ()
);

return lpFnOOPWndProc;
}