Windows Procedrue
Code:
LRESULT CALLBACK MyApp::WndProc(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CREATE:
{
BitMap = LoadBitmap(HInstance, MAKEINTRESOURCE(IDB_BITMAP1));
if(BitMap == NULL)
{
MessageBox(hwnd, "Loading Failure", "Failure", MB_OK);
}
//stc is of type StaticControl. Which is suppose to handle the static control.
if(!stc.Create(WS_EX_CLIENTEDGE, "", WS_CHILD | WS_VISIBLE | SS_BITMAP, 10, 10, 10, 10, hwnd, HInstance))
{
MessageBox(NULL, "Creating Static Box failed", "Failure", MB_OK);
}
stc.SetImage(IMAGE_BITMAP, BitMap); // Problem
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_QUIT:
DestroyWindow(hwnd);
break;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}
SetImage function in class StaticControl:
Code:
void SetImage(int Style, HBITMAP Bitmap)
{
if(SendMessage(hwnd, STM_SETIMAGE, Style, (LPARAM)Bitmap) == NULL)
{
MessageBox(NULL, "Massive Failure", "Failure", MB_OK);
}
}
EDIT:
Nvm it works just fine now, idk why it didn't before
Thanks guys.