Code:
//+-----------------------------------------------------------------------------
//| Included files
//+-----------------------------------------------------------------------------
#include <windows.h>
//+-----------------------------------------------------------------------------
//| ID definitions
//+-----------------------------------------------------------------------------
#define MainDialog 1
#define TextMain 101
#define ButtonAbout 103
#define ButtonColor 2
#define ButtonCopy 1
#define ButtonExit 3
//+-----------------------------------------------------------------------------
//| Global objects
//+-----------------------------------------------------------------------------
HWND MainWindow;
//+-----------------------------------------------------------------------------
//| Message handler
//+-----------------------------------------------------------------------------
LRESULT MessageHandler(HWND Handle, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ButtonCopy:
return 0;
case ButtonColor:
return 0;
case ButtonAbout:
return 0;
case ButtonExit:
DestroyWindow(Handle);
return 0;
}
return 0;
case WM_CLOSE:
DestroyWindow(Handle);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return 0;
}
//+-----------------------------------------------------------------------------
//| Main function
//+-----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE CurInst, HINSTANCE PrevInst, LPSTR Param, int Show)
{
MSG Message;
MainWindow = CreateDialog(CurInst, MAKEINTRESOURCE(MainDialog), NULL, (DLGPROC)MessageHandler);
ShowWindow(MainWindow, SW_SHOW);
UpdateWindow(MainWindow);
while(GetMessage(&Message, NULL, 0, 0)) DispatchMessage(&Message);
return 0;
}
いいいいいいいいいいいいいいいいいいい
This is the resource file:
いいいいいいいいいいいいいいいいいいい
#define IDD_DIALOG1 1
#define MainDialog 1
#define IDC_EDIT1 101
#define IDC_EDIT2 102
#define TextMain 101
#define IDC_BUTTON1 102
#define IDC_BUTTON2 103
#define ButtonAbout 103
#define ButtonColor 2
#define ButtonCopy 1
#define ButtonExit 3
MainDialog DIALOG 0, 0, 268, 52
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_CONTEXTHELP
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | DS_CONTEXTHELP | 0x200L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX
CAPTION "War3Color v1.00"
FONT 8, "MS Sans Serif"
{
CONTROL "Select a color", ButtonColor, "BUTTON", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 100, 28, 64, 14
CONTROL "Exit", ButtonExit, "BUTTON", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 220, 28, 40, 14
CONTROL "Enter text here", TextMain, "edit", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 8, 8, 252, 13, 0
CONTROL "Put text in clipboard", ButtonCopy, "button", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 8, 28, 86, 14, 0
CONTROL "About", ButtonAbout, "button", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 172, 28, 40, 14, 0
}