|
|
you can use CWnd::isIconic() this function. It return non zero it it is minimized, otherwise 0
|
|
|
|
|
When adding a new dialog resource, the OK button is automatically configured so that, when clicked, it will take you off the form and do whatever code you wrote in an if statement:
if(dialog.DoModal() == IDOK){}
I want to add another button, Restore Defaults, that will take me off the form like the OK button and I can make an else if statement such as:
int returned = dialog.DoModal();
if(returned == IDOK){}
else if(returned == ID_RESET_DEFAULTS){}
How do code this?
Danny
|
|
|
|
|
In the handler for this "Restore Defaults" button, simply call EndDialog(ID_RESET_DEFAULTS) .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanx!!
(The book I was using to learn MFC must not be the greatest)
Danny
|
|
|
|
|
maybe the cheapest ?!
or maybe you failed reading it ;P
anyway, you found the right place for C++ questions though...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
is there an API call to obtain the list of COM ports as listed by Device Manager .
|
|
|
|
|
disclaimer: don't know how well MS supports this in all versions of Windows, so use at your own risk
The list of serial ports can be found in the registry at HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM
You can use RegEnumValue() to enumerate and create the list you need.
|
|
|
|
|
|
Cool
Given its description - The EnumPorts function enumerates the ports that are available for printing on a specified server. I don't think I EVER would have thought to use this to enumerate the serial communication ports.
|
|
|
|
|
Needles to say, not a directly Visual C++ question, but a
weird one, clearly related to intimately Win32 API.
To make a long story short:
- I developed a desktop application, using MFC and having, among other controls a list control.
- During development ant testing, everything looked OK.
- As a must, when the application is installed on a real user machine, it must register itself in "run at startup applications" (Registry locale machine key), and start a dialog, where some data is displayed (loaded in the list control)
And now come the WEIRD thing: on one of the machines, used for testing, the application failed to instantiate... because the List control was not instantiate. In other words, the application UI started before common controls being available!!! Is such a thing possible???
Did anybody encounter such situation before? Does anybody heard about such a weird problem in his experience?? Did exist a remedy?? Of course, I did not take in consideration a hack, like a "sleep" in my application startup... what make me worry is the situation itself. What is particular on machine I experienced the situation is that at machine starup, a service start and took most of machine resources for a while. In this time, I was able to log on (a Windows 2000 machine), and my application started immediately, with the error.
Did anybody hear somethiing like that?? For me, it sounds like Windows OS is not able to fully load its UI libraries, before application start... and this is weird, could be such a flaw? This lead a door to serious problems in how UI is designed... I will search myself further, but I also want your feedback, if such situation was encountered by someone.
I mention of course that, if the apllication is started late enough, it work normally on that machine. So, I'm not intrested in advices, but just in situation I mentioned: is possible that UI resources, needed by a desktop application, don't be available, at a certain moment?? - is a windows system!!!!!!
Any information with such a issue is greatly apreciated.
I can reformulate the problem, to avoid false hints: when is user32.dll loaded by OS, during the boot process??
Regards.
|
|
|
|
|
Did you link MFC statically or dynamically? It looks like it could not find the MFC DLLs, but it's just a guess. Try the Dependency Walker tool to check your executable for runtime dependencies, and verify if the machine has all the appropriates DLLs, or link everything statically.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
My application use MFC linked dinamically.
Dependency walker did not report problems, and as I said, the application run normally, if I move it from startup programs. The problem, as you point, could be that MFC is not available (loaded) at the particular time when application start. But for me this is really weird.
Thanks.
|
|
|
|
|
Hi there!
I want to change the name of a button name seen by the user at run time. Depending on how the user is using my program the name will change. I can use the code below to point to the button object, but I cannot figure out how to change the name of the item.
CButton* p = (CButton*)pVOS->dlg.GetDlgItem(IDC_BUTTON3);
The button name is initially set up in the resource editor.
Thanks,
Jerry
|
|
|
|
|
Use that instead:
pVOS->dlg.GetDlgItem(IDC_BUTTON3)->SetWindowText("Blah");
Hope this helps
|
|
|
|
|
Thanks for the info, have a good day.
Jerry
|
|
|
|
|
Is its possible to check if a new media is being inserted?
like a usb memory and so on. And if yes how?
|
|
|
|
|
WM_DEVICECHANGE
The WM_DEVICECHANGE device message notifies an application of a change to the hardware configuration of a device or the computer.
A window receives this message through its WindowProc function.
<br />
LRESULT CALLBACK WindowProc(<br />
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
|
|
|
|
|
Ok,
is ther an exemple I can use to see how it works?
|
|
|
|
|
Maybe like these?
1. Intercept the insertion/removal of a CD/DVD shaman74 Updated: 8 Apr 2005
Rating: 3.36 (9 votes)
How to intercept a new media in the drive, using WM_DEVICECHANGE message.
Interacting with the Operating System >> General
... Introduction While working (with Borland C++), I've found myself in the trouble to write an application that react to the insertion/removal of a media (CD/DVD) in one of the PC's drive. The Event After some surf on the web, I found that the best way to do this is to use a handler to a specific Windows message, WM_DEVICECHANGE , that is sent by the system when a media is inserted or removed, as specified in an MSDN page .> General
... Introduction This is a short article, written after many hours spent on the problem of refreshing a CD file system after burning. At the end, the solution I've found is very very simple, so I've decided to explain it here. The function I've used a call to the BroadcastSystemMessage function to send a WM_DEVICECHANGE message to Windows (XP in my case). The function is defined as follows (found on MSDN): long BroadcastSystemMessage( DWORD dwFlags, LPDWORD lpdwRecipients, UINT uiMes...
3. XDriveBar - Display drive buttons in a fixed toolbar Hans Dietrich Updated: 12 Aug 2003
Rating: 4.52 (14 votes)
XDriveBar implements a drive bar for the drives in a system. The demo project shows how to keep the drive bar in sync by handling the WM_DEVICECHANGE message.
Toolbar & Docking Window articles >> Toolbars
Download demo project - 61.3 Kb Introduction One of my favorite tools is the free 2xExplorer . It offers a very handy dual pane + tree view that really helps when you are working in several different directories. You can see some of the ways you can use 2xExplorer here . Anyway, one of the interesting things about 2xExplorer is that it has a drive bar next to the tree view...
4. Trapping windows messages Rui Reis Updated: 12 Apr 2003
Rating: 4.35 (15 votes)
Trapping windows messages in the .NET framework - a small tutorial
General .NET articles >> General
Download source files - 64.8 Kb Introduction To perform some tasks, we still need to trap unmanaged windows messages, even though we are developing managed code. This is a little tutorial that tries to clarify how to trap those messages using the .NET Framework. The code is written in C#. I believe it will be quite easy for those who are reading this document, and you can use VB.NET™ instead of C#, to port the concepts. Learn by example Now, to clarify...
|
|
|
|
|
|
today, when i open my workspace in vc6.0, i don't find my view class in workspace window. but the .pp and .h files of the view class still exist. other classes also exist. i can use class wizard to edit the view class. how can i get it back?
|
|
|
|
|
Yes sometimes it happens. In general, when you modify the .h file the problem is solved. Just add a blank line in the .h file and save the file, normally it should work.
|
|
|
|
|
Sometimes you might need to delete the temporary files (ncb, opt, aps, clw) and let them get recreated.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I want to edit some of my edit boxes before pasting data, so try to change them in OnEditPaste. This is working very good with Ctrl+V, but there is a problem. When i use right mouse button, there is a menu "copy, paste..." when i use that menus paste. OnEditPaste doesn't called.
is there a solution?
|
|
|
|
|