Bitmap display probelm.

hemanth.balaji's Avatar, Join Date: May 2005
Go4Expert Member
Hello,
This is Bob from Bangalore, India. I have a doubt . I have a logo . I wanna display it in the project I

made. But it is not happening. It worked ina a simple window program. But when I ported the same code in the

below application which is available in the site it gives me a probelm. Please lemme know what is the probelm.

The filename is within the zip file namely s2.bmp.

http://www.geocities.com/kalamirch/Backend2.zip

Thanking you,
Bob
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Hello Bob

If you can put the code that is giving you the problem then I think we can help you out. Looking through all the code is a bit of difficult for us to understand the problem area.

Code:
s_hBitmap = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_SIEMENS));
if(s_hBitmap == NULL)
	MessageBox(hwnd, "Could Not load the logo", "Error", MB_OK | MB_ICONEXCLAMATION);
As it does not show the message box you are clearly loading the bitmap correctly but its just the display or paint that needs to be handled correctly.

Thanks
Shabbir Bhimani
0
hemanth.balaji's Avatar, Join Date: May 2005
Go4Expert Member
See dude. When i used the same code in the above program how come that the image is showing. Why is it not showing in the above program. I think its hidden
0
hemanth.balaji's Avatar, Join Date: May 2005
Go4Expert Member
Hi shabbir. It kinda worked when i put

BitBlt( hdc, 400, 30, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);

. The image was kinda hidden from the controls . I cud see it roughly as a line. What I want to do is display it on the controls I.E ON THE TABCONTROL OR THE TOOLBAR IN THE RIGHT TOP CORNER
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
See dude. When i used the same code in the above program how come that the image is showing. Why is it not showing in the above program. I think its hidden
What do you mean by its showing in the above program and also hidden in the above program.
0
hemanth.balaji's Avatar, Join Date: May 2005
Go4Expert Member
I am sorry dude. Typing mistake. What i meant is when i made the following changes in the zipped file found in the url above

BitBlt( hdc, 400, 30, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);

the image was showing (u could see a light line in the coordinates 400,30) I am sure its because the image is on the window but hidden by toolbar & tab control. Its behind hem. How do i put it on the toolbar or in the right hand top such that its on the menu bar.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
If you want to change the zorder of any control use the SetWindowPos function. It changes the size, position, and Z order of a child, pop-up, or top-level window.
0
hemanth.balaji's Avatar, Join Date: May 2005
Go4Expert Member
case WM_PAINT:
{
BITMAP bm; //BITMAP structure defines the type, width, height, color format, and bit values of a bitmap.
PAINTSTRUCT ps;

HDC hdc = BeginPaint(hwnd, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);

HBITMAP hbmOld = (HBITMAP) SelectObject(hdcMem, s_hBitmap);

GetObject(s_hBitmap,sizeof(bm), &bm);

// SetWindowPos(hwnd, HWND_TOPMOST, 400, 30, 50, 20, SWP_SHOWWINDOW);

BitBlt( hdc, 400, 30, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);



SelectObject(hdcMem, hbmOld);

DeleteDC(hdcMem);

EndPaint(hwnd, &ps);
}
break;

I made a change using SetWindowPos function, but stll something wrong
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
SetWindowPos(hwnd, HWND_TOPMOST, 400, 30, 50, 20, SWP_SHOWWINDOW);

You are using the hwnd as a parameter.It should be handle to the window having the bitmap as far as I can see from here.
0
hemanth.balaji's Avatar, Join Date: May 2005
Go4Expert Member
But the bitmap is external. So no window had the bitmap. I just wanted to place it on the main window and thats why i put the hwnd as the parameter. But it is hidden by tab controls and toolbar. Thats the whole probelm