how to load bitmap correctly?
it's my button, i'm typing file name in edit control, reading it:
case button:
{
buffer.resize(GetWindowTextLength(GetDlgItem(hWnd,text_edit))+1);
GetWindowText(GetDlgItem(hWnd,text_edit),&buffer[0],buffer.size()+1);
for(int i=0;i<buffer.size();i++)
img_name+=buffer[i];
WndProc(hWnd,WM_PAINT,NULL,NULL);
}
break;
then trying to load bmp file(263*289) and draw it, but it doesn't work
case WM_PAINT:
{
hdc = BeginPaint(hWnd, &ps);
HDC tdc =CreateCompatibleDC(hdc);
HBITMAP bitmap=(HBITMAP)LoadImage(NULL,img_name,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
HBITMAP old = (HBITMAP) SelectObject(tdc,bitmap);
BitBlt(hdc,0,0,263,289,tdc,0,0,SRCCOPY);
SelectObject(tdc,old);
DeleteObject(bitmap);
DeleteDC(tdc);
EndPaint(hWnd, &ps);
}
break;