티스토리 뷰
#include <windows.h>
#include "resource.h"
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
HINSTANCE g_hInst;
LPCTSTR lpszClass = "Menu";
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow)
{
HWND hWnd;
MSG Message;
WNDCLASS WndClass;
g_hInst = hInstance;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1);
WndClass.hInstance = hInstance;
WndClass.lpfnWndProc = WndProc;
WndClass.lpszClassName = lpszClass;
WndClass.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
RegisterClass(&WndClass);
hWnd = CreateWindow(lpszClass, TEXT("메뉴"),WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
NULL, (HMENU)NULL, hInstance, NULL);
ShowWindow(hWnd, nCmdShow);
HACCEL hAccel;
hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1));
while(GetMessage(&Message, NULL,0,0))
{
if(!TranslateAccelerator(hWnd, hAccel, &Message))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
}
return (int)Message.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
// HDC hdc;
// PAINTSTRUCT ps;
switch(iMessage) {
case WM_CREATE:
return 0;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_FILE_EXIT:
DestroyWindow(hWnd);
break;
case ID_MSG_ERROR1:
MessageBox(hWnd,"ERROR1","MESSAGE",MB_OK);
break;
case ID_MSG_ERROR2:
MessageBox(hWnd,"ERROR2","MESSAGE",MB_OK);
break;
}
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return(DefWindowProc(hWnd, iMessage, wParam, lParam));
}
#include "resource.h"
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
HINSTANCE g_hInst;
LPCTSTR lpszClass = "Menu";
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow)
{
HWND hWnd;
MSG Message;
WNDCLASS WndClass;
g_hInst = hInstance;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1);
WndClass.hInstance = hInstance;
WndClass.lpfnWndProc = WndProc;
WndClass.lpszClassName = lpszClass;
WndClass.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
RegisterClass(&WndClass);
hWnd = CreateWindow(lpszClass, TEXT("메뉴"),WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
NULL, (HMENU)NULL, hInstance, NULL);
ShowWindow(hWnd, nCmdShow);
HACCEL hAccel;
hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1));
while(GetMessage(&Message, NULL,0,0))
{
if(!TranslateAccelerator(hWnd, hAccel, &Message))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
}
return (int)Message.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
// HDC hdc;
// PAINTSTRUCT ps;
switch(iMessage) {
case WM_CREATE:
return 0;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_FILE_EXIT:
DestroyWindow(hWnd);
break;
case ID_MSG_ERROR1:
MessageBox(hWnd,"ERROR1","MESSAGE",MB_OK);
break;
case ID_MSG_ERROR2:
MessageBox(hWnd,"ERROR2","MESSAGE",MB_OK);
break;
}
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return(DefWindowProc(hWnd, iMessage, wParam, lParam));
}
'기억하자정보 > 기타' 카테고리의 다른 글
[솔라리스] IP 확인및 변경 (1) | 2006.11.04 |
---|---|
[관리방어] 13.안전한 tftp서비스 설정문제 (0) | 2006.10.11 |
[API] DestroyWindow 함수 (0) | 2006.10.11 |
[관리방어] 4.악성 프로그램 프로세스 종료 문제 (0) | 2006.10.10 |
[관리방어] 8. checksum값을 이용한 백도어 검출 문제 (0) | 2006.10.10 |
- 안내
- 궁금한 점을 댓글로 남겨주시면 답변해 드립니다.