Files
Work/mdiwin/DWINDOW.HPP
2024-08-07 09:16:27 -04:00

60 lines
1.3 KiB
C++
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef _DWINDOW_HPP_
#define _DWINDOW_HPP_
#include <string.h>
#include <dos.h>
#include <mdiwin/windows.hpp>
#include <mdiwin/crsctrl.hpp>
class DWindow : public CursorControl
{
public:
DWindow();
virtual ~DWindow();
HWND GetHandle(void)const;
int Show(int nCmdShow);
protected:
// static int FAR PASCAL _export DialogProcedure(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
__declspec(dllexport) static LONG FAR PASCAL DialogProcedure(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
private:
static DWindow *DWindow::GetPointer(HWND hWnd);
static void DWindow::SetPointer(HWND hWnd,DWindow *pDWindow);
virtual int DlgProc(UINT message,WPARAM wParam,LPARAM lParam)=0;
void SetHandle(HWND hWnd);
HWND mhWnd;
};
inline
HWND DWindow::GetHandle(void)const
{
if(::IsWindow(mhWnd))return mhWnd;
return 0;
}
inline
void DWindow::SetHandle(HWND hWnd)
{
mhWnd=hWnd;
}
inline
int DWindow::Show(int nCmdShow)
{
if(!GetHandle())return FALSE;
return ::ShowWindow(GetHandle(),nCmdShow);
}
#if defined (__SMALL__) || defined (__MEDIUM__) || defined (__FLAT__)
inline
DWindow *DWindow::GetPointer(HWND hWnd)
{
return (DWindow*)::GetProp(hWnd,(LPSTR)"LOWORD");
}
inline
void DWindow::SetPointer(HWND hWnd,DWindow *pDWindow)
{
::SetProp(hWnd,(LPSTR)"LOWORD",(HANDLE)(pDWindow));
}
#endif
#endif