Skip to main content
GameDev.net gamedev.net
🔒 Locked

Window programming questions

Started by snisarenko Dec 24, 2002 at 9:26 PM 15 replies 600+ views
Original Post
snisarenko
snisarenko
I have a few questions about programming a window. How would I implement (or modify Nehe''s code) to : 1. Make a non-resizable window. When cursor comes to the edge it does not turn into a resizing arrow. 2. Window only has a close button at the top right corner. 3. How to make the mouse coursor dissappear in windowed mode and give all of the mouse control to my window ?
bjmumblingmiles
bjmumblingmiles
in CreateWindowEx, there is something like WS_OVERLAPPEDWINDOW...change it to WS_OVERLAPPED | WS_SYSMENU

then use this at the beginning: ShowCursor(false) and at the end ShowCursor(true)

if you have any questions ask
Brian
Brian J
snisarenko
snisarenko
So if I do what u said in the window function then WINDOWS shouldn't send me the resize message, right ???????

If I do ShowCursor(true) in the middle of my program after i called ShowCursor(false) in the begining, will it show up ?

Also, if I do ShowCursor(true), will it show up in fullsreen?

[edited by - snisarenko on December 24, 2002 10:42:08 PM]

[edited by - snisarenko on December 24, 2002 10:42:58 PM]
bjmumblingmiles
bjmumblingmiles
Well if you cant resize then no...it wont send a resize message...um...ShowCursor has a counter ie if you call it with false twice, you will have to call it with two trues to make it come back up. Show cursor works for fullscreen and windowed mode.

brian
Brian J
j stoll
j stoll
1)&2)in mfc use CMiniFrameWnd


[edited by - j stoll on December 24, 2002 10:49:11 PM]
snisarenko
snisarenko
Thank u for the replies I will try that [:=)]

I tried it. It Worked. THANK YOU..THANK YOU..THANK YOU..

[edited by - snisarenko on December 24, 2002 11:07:19 PM]
snisarenko
snisarenko
Since i am bothering you anyways (sorry for being so inquisitive)
Help me out with one more thing

In windowed mode i did ShowCursor(FALSE). But it Still shows up when it goes outside the window. So how would i make it dissappear totally? Like in Unreal Tournament or Queake 3 when u play in windowed mode the cursor totaly dissapears.
bjmumblingmiles
bjmumblingmiles
Im not sure but it might have something to do with DirectInput exclusive mode...i could be way off. Another thing you could do is intercept mouse move messages and move the cursor back inside the window...which is more of a hack but if you want continuous movement thats probably all you are looking for anyway.

Brian
Brian J
snisarenko
snisarenko
How do i intercept and move the cursor ?
Are there standart Functions ?
JonoX
JonoX
To keep the cursor inside your window use the SetCapture and ClipCursor functions. I am not shore how they work as i have not used them yet but the win docs say they are used by paint progs to keep the cursor inside the window while drawing lines etc. there is an eg. in the ''win32 programmers reference'' that demonstrates what to do. enter ''Drawing Lines with the Mouse'' into the index to find it.

you could also use GetCursorPos(POINT) and SetCursorPos(320,240) to keep it ''under your control''

dose that help/confuse you?


- Jono AH
JonoRule #1: If you build it, they will come -- to hack and cheat.
snisarenko
snisarenko
Thanks, thats just what i needed.

One more question before I make your brain melt. How do I get the coordinates of my window in windowed mode ?
davepermen
davepermen
GetWindowRect for the outer coordinates
GetClientRect for the coordinates of the part without borders and titlebar and that stuff

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia
My Page davepermen.net | My Music on Bandcamp and on Soundcloud
snisarenko
snisarenko
Does it return a POINT ?
Or do I have to put a POINT as a paramater ?
Pipo DeClown
Pipo DeClown
it accepts a *POINT, so you put a &POINT into it.
but when you declare it you just do POINT myPoint. not POINT* pmyPoint. the POINT will contain a x and a y value.

.lick
snisarenko
snisarenko
Well the function accepts the window pointer and a rectangle object.
so i do this
GetWindowRect(hWnd,windowRectangle);

During runtime it gives me a memory access error.

[edited by - snisarenko on December 25, 2002 3:03:47 PM]
snisarenko
snisarenko
Never Mind. I got it.

Thanks for replies everyone!!!!!!!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.