Jump to content
  • Advertisement

Archived

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

KeyS

Window creation & cpu% problems

This topic is 5645 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

The setup: I'm trying to create a non-resizable window in Direct3D8 that doesn't take up 100% CPU when not active. I've succesfully done this in a previous project by specifying (WS_OVERLAPPEDWINDOW & (~(WS_THICKFRAME|WS_MAXIMIZEBOX))) for the window style in CreateWindow(). I used a WNDCLASSEX structure. Also, to prevent 100% cpu usage when my window wasn't the active window, I toned down my gameloop to almost nothing when I got a WM_ACTIVATEAPP message that indicated I wasn't the active window. I also handled WM_PAINT in windowed mode to prevent problems with rendering when the user could see my window but it wasn't active. This seemed to work perfectly how I wanted. However, I recently started a new project and literally copied & pasted my old code into the new. During the interim, I switched from win2k to winXP, and I started using windowblinds 4 ( http://www.windowblinds.net/ ), which is a program that changes the windows theme (e.g. the start button, taskbar, and window border colors and look). Also, in the previous project, I created the window in the main process thread, and it was single-threaded. In this project, I create the window in a child thread, and it has many threads (I dont see how this could have any effect - the window exists entirely in 1 thread, though I say it just incase). Hopefully I have supplied enough information so that you may help me. Problem 1: I can't see the window menu at all, but I can touch and use all of it's features (the ones that are activated, that is, I cannot (re)size it, nor maximize it). The rendering window itself still exists and renders fine. Problem 2: It still takes up 100% cpu when I'm not the active app; and even worse, when I switch from windowed to fullscreen and back again, it takes a TREMENDOUSLY long time to adjust (e.g., get to where I can see my app, and not just black jibberish), and the desktop itself takes awhile to get back to normal too. To switch from windowed to fullscreen I change the present parameters and device->Reset(). I also change the window style using SetWindowLongPtr() to WS_POPUP when in fullscreen, and the above window style when in windowed mode. To make sure it takes effect, I SetWindowPos(). So, I'm not sure what I changed (practically nothing, except it's multithreaded), but I can't seem to get it to work properly. Any insight would be greatly appreciated; this minor bug has annoyed me for days now. Just incase you need it, I'm using WinXP Pro on Athlon 1800 with GeForce4Ti4200. ----- EDIT: Okay I've fixed the cpu% problem, I can't believe I didn't think of it earlier. I was toning down my gameloop when the window was inactive, but -not- in one of my other threads. It was taking up 100% doing absolutely nothing. I'm still new to multithreaded programming, sorry. However, I can't seem to find why problem #1 still exists, and also the part of #2 where it takes forever to toggle fullscreen back to windowed mode. Does a Reset usually take such a long time (and does it usually slow down the refreshing of the rest of the desktop - in the case of switching modes)? [edited by - KeyS on May 5, 2003 5:27:38 AM]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
re: #1, past versions of WindowBlinds have been known to not properly skin a popup menu that is being tracked without msg notification, i.e. one tracked using the TPM_NONOTIFY flag. try turning off menu skinning and see if the menus re-appear.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
re: #1, past versions of WindowBlinds have been known to not properly skin a popup menu that is being tracked without msg notification, i.e. one tracked using the TPM_NONOTIFY flag. try turning off menu skinning and see if the menus re-appear.



That worked! Thanks. If you don''t mind me asking, is there any way I can get this to work properly with windowblinds?

I suppose I wasn''t specific enough; I don''t actually have a real menu, but the title bar and the system menu remain from the WS_OVERLAPPEDWINDOW. I only removed the WS_THICKFRAME and WS_MAXIMIZEBOX options. Either way, it still wasn''t displaying correctly until I disabled windowblinds. Is there any way I can use the TPM_NONOTIFY flag to correct the problem?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!