1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#include "main.h"
int WINAPI WinMain( HINSTANCE hThisI, HINSTANCE hPrevI,
PSTR lpCmdLine, int nCmdShow )
{
MSG msg = {0};
int err = 0;
zxWINDOW win = {0}, kid = {0};
zxMswThisI = hThisI;
err = zxcNewWindow( NULL, zxGuiTitle, &win,
WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, zxWIN_FRAME );
if ( err != 0 )
return err;
err = zxcNewWindow( win.m_mswHwnd, T("Textbox"), &kid,
WS_CHILD, 1, 1, 100, 30, zxWIN_TEXTBOX );
if ( err != 0 )
PostQuitMessage( err );
ShowWindow( win.m_mswHwnd, SW_SHOW );
ShowWindow( kid.m_mswHwnd, SW_SHOW );
while ( GetMessage( &msg, NULL, 0, 0 ) > 0 )
DispatchMessage( &msg );
return 0;
}
LRESULT CALLBACK zx_mswWndProc( HWND hWnd,
UINT message, WPARAM wParam, LPARAM lParam )
{
switch(message)
{
case WM_CLOSE:
PostQuitMessage(0);
break;
default:
return DefWindowProc( hWnd, message, wParam, lParam );
}
return 0;
}
int zxcNewWindow( HWND parent, TCHAR *text, zxWINDOW *kid,
UINT style, int x, int y, int w, int h, int type )
{
*kid = zxDefWINDOW;
kid->m_mswWc.hInstance = zxMswThisI;
switch ( type )
{
case zxWIN_FRAME:
kid->m_mswWc.lpszClassName = T("MDICLIENT");
break;
case zxWIN_TEXTBOX:
kid->m_mswWc.lpszClassName = T("EDIT");
break;
default:
return 1;
}
if ( !RegisterClass( &kid->m_mswWc ) )
return 1;
kid->m_mswHwnd = CreateWindow(
kid->m_mswWc.lpszClassName, text,
style, x, y, w, h, parent, NULL, zxMswThisI, NULL );
if ( !kid->m_mswHwnd )
return 2;
return 0;
}
|