Overlapped window

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Overlapped window

Post by Asimov » October 7th, 2012, 10:23 am

Hi all,

I have been messing with the API again. The problem with the createwindow at the moment is that I want to get rid of the minimise and maximise buttons, but when I do this I get a black border around my screen.

Here is the new code

Code: Select all

RECT wr;
	wr.left = 650;
	wr.right = 800 + wr.left;
	wr.top = 150;
	wr.bottom = 600 + wr.top;
	AdjustWindowRect( &wr,WS_OVERLAPPEDWINDOW,FALSE );
    HWND hWnd = CreateWindowW( L"Chili DirectX Framework Window",L"Missile Command By T.R.Williams (Asimov)",
                               WS_OVERLAPPED|WS_SYSMENU ,wr.left,wr.top,wr.right-wr.left,wr.bottom-wr.top,
                              NULL,NULL,wc.hInstance,NULL );
I have removed WS_OVERLAPPEDWINDOW with what you see.
Now this works but leaves a border on the bottom and right hand side. I have tried changing dimensions in the Rect, but it then just crashes.

Any ideas?
Attachments
Overlap.jpg
(130.16 KiB) Downloaded 120 times
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Overlapped window

Post by LuX » October 7th, 2012, 1:05 pm

Dunno why it happens in this case, but with a borderless window I had to reduce the width by 10 and height by 30, so maybe here you too need to reduce by, say, 10 width and height, just try what works best.
ʕ •ᴥ•ʔ

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Overlapped window

Post by Asimov » October 7th, 2012, 1:39 pm

Hi Lux,

I tried that and it crashes, as the window has to be 800 * 600 or it crashes. Will play with this for a bit and see if I can get it satisfactory.
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Overlapped window

Post by chili » October 7th, 2012, 2:31 pm

It happens because the function that calculates the window size doesn't work with some window class types. I actually made something that got around this problem, but I forget what it is. :P
Chili

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Overlapped window

Post by Asimov » October 7th, 2012, 10:15 pm

Hi Chilli,

You are right. It doesn't even work with WS_OVERLAPPED properly. So instead I have been looking for a way to ghost or disable it instead. I haven't found the answer yet, but I am sure there heh heh
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Overlapped window

Post by chili » October 8th, 2012, 1:24 am

Found it. Try this:

Code: Select all

	AdjustWindowRect( &wr,WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU,FALSE );
    HWND hWnd = CreateWindowW( L"Chili DirectX Framework Window",L"Chili DirectX Framework",
                              WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU,wr.left,wr.top,wr.right-wr.left,wr.bottom-wr.top,
                              NULL,NULL,wc.hInstance,NULL );
Chili

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Overlapped window

Post by Asimov » October 8th, 2012, 5:03 pm

Hi Chilli,

Great that works. I tried something along those lines last night, and it crashed a bit LOL, but this works. Cool. I really want to finish this game now, because the next game will hopefully be full screen and networkable, in my dreams LOL
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

Post Reply