SDK基于对话框的程序怎么写啊,高手给个算法框架吧,这样行不行啊?求大家给我改改吧!
#include <windows.h>
#include <winsock.h>
#include "resource.h"
BOOL WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
int WINAPI WinMain (
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS wc;
GetClassInfo( NULL, WC_DIALOG, &wc );
wc.hInstance = hInstance;
wc.lpszClassName = "Client";
wc.lpfnWndProc = DefDlgProc;
if( ! RegisterClass( &wc ) )
return( FALSE );
//hInst = hInstance;
DialogBox( hInstance, MAKEINTRESOURCE(ID_CLIENT), NULL, MainDlgProc );
return TRUE;
}
BOOL WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_INITDIALOG: //初始化对话框消息
{
return 0;
}
case WM_PAINT: // 对话框绘制消息
{
PAINTSTRUCT ps;
HDC hDC;
RECT Rect;
hDC = BeginPaint( hDlg, &ps );
GetClientRect( hDlg, &Rect );
FillRect( hDC, &Rect, GetProp( hDlg, "BRUSH" ) );
EndPaint( hDlg, &ps );
return 0;
}
case WM_COMMAND: //处理从控件传递来的消息
{
if(wParam == IDCANCEL)
{
EndDialog( hDlg, TRUE );
}
return 1;
}
}
return 1;
}