Click here to Skip to main content
16,006,382 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Resizing Pin
enhzflep12-Oct-08 7:42
enhzflep12-Oct-08 7:42 
GeneralRe: Resizing Pin
Sarriss12-Oct-08 8:11
Sarriss12-Oct-08 8:11 
GeneralRe: Resizing Pin
enhzflep12-Oct-08 8:43
enhzflep12-Oct-08 8:43 
GeneralRe: Resizing Pin
Mark Salsbery12-Oct-08 9:02
Mark Salsbery12-Oct-08 9:02 
GeneralRe: Resizing Pin
Mark Salsbery12-Oct-08 9:10
Mark Salsbery12-Oct-08 9:10 
GeneralRe: Resizing Pin
Sarriss12-Oct-08 10:55
Sarriss12-Oct-08 10:55 
GeneralRe: Resizing Pin
Mark Salsbery12-Oct-08 11:18
Mark Salsbery12-Oct-08 11:18 
GeneralRe: Resizing Pin
Sarriss12-Oct-08 12:10
Sarriss12-Oct-08 12:10 
well if i showed my working code it would kinda fill up most of this forum Smile | :) and posting a lot of code in here tends to be tedious Smile | :)

as far as the questions go


as far as knowing im not supposed to delete regions ive used in setWindowRgn, no i did not know but i do know, which kinda begs the question how to you resize a region without destroying it or setting a new windowrgn.

again as far as identical local variables Smile | :) i didnt actually think it would matter in this trial run but also again i was wrong lol

so begs the question given my own GUI and region how would i resize it lol

The regions used are below Wink | ;) along with the definitions and most of the skining stuff
at the top with the beloved variables I have

#define LWA_COLORKEY            0x00000001
#define LWA_ALPHA               0x00000002
#define g_ColourKey             0xFF00FF // 255,0,255(pink) in hex RGB
#define WS_EX_LAYERED			0x00080000
#define IDB_CLOSEWINDOW 1000

typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
lpfnSetLayeredWindowAttributes SetLayeredWindowAttributes;

int nWidth = 506;
int nHeight = 376;
BOOL mDown = FALSE;
POINT AnchorPoint;


the initial regions are create at the top of WndProc and are used in WM_CREATE

LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	DWORD dwStyle = GetWindowLong(hWnd, GWL_STYLE);
        HRGN hRegion1 = CreateRectRgn(0, 0, nWidth, nHeight);//-----1
	HRGN hRegion2 = CreateRectRgn(0, 0, nWidth, nHeight);//-----1

	switch(Msg)
	{
	case WM_CREATE:


		g_Hwnd = hWnd;
		// Remove title bar and prevent resizing
		dwStyle &= ~(WS_CAPTION|WS_SIZEBOX);
		SetWindowLong(hWnd, GWL_STYLE, dwStyle);
		
		CombineRgn(hRegion1, hRegion1, hRegion2, RGN_OR);//-----1
		SetWindowRgn(hWnd, hRegion1, true);//-----1
		
		SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
                SetLayeredWindowAttributes(hWnd, g_ColourKey, 0, LWA_COLORKEY);

		m_hCloseButton = CreateWindow("BUTTON",
						"x",
						WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_CENTER | BS_FLAT,
						nWidth-28, (nHeight-nHeight+10), 20, 20,
						hWnd,
						(HMENU)IDB_CLOSEWINDOW,
						hInst,
						NULL);



WM_PAINT calls a function called skin() which is below


BOOL Skin() {

	// load the skin bitmap from resource
	HBITMAP hSkinBmp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_MAIN));
	if (!hSkinBmp) return -1;

	// create a device context for the skin
	HDC dcSkin = CreateCompatibleDC(0);

	// select the skin bitmap
	HBITMAP hOldBmp = (HBITMAP)SelectObject(dcSkin, hSkinBmp);

	PAINTSTRUCT ps;
	BeginPaint(g_Hwnd,&ps);

	BitBlt(ps.hdc, 0, 0, nWidth, nHeight, dcSkin, 0,0, SRCCOPY);

	EndPaint(g_Hwnd,&ps);
	return 0;
}


and as far as the mouse move well you have all that and i may aswel delete most of it and start again lol
WinMain is just the standard create you own Win32 API window

so any help would be had Big Grin | :-D lol as you can tell im a n00b trying to learn API and not having too much success
GeneralRe: Resizing Pin
enhzflep12-Oct-08 21:50
enhzflep12-Oct-08 21:50 
GeneralRe: Resizing Pin
Sarriss13-Oct-08 1:12
Sarriss13-Oct-08 1:12 
GeneralRe: Resizing Pin
enhzflep13-Oct-08 2:28
enhzflep13-Oct-08 2:28 
GeneralRe: Resizing Pin
Sarriss13-Oct-08 2:33
Sarriss13-Oct-08 2:33 
GeneralRe: Resizing Pin
enhzflep13-Oct-08 2:44
enhzflep13-Oct-08 2:44 
GeneralRe: Resizing Pin
Sarriss13-Oct-08 2:51
Sarriss13-Oct-08 2:51 
GeneralRe: Resizing Pin
enhzflep13-Oct-08 3:02
enhzflep13-Oct-08 3:02 
GeneralRe: Resizing Pin
Sarriss13-Oct-08 3:10
Sarriss13-Oct-08 3:10 
GeneralRe: Resizing Pin
Mark Salsbery12-Oct-08 7:47
Mark Salsbery12-Oct-08 7:47 
QuestionI have some questions. Pin
FR2ESOD12-Oct-08 1:36
FR2ESOD12-Oct-08 1:36 
AnswerRe: I have some questions. Pin
Jijo.Raj12-Oct-08 2:04
Jijo.Raj12-Oct-08 2:04 
AnswerRe: I have some questions. Pin
Bram van Kampen12-Oct-08 2:30
Bram van Kampen12-Oct-08 2:30 
QuestionNulls inserted between text characters when using GetDlgItemText Pin
ForNow11-Oct-08 21:05
ForNow11-Oct-08 21:05 
AnswerRe: Nulls inserted between text characters when using GetDlgItemText Pin
CPallini11-Oct-08 21:41
mveCPallini11-Oct-08 21:41 
AnswerRe: Nulls inserted between text characters when using GetDlgItemText Pin
Hamid_RT11-Oct-08 22:13
Hamid_RT11-Oct-08 22:13 
AnswerRe: Nulls inserted between text characters when using GetDlgItemText Pin
ForNow11-Oct-08 23:31
ForNow11-Oct-08 23:31 
Questionhow to set null to 2*2 static array in c++ Pin
john563211-Oct-08 17:36
john563211-Oct-08 17:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.