Hi
I am trying to set a bitmap background for my dialog box. The compilation runs without any errors but the background does not appear at all.
Dont you know what might be wrong?
Code:
#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
#include "resource.h"
HBRUSH hBG;
HINSTANCE hInstance;
HDC hDC;
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch ( uMsg )
{
case WM_COMMAND:
switch ( LOWORD(wParam) )
{
case IDCANCEL:
DeleteObject(hBG);
EndDialog(hwndDlg, LOWORD(lParam));
}
break;
case WM_CTLCOLORDLG:
SetBkMode((HDC)wParam, TRANSPARENT);
return (INT_PTR)hBG;
break;
case WM_INITDIALOG:
hBG = CreatePatternBrush(LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_bg)));
break;
}
return FALSE;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,
LPSTR lpCmdLine, int nShow)
{
return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_MAIN),
NULL, (DLGPROC)DialogProc);
}
MSVC++
Thank you for any help