• Advertisement

Archived

This topic is now archived and is closed to further replies.

Window programming questions

This topic is 5539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

  • Advertisement