How change window Backgound Color when press a Button when using "ResEdit Resource Editor" to design?

Marcone marcone at email.com
Thu Jan 30 03:49:29 UTC 2020


I created a GUI using "ResEdit Resource Editor" and embeded to 
Dlang using this code above. Now I want to change the window 
Backgound Color when press a Button. How can I make it?


import core.sys.windows.windows;
import core.sys.windows.commctrl;
import std.stdio;
pragma(lib, "gdi32.lib");
pragma(lib, "comctl32.lib");

enum IDD_DIALOG1 = 100;
enum BT_1 = 40000;

HINSTANCE hInst;

extern(Windows):

BOOL DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM 
lParam) nothrow
{
     switch(uMsg)
     {
     case WM_INITDIALOG:
     {
     }
     return TRUE;

     case WM_CLOSE:
     {
         EndDialog(hwndDlg, 0);
     }
     return TRUE;

     case WM_COMMAND:
     {
         switch(LOWORD(wParam))
         {
             case BT_1:
             {
                 try {
                     // When press button the background need 
change to red for exemple.
                 }
                 catch(Exception) {

                 }
                 return true;
             }
             default: {
                 break;
             }
         }
     }
     return TRUE;
         default:{
         }
     }
     return FALSE;
}

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR 
lpCmdLine, int nShowCmd)
{
     hInst=hInstance;
     InitCommonControls();
     return DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, 
&DlgMain);
}


More information about the Digitalmars-d-learn mailing list