Hi all, I'm using C++ with Win32 API, no MFC. I have a game with a normal game loop in the WinMain function. Within the loop I call all the processing and drawing and such. But for some reason, when I grab the edge of the application window with my mouse and resize it, the game loop just pauses. I still seem to be receiving WM_SIZING and WM_PAINT messages, which doesn't make sense because my PeekMessage is in the game loop and is not being called. I don't understand what's going on. Anyone have any ideas? Thanks!! KR
KellyR
Posts
-
WinMain loop pauses when the application window is grabbed by mouse and resized? -
Thread local variablesI'm not familiar with whatever the TLS API is, but if you're accessing this variable from multiple different threads directly, you have to lock it. If you want to get around this, use only one thread to change it and post signals or windows messages to that thread telling the variable to change, that way you (probably) won't get any weird conflicts.
KR
-
Virtual keyboard API or code that runs on WinXP and/or Vista?Hi all, This project is using C++ with MFC with Visual Studio 2005. I'm converting over an old WinCE project which used to use SHSipPreference and some keyboard dlls called NumSip and AlphaNumSip which essentially popped up a virtual keyboard on the PDA. I'm trying to find something similar for WinXP that I can use instead. I need an ability to control the keyboard from within the program, tell it when to pop up and close, etc. Aside from just writing a virtual keyboard from scratch (which would work fine but I don't have a lot of time to do this), does anyone know of an existing API/lib/code or anything that does this already? Thanks!
KR
-
lib file keeps fully recompiling even when no changes have been madeOops, sorry I forgot to respond to this but I did actually fix it, the project that kept recompiling was looking for files from a project that weren't added into my parent project. I guess somehow since the one sub-project wasn't added into the parent, the files weren't registering as having been compiled "under the project" or something. When I added in the dependant project, everything was fixed.
KR
-
inline or macroIn addition to what Stuart said, an inline function probably won't actually "inline" in the compiler if it's 20 lines long. If it's only a few lines, then it might. And I wouldn't really consider 20 lines to be that "small." Generally you only want to inline 1-liners or maybe a few more lines than that, but the compiler will ultimately decide what it lets you inline even if you specifically set the function to be an "inline" function.
KR
-
lib file keeps fully recompiling even when no changes have been madeHi, I'm using Embedded Visual C++ 4.0 for this project so it's a little different than the recent versions of VC++ but by and large it's the same interface, albeit more similar to the older Visual Studio 6.0 from years past. So the problem is this: I have a large project that consists of several smaller projects. One of these smaller projects, a lib project, keeps fully recompiling every darned time I compile the project, even though no changes have been made to it. The other lib files are fine, they don't recompile unless I change one of their cpp/h files. I'm sure it's just some silly setting on this lib project but for the life of me I can't find it. Does anyone know what I can do to stop it from recompiling every time? Thanks!
KR
-
SetWindowSubclass is killing my app!I see what happened, I was returning in my WM_PAINT messages which was causing the huge CPU usage. I guess the DefSubclassProc must do something with WM_PAINT that causes the message not to be sent again; maybe by returning and not setting this parameter, the WM_PAINT was getting sent continuously. Thanks for help!
KR
-
SetWindowSubclass is killing my app!Hi, This app is in C++ without MFC, and I'm using SetWindowSubclass to subclass two of my windows controls so that I can manually catch the messages that are sent to their message pumps and process them accordingly. The app is dialog-based and uses a GetMessage loop, so it does not usually take much CPU power... however, the problem is this: when I call SetWindowSubclass to subclass either of the controls, suddenly my CPU usage jumps to 99% on the task manager. Does SetWindowSubclass branch a new thread for each control that will just run on its own regardless of my GetMessage loop? If so, how do I stop it from doing that? If not, what the heck is it doing and how can I use SetWindowSubclass without using 99% of my darned CPU? Thanks!
KR
-
How to tell when an application is being dragged around screen?That is what I needed, thank you!!!
KR
-
How to tell when an application is being dragged around screen?Hi, This app is written in C++ without MFC. My question is this: Let's say my app is not full screen, and a user clicks the top bar of the app and drags it around the screen. Is there a windows message that gets sent back to my main app's message pump to tell me when the window is moving? like WM_ etc? I have been looking over MSDN and other documentation and I have not been able to find anything like this but maybe I am missing something. If it does not send a message, is there any other way that I can tell when the app is being dragged around? Thanks!
KR
-
How do I completely take over drawing for a listboxUgh, I can't believe there's no way to custom draw the internal scrollbars of a control... it may not have an HWND associated with it, but you can click it and use it just like any other scrollbar so it must send some sort of scrollbar messages, and it's drawn somewhere, somehow, so there has to be a way to custom draw it... Thanks for the link though, more and more it keeps looking like I will have to put in my own custom scrollbars but I wish I could just take advantage of the internal ones.
KR
-
How do I completely take over drawing for a listboxHi, I asked a question sort of similar to this a few days ago, but the problem has now evolved; what I want to do is: I am using C++ with the windows API, without MFC. I want to retain all the functionality of a listbox but I want to draw everything myself. If I set the style to OWNERDRAW I can at least draw the listbox items and the box itself (if I don't give it border) but I still can't draw any scrollbars created using WS_VSCROLL or WS_HSCROLL; they seem to use the default windows drawing behavior. So how do I completely override all the default drawing for a listbox (or any windows control for that matter)? I don't want to draw over the default scrollbars; I want them to simply not draw at all, but still "exist" and allow me to ownerdraw them. Thanks!
KR
-
How to ownerdraw a scrollbar inside a listbox?Thanks, I was able to find what I needed in that article.
KR
-
How to ownerdraw a scrollbar inside a listbox?That example uses MFC which I am not using in this program, also what I want to do is ownerdraw the internal scrollbar itself, I don't want to superimpose a new scrollbar control over top of the listbox. Isn't there a way to set the listbox's scrollbar to ownerdraw and handle that?
KR
-
How to ownerdraw a scrollbar inside a listbox?Hi, I'm trying to do this program in C++ without MFC that creates an owner-drawn listbox with the WS_VSCROLL style. Owner drawing the listbox and listbox items is not a problem, but how do I owner draw the vertical scrollbar within the listbox? Even if I set the listbox style to LBS_OWNERDRAWVARIABLE or LBS_OWNERDRAWFIXED, the scrollbar still seems to draw normally. Thanks!
KR
-
App depending on wrong DLL versionHi, I recently upgraded several MFC projects at work from Visual Studio 2005 to 2008. However, when I distribute the recompiled executables with the new Studio 2008 DLL's, I'm getting the "configuration error" that always comes up when dlls/dependencies/manifests are wrong/missing. Looking at the binary, I see that two of my apps are depending on a previous version of MFC90.dll, but the MFC.manifest file is pointing to the latest version. I'm thinking that this is causing the error, but my question is, how do I get my apps to compile/depend on the same version of the dll that the manifest is pointing to? Thanks!
KR
-
C++ heap allocation questionMaybe a dumb question, but I was just curious -- are heap-allocated objects in C++ destroyed when a program is exited even if they aren't explicitly freed with calls to delete or free? Thanks!
KR
-
Another CScrollBar questionThat's weird, that's the first thing I tried earlier today and it didn't work. I must have done something wrong before because it seems to work now. I thought it was stupid to have to subclass the thing... Ok, all set, thanks!
KR
-
Another CScrollBar questionHi, Mark directed me to the MSDN section about scrollbars this morning which helped a lot, but I still have one problem that I can't seem to solve: Once again I'm using VC++ with MFC, and I have a CScrollBar that I want to use to scroll some custom controls. I don't want to use the dialog's "built-in" scrollbar because it isn't in the right place and I have lots of other bits of data there, so I have a stand-alone CScrollBar control that I have mapped through DDX_Control to my dialog. Since my scrollbar is stand-alone I had to subclass it in order to catch the WM_VSCROLL messages sent to its window when the bar is moved. This all works fine BUT ONLY when I have the scroll bar's style set as WM_VSCROLL. The style SHOULD be SBS_VERT, but when I make the style SBS_VERT instead of WM_VSCROLL, I no longer get any WM_VSCROLL messages in my subclassed process. What could I be doing wrong??? Also on a side note, it seems pretty ridiculous that I have to either subclass the control or overload it and handle OnVScroll explicitly to get the scroll bar to function. Is there a better way? Thanks!
KR
-
What message does a vertical CScrollBar send when it is moved?Thanks
KR