|
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
|
|
|
|
|
For some reasons, I got a program in which create too much
CMultiDocTemplate objects. When it creates 7*15 objects, the XP can NOT create any window.
I used the MFC wizard to create a brand new projects, I wrote like this:
BOOL CTestDocTemplatesApp::InitInstance()
{
for(int i=0; i<50*14+13; ++i)
{
....
for(int i=0; i<50*14+13; ++i) // add this line to test the maximum number
{
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_TestDocTemplateTYPE,
RUNTIME_CLASS(CTestDocTemplatesDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CTestDocTemplatesView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
}
....
}
I added a 'for()' to test what is the maximum. First time I gave 200*14, the exe can not run, then I keep decrease the limit. And I got the same phenomena, XP can NOT create any more window. You can NOT open resource explore, can NOT open openfile dialog ....
I know it's very wrong to write codes like this. But I need to know why this happen. My guess is that the CMultiDocTemplate objects consume too much resource.
My question: who know the exact reason of this? or is there any articles talked about this?
Thanks a lot
|
|
|
|
|
Why would you need to create 700+ CMultiDocTemplate objects?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Only if you missed the point of what CMultiDocTemplate does.
|
|
|
|
|
I know what it does, but that does not explain the "why" in my question.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you look at the source code, there's no reason that it should fail.
The templates are aded to the end of a CPtrList container.
Have you debugged it to see why it doesn't work?
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Trying to load an image (bitmap/icon) to a CListCtrl.
Colors are displayed properly only in case the image is of 16 * 16 pixels
Colors of images of sizes more than 16 * 16 are not displayed properly irrespective of dpi and bit depth.
|
|
|
|
|
What view are you using in the list control? Did you specify the ILC_COLOR32 and ILC_MASK while creating the image list?
nave
|
|
|
|