Does anyone know how to find the number of windows open at a given time? I've looked into enumwindows and the find/get window functions, but there must be a way to just ask the window manager for this piece of information without having to iterate through all the windows. Thanks, ~Himanshu
heman154
Posts
-
Number of top level windows open -
detect Physical Memory sizeYahoo! Thanks, exactly what I was looking for. ~Himanshu
-
detect Physical Memory sizeDoes anyone know of a function that returns the total ram size that is available on the hardware that your application is running on. I change the logic of my code based on whether I have 128 MB or 256 MB of ram on a given unit. Thanks, Himanshu
-
how do i sense ctrl+C in a dialog based application?Use the RegisterHotKey Function. The function parameters let you input which window will receive the hotkey, and the specific key combination you need. Then in your window, place an ON_MESSAGE message map function that associates the WM_HOTKEY message with the function you want to call when the hotkey is pressed. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/registerhotkey.asp[^]
-
Static functions or Normal FunctionsLook into the Singleton design pattern and see if that will work for you.
-
A virtual function questionHave you placed any breakpoints to determine exactly where the access violation occurs (When you try to call the function, or inside the function...may trying to manipulate another object that isn't there anymore). How does this Print Object get instantiated?
-
set size of main application window at startupHave you tryed it? It's always worked for me. If you go on MSDN, the actual description is: "Call this member function to change the size, position, and Z-order of child, pop-up, and top-level windows." Also, make sure you put this in the OnCreate fcn.
-
set size of main application window at startupUse the following Cwnd function, BOOL SetWindowPos( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags ); Do a search on this fcn in msdn to find out more.
-
PDF File GenerationI had already seen a few of these utilities, but I just wanted to see if there was something in an existing API that would suit my needs (something I wouldn't have to pay for to distribute w/ my other software). Looks like that isn't possible, Thanks.
-
PDF File GenerationIs there anything in the Win32 API or in MFC that I can use to create a very simple program that will convert a text file into a PDF?
-
Windows HookIf your application is has a window, use classview and add the windows message handler: OnQueryEndSession. In the body, return false, and your application will prevent any shutdown that does not use the EWX_FORCE switch. Himanshu
-
help: Windows MessageBox prevents custom dialog from showing?I have a gui application that is launched via createprocess(...) from another gui application (that subsequently kills itself). This new application creates a secondary thread that creates a dialog (hidden) at thread creation. I am looking for windows shutdown requests on this secondary dialog (using onQueryEndSession()), and then attempt to show this dialog. It works correctly for most cases (e.g. when I press ctrl+alt+delete and then select shutdown), but sometimes I get a "System Settings Change" Message Box which appears after new devices installed. In this scenario, my application catches and prevents the shutdown request, but fails to throw up the dialog when I use ShowWindow(SW_SHOWNORMAL) (by the way, its modeless). Does anyone know why a messagebox like this would cause this behaviour? I found that uninstalling a device brings up a similar messagebox (same caption, different text), but in this test my modeless dialog does appear. Any suggestions would be appreciated. Thanks, Himanshu
-
How to detect a system shutdown?Thanks for the suggestion, but I don't think that will be sufficient for my case. I need to know before the upgrader app gets WM_ENDSESSION. The reason is that the the message could come at some finite time after I have started, and if the timing is right, then I could be somewhere in between deleting and replacing the system files (The upgrader actually updates a remote module that takes a total of ~40 minutes, so it wouldn't be essy closeout the processing in OnEndSession). I would like to use some sort of API fcn that I could call before I start the transfer, so that I know I can guarantee that windows is not shutting down before the upgrade starts. It looks like there might not be one available. I guess I'll try to use another application to capture the QueryEndSession and then have the information available to the Upgrader at startup. Thanks, Himanshu
-
How to detect a system shutdown?Is there a way to query windows to determine if a system shutdown is imminent? I have a user interface application which provides the option to execute an upgrader application. This upgrader application deletes some system files and then transfers new system files in place. The problem is that due to driver install (upgrade files are stored on a pcmcia card and windows asks to shutdown after the drivers are loaded sometimes), windows will sometimes send a messagebox asking for the unit to be restarted, which is very bad if the user selects ok when systems files have been deleted and not replaced yet. I've already put a handler function for the WM_QUERYENDSESSION message in the upgrader app (which works fine), but I still need to trap the condition in which the WM_QUERYENDSESSION message is sent before the upgrader application starts (in which case, the application missed this message). If I can find out if the shutdown is imminent, I can prevent the file transfer. Thanks, Himanshu