Image not showing on top

Jul 1, 2013 at 11:57am
Hi im trying to display images on top of my Background image gui
so like buttons an stuff
but the problem is that there not showing ontop.
i can only get one of them to show

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

// includes
#include <windows.h>
#include <stdio.h>
#include "res.h"

// defines
#define LWA_COLORKEY            0x00000001
#define LWA_ALPHA               0x00000002

#define bitmapHeight            217
#define bitmapWidth             433    

#define g_ColourKey             0xFF00FF // 0,0,255(pink) in hex RGB


HBITMAP hSkinMBmp = NULL;
HBITMAP hSkinMBmp2 = NULL;
int i = 0;


void DestroyCaption(HWND hwnd, int windowWidth, int windowHeight)
{
 DWORD dwStyle = GetWindowLong(hwnd, GWL_STYLE); 
 dwStyle &= ~(WS_CAPTION|WS_SIZEBOX); 
 
 SetWindowLong(hwnd, GWL_STYLE, dwStyle); 
 InvalidateRect(hwnd, NULL, true); 
 SetWindowPos(hwnd, NULL, 0,0,windowWidth, windowHeight, SWP_NOMOVE | SWP_NOZORDER);  
}

void PaintImage(HWND hwnd, HGDIOBJ hgdiobj, int nXDest, int nYDest, int nWidth, int nHeight)
{
	BITMAP bm;
	PAINTSTRUCT ps;
	HDC hdc = BeginPaint(hwnd, &ps);
	HDC dcSkin = CreateCompatibleDC(hdc);
	GetObject(hgdiobj, sizeof(bm), &bm);
	SelectObject(dcSkin, hgdiobj);
	BitBlt(hdc, nXDest, nYDest, nWidth, nHeight, dcSkin, 0, 0, SRCCOPY);
	EndPaint(hwnd, &ps);
}

BOOL CALLBACK dialog(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
  	switch(Message)
	{
           
	  case WM_INITDIALOG:
          {
            if(SetLayeredWindowAttributes != NULL)
            { 
              if(i < 1) {
               DestroyCaption(hwnd,bitmapWidth,bitmapHeight);
               i++;
              }   
              
              SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
			  SetLayeredWindowAttributes( hwnd, g_ColourKey, 0, LWA_COLORKEY);
            }     
            
            break;
          }
        

        case WM_LBUTTONDOWN:
           {
            PostMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION,0);
            break;
           }

        case WM_CLOSE:
           {     
		    DeleteObject(hSkinMBmp);
			DeleteObject(hSkinMBmp2);
            EndDialog(hwnd, 0);
		    break;
           }
       

        case WM_PAINT:
			{
				PaintImage(hwnd, hSkinMBmp, 0, 0, bitmapWidth, bitmapHeight);
				PaintImage(hwnd, hSkinMBmp2, 400, 0, 21, 19);
				break;
			} 
        
        case WM_COMMAND: 

       default:
			return FALSE;
	}
	return TRUE;
}


int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{

  hSkinMBmp = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MSKIN));      
	hSkinMBmp2 = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MSKIN2));  
  
   return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, dialog);
}


Jul 5, 2013 at 6:36pm
An also away to place small images next to the GUI image on mouse hover?
I can't fin any good simple tuts on how to do this
Topic archived. No new replies allowed.