Díky. Někdo se mě ptá a má to takto:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
TCHAR szText[MAX_LOADSTRING];
int ColorR=0,ColorG=200,ColorB=255;
void SetDefalut(HWND hWnd);
void SetCervenou(HWND hWnd);
void SetZelenou(HWND hWnd);
void DrawWndContent (HWND hWnd, HDC hDc);
void DrawMousePointer (HWND hWnd, int x, int y);
LRESULT CALLBACK Title(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
HWND hEdit = GetDlgItem(hDlg,IDC_EDIT1);
SetWindowText(hEdit, szText);
}
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
case IDOK:
{
HWND hEdit = GetDlgItem(hDlg, IDC_EDIT1);
GetWindowText(hEdit,szText,MAX_LOADSTRING);
}
break;
}
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
LRESULT CALLBACK About(HWND hWnd, UINT message, UINT wParam, UINT lParam)
{
if (message == WM_COMMAND && (LOWORD(wParam) == IDOK))
{
EndDialog(hWnd, IDOK);
return TRUE;
}
return FALSE;
}
LRESULT CALLBACK MyWndProc(HWND hWnd, UINT message, UINT wParam, UINT lParam)
{
int wmId;
PAINTSTRUCT ps;
HDC hdc;
switch(message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hWnd, (DLGPROC)About);
break;
case IDM_EXIT:
if(MessageBox(hWnd, "Chcete ukoncit aplikaci?","WinHello", MB_YESNO | MB_ICONQUESTION)==IDYES)
{
DestroyWindow(hWnd);
break;
}
break;
case IDM_SETTINGS_EDITTITLE:
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hWnd, (DLGPROC)Title);
InvalidateRect(hWnd, NULL, TRUE); // prekresleni okna
break;
case ID_DEFALUT:
if(MessageBox(hWnd, "Opravdu chcete barvu změnit na původní?", "Změna barvy",MB_YESNO | MB_ICONQUESTION)==IDYES)
{
SetDefalut(hWnd);
}
break;
case ID_RED:
if(MessageBox(hWnd, "Opravdu chcete barvu změnit na červenou?", "Změna barvy",MB_YESNO | MB_ICONQUESTION)==IDYES)
{
SetCervenou(hWnd);
}
break;
case ID_GREEN:
if(MessageBox(hWnd, "Opravdu chcete barvu změnit na zelenou?", "Změna barvy",MB_YESNO | MB_ICONQUESTION)==IDYES)
{
SetZelenou(hWnd);
}
break;
}
return 0;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
DrawWndContent (hWnd, hdc);
EndPaint(hWnd, &ps);
break;