|
Override the WM_CLOSE message (OnClose) in your MainFrame class, and put your code it there. It will catch the X in the uppoer right corner, as well as Alt-F4, or an attempt to close from the task manager.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
It helps a lot, that works fine, thanks.
Dr.Pi
|
|
|
|
|
The recommended place for a close confirmation is in an overload of CanCloseFrame() in your CDocument -derived class.
|
|
|
|
|
This is the place, thanks.
Dr.Pi
|
|
|
|
|
How can I create an empty DACL?
Smile
|
|
|
|
|
I made a toolbar and added a combobox to it by grabbing the dimensions
of a Separator item and then moving it over the Separator. Everything
works fine until you pull the toolbar away and change the shape.
The combobox does not move in relation to the other buttons (it get's
lost). Although if you change the shape of the toolbar enough you can
find it.
|
|
|
|
|
Hi All,
Where are the kernel object created? Is it in the process kernel memory or some where in kernel memory regardless of process?
How they can shared across the processes?
~Suraj
Suraj Gupta
|
|
|
|
|
How to know(get) the process completion?.
|
|
|
|
|
Can you be more specific.
|
|
|
|
|
1). 'OpenProcess' to obtain the handle.//OpenProcess (PROCESS_ALL_ACCESS,0,PID);
2). 'WaitForSingleObject' on the obtained handle until it returns 0.
~Suraj
Suraj Gupta
|
|
|
|
|
I asked this question today but the answers did not solve my problem.
How can I communicate between two unrelated dialog boxes?No one of the boxes is the parent of the other.For example I have a main dialog box and creating two more Dialog boxes from Main dialog box as Dlg1 and Dlg2.Can I communicate between Dlg1 and Dlg2?Can I send orders from Dlg2 to Dlg1?If the answer yes how can I do that?
Thanks
|
|
|
|
|
iayd wrote: I have a main dialog box and creating two more Dialog boxes from Main dialog box as Dlg1 and Dlg2.
Are Dlg1 and Dlg2 modal or modeless?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Ok, since they both belong to the same parent, you can either send custom messages to the other via the parent, or use the WM_COPYDATA message.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is SetParent() method can help me in that situation?If yes how should I write it?For example can we change the parent of Dlg1 by using SetParent() method?
|
|
|
|
|
Why would you need to re-set the parent window? It was already set when the dialog was instantiated:
COtherDialog *pDlg1 = new COtherDialog(this); Call Create(IDD) in COtherDialog 's constructor.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
There are several ways. Probably the simplest (not necessarily the best) is containment, meaning one dialog contains another as its data member. Then, use the object handle to communicate.
Best,
Jun
|
|
|
|
|
I am beginner so can you give a little example?
|
|
|
|
|
In your header:
class YourDialog1:CDialog
{
}
class YourDialog2:CDialog
{
YourDialog1 *dlg1;
}
In your .cpp file:
dlg1 = new YourDialog1();
dlg1->SomeMethod();
Best,
Jun
|
|
|
|
|
|
I saw your answer but the problem is that CDlg1 and CDlg2 are unrelated(not parent or child).I am creating them as Modeless from CMain.I want to send orders from Dlg2 to Dlg1.
|
|
|
|
|
1. 'FindWindow'in dlg2 to obtain the handle of the dlg1.
2. Send WM_COPYDATA message via 'SendMessage' API.
Suraj Gupta
|
|
|
|
|
Given the window handle to the recepient of the communication, simply use PostMessage / SendMessage with a custom window message. For the message itself, use WM_APP (+ x) if within the same process or the result of RegisterWindowMessage if across processes. Fill the two parameters as needed depending on what you want to pass between the two windows.
I prefer PostMessage myself to avoid the potential of a deadlock between the two windows.
Judy
|
|
|
|
|
Hello All,
Currently I have developed an application using VC++ 6.0. Latter when "Developer Environment 2003" came I migrated to VC++.NET. But my code is fully like VC++ 6.0 code (I have not used .NET fully in my project)
I am planning to move this project to either C# or VC++. NET fully. I want your suggetion which will be better. Application uses MFC for GUI, Database, File operations, COM for communication between different modules and multithreading extensively. Suggest me which is better for such type of project C# or VC++.NET!!!
I want to have better GUI, easy DB Support, File oprations, easier COM communication and mainly Mulithreading and IPC should be easy. Memory leaks it is automatically taken care I can be more lazy.
Suggest me better option between 2.
Thanks
Ravi
|
|
|
|
|
It actually depends on many factors, e.g., your level of MFC. The last one you mentioned about memory management seems a critical one. To get the memory leaks taken care of automatically, you probably have to use C# or C++/CLI (managed C++).
Best,
Jun
|
|
|
|