|
thanks, I have OnOk and OnCancel managed manually, and my program correctly exits via the red X button on the title bar, and through File->Exit
my problem is not that the dialog is closing but that pressing the Enter key while in an edit control is somehow activating a press of another button thats adding that data to a listview elsewhere. Since the user is typing into the edit control, I assumed the focus was there, so don't understand how that is turning into the same action as pressing this other button (that is not at the top of the tab order tree, so it's not like it's defaulting to that)
|
|
|
|
|
Does the edit control have the ES_WANTRETURN style?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I've tried it with (by setting the "want return" style in the visual dialog editor) and without (which is was before). same result!
|
|
|
|
|
Fair enough. Without walking through the code myself, I've no more suggestions.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
OK, removing the "default button" style now works, but NOW it closes the dialog, even though I have overridden the OnOk and OnCancel functions.
|
|
|
|
|
which is fine, I've now stopped OnOk from closing the diagram
thanks chaps!
|
|
|
|
|
When you press enter the framework calls the default action for OK (just like pressing the IDOK button).
So you either have to override OnOk method or set that edit box to "Want Return"(which you can do from the Properties window)
|
|
|
|
|
no, it's not exiting, it's acting like a button is being pressed. the edit control is Tab oRder 5, contains a number, there is another numeric edit at tab order 6, then tab order 7 is a button which adds some calculated data to a listview report. hitting enter after the data in edit box 5 is causing the data to be added to the table.
Is there any way I can track what's causing this?
|
|
|
|
|
Do you process VK_RETURN (not sure that's the way it's spelled) anywhere? Can you post the code?
Anyway setting WM_RETURN style should leave focus to that editbox unless the Enter key is handled somewhere else
|
|
|
|
|
I'm using Acrobat Activex in a dialog and i want to set printing options to 3 copies each time the user presses the "print" button (from the activex). Can i do this without adding my own print button?
|
|
|
|
|
Is Visual C++ 6 compatible with Vista?
|
|
|
|
|
Daniel Kanev wrote: Is Visual C++ 6 compatible with Vista?
Yes.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
try, you'll see...
|
|
|
|
|
Yes, even though Vista will say otherwise, VC6 works fine.
|
|
|
|
|
Hello!!
I m having a problem with waiting for a single object. My app freezes when the wait-function kicks in.
This happens inside a dlg... maybe that is the reason why it freezes??? (because I want to keep track of the update steps -> reading values, downloading CAB-file and installing)
Here s my code:
if (CreateProcess(lpAppPath, // wceload.exe
strCommandLine, // \somepath\test.CAB /delete 1
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&startupInfo,
&processInformation
)
)
{
WaitForSingleObject(processInformation.hProcess, INFINITE);//here is where the program freezes
CloseHandle(processInformation.hProcess);
CloseHandle(processInformation.hThread);
}
Please can anybody help me!!!
-erik
-- modified at 11:24 Friday 6th July, 2007
|
|
|
|
|
it waits for the program started thru CreateProcess() ends...
did you ensure that it actually terminated ?
|
|
|
|
|
What i want to do, is install the CAB-file. The cabfile gets installed, but the waitforsingleobject does not understand that the install is finished. Maybe that is because wceload has not terminated yet? if so, is there a way to end wceload on install completion?
|
|
|
|
|
erikbe wrote: WaitForSingleObject(processInformation.hProcess, INFINITE);//here is where the program freezes
Notice the second argument to WaitForSingleObject() . It sounds as though your program is doing exactly what you told it to...waiting infinitely.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes, my program does wait infinitely
I think The WaitForSingleObject()-function either waits for the dWord(in this case INFINITE), or it treminates when the process sends it an event. Not quite sure how it works. Though in just about all code examples I found online, this dWord is used.
|
|
|
|
|
I believe WaitForSingleObject() will wait until what you're waiting on is signaled or returns.
I use WaitForSingleObject() when I want to wait for either a thread or a process to terminate, before doing what I want to do, or for an event to get signaled. As such, what you are doing will probably wait for the process to terminate. If you want to wait for an event within that process, you will have to do something more complicated.
|
|
|
|
|
Problem solved:
if (CreateProcess( lpAppPath,
strCommandLine,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
NULL,
&processInformation
)
)
{
DWORD dw = MsgWaitForMultipleObjects(1, &pi.hProcess, FALSE, INFINITE, QS_POSTMESSAGE|QS_SENDMESSAGE );
}
else
{
AfxMessageBox(L"The process could not be started...");
}
MsgWaitForMultipleObjects(...)
As the documentation says:
Use caution when calling the wait functions and code that directly or indirectly creates windows. If a thread creates any windows, it must process messages. Message broadcasts are sent to all windows in the system. A thread that uses a wait function with no time-out interval may cause the system to become deadlocked. For example, the Dynamic Data Exchange (DDE) protocol and the COM function CoInitialize both indirectly create windows that can cause a deadlock. Therefore, if you have a thread that creates windows, use MsgWaitForMultipleObjects or MsgWaitForMultipleObjectsEx , rather than WaitForSingleObject .
|
|
|
|
|
On my OS regional setting is Chinese(PRC).
I hav a MFC dialog. One of the control is of ControlType "CEdit". This control is restricted to take numeric inputs (ES_NUMBER) only and that too of 2 digits (using SetLimitText(2)) only.
While running the application, when I enter a single digit it automatically gets twice. For instance if I enter 5 it gets converted to 55 and so on... So in that case I cannot enter 2 digits as max limit of the control is set to 2.
Plz help...
Thanks in advance...
Regards
SG div>
|
|
|
|
|
Do you have an EN_CHANGE handler?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to write a program and I need to see that is a certain program running or not , how can I do that ?
thanks
|
|
|
|
|
If the program is service, you can find with IsServiceRunning API.
If it is Window/Dialog Exe, you can do it with FindWindowEx API. Read how to use FindWindowEx API.
|
|
|
|