Hi folks,
I´ve got another problem to fix.
I want to show a little bitmap as a preview out of the entrie, marked in my textbox....
Compiling is correct, but the existing bitmap is never shown.
This is the code:
case ID_LOOK:
/** if clicked, there is shown a previewof the marked item **************/
/** Get marked Item from ID_BOX**********/
hList = GetDlgItem(hwndDlg, ID_BOX);
int read = SendMessage(hList, LB_GETCURSEL , 0, 0);
if (read<0) return TRUE;
LB_GETTEXTLEN;
SendMessage(hList, LB_GETTEXT,read, (LPARAM)pfad);
Sleep(100);
/** if another item is marked, set pfad2 to 0 ************/
pfad2[0] = 0;
/** get the path to the Bitmap ******************/
wcscat(pfad2, L"\\Storage Card\\GoPalWorld-Skin\\Designs\\Autotauscher\\");
wcscat(pfad2, pfad);
wcscat(pfad2, L"\\icon.bmp\0");
/** test to copy the bitmap to the root of Storage Card ***********/
if(CopyFile(pfad2, L"\\Storage Card\\icon.bmp", FALSE) != TRUE)
{MessageBox(0,L"Vorschau-Bild existiert nicht!",L"Fehler",0);} // if copying faults send Message to the user
else
{
/** show bitmap out of marked folder in ID_BOX on hwndDlg at x = 60, y= 100 **/
if(hBitmap) DeleteObject(hBitmap); // delete "old" Bitmap
hBitmap = LoadBitmap(NULL, L"\\Storage Card\\icon.bmp\0"); // Test to load bitmap from SD-card
// hBitmap = LoadBitmap(NULL, pfad2); // normal procedure with variable
HDC hdc = GetDC(hwndDlg);
HDC hdcMem = CreateCompatibleDC(hdc);
HGDIOBJ hbOld = SelectObject(hdcMem,hBitmap);
BitBlt(hdc, 60, 100, 50, 50, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem,hbOld);
DeleteDC(hdcMem);
ReleaseDC(hwndDlg,hdc);
InvalidateRect(hwndDlg,0,TRUE);
}
break;
What is going wrong with this code?
The program runs on CE5 and CE6 but the bitmap is never shown on hwnDlg...
Greetings
Peter