Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Win32 (http://www.go4expert.com/forums/win32/)
-   -   Bitmap display probelm. (http://www.go4expert.com/forums/bitmap-display-probelm-t327/)

hemanth.balaji 26May2005 22:34

Bitmap display probelm.
 
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

shabbir 27May2005 06:54

Re: Bitmap display probelm.
 
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

hemanth.balaji 27May2005 09:02

Re: Bitmap display probelm.
 
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

hemanth.balaji 27May2005 09:15

Re: Bitmap display probelm.
 
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

shabbir 27May2005 10:03

Re: Bitmap display probelm.
 
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.

hemanth.balaji 27May2005 10:09

Re: Bitmap display probelm.
 
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.

shabbir 27May2005 10:13

Re: Bitmap display probelm.
 
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.

hemanth.balaji 27May2005 20:03

Re: Bitmap display probelm.
 
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

shabbir 28May2005 06:29

Re: Bitmap display probelm.
 
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.

hemanth.balaji 28May2005 06:40

Re: Bitmap display probelm.
 
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


All times are GMT +5.5. The time now is 09:23.