|
by testing the returning value...
otherwise, i'm not sure to understand well your question.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
i'm afraid you confused with my question. we can get the caption of button controls in a userdefined dialogs using ON_BN_SETFOCUS handler. but i want to get the keyboard focus of buttons in a Message box(save changes YES/NO/CANCEL) Modal dialog box.
|
|
|
|
|
pradeepvarghesek wrote:
how we can get the caption of a button controls in a YESNOCANCEL messagebox dialog when the button controls get keyboard focus.
You have to Use GetFoucs(...) api to retrieve the currently active Button and then using the GetWindowText(...) reterive the caption text!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
but where i will code in the case of MessageBox dialog.
|
|
|
|
|
You would have to come up with some sort of hook/monitoring application that knew when the message box is displayed. Doing that from within the same application that calls MessageBox() might be difficult as control does not return to that application until the dialog is dismissed.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hiho@ll
you can start a new process with CreateProcess (or system,...)
i think everybody knows
my question:
(i think it will only work with creatprocess function)
how can i know if the process has really been started? (maybe the file has been deleted, or the app i want to start is single instance app and another instance is running, or the file has been damaged during download ,...)
how do i know what happend and if the process has been started or not, and if not, why not
thx@ll
|
|
|
|
|
your process should appear in the task manager...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
this means i have to check what processes are currently running
1. don't really know how i can check this, using my prog
2. what if it's a single instance app and i check the task manager
i will find the process, but it's not the process i wanted to start! it's another!
so how can i check if the process i wanted to start has been started?
thx
|
|
|
|
|
If CreateProcess returns TRUE, then the process was started.
If the program is a windowed application, you can use WaitforInputIdle to make sure it got a window up on the screen. A well-deisgned application that is only going ot allow a single instance to run would terminate before displaying any user interface. So if WaitForInputIdle times out, your other app is slow, or stopped. If you think it stopped, you can test the process handle to see if the handle is signaled - they are signaled if application is no longer running.
You can use the process identifier returned from the CreateProcess call and compare it with the results of a call to EnumProcesses to see if the process identifier is still present.
|
|
|
|
|
thx blake
seems simple
i'll check it out
|
|
|
|
|
Technicaly, the answer of toxcct is correct . But I suppose you want to check that in your code ?
I think one solution could be to use the handle of the process that is 'supplied' in the LPPROCESS_INFORMATION structure after CreateProcess is called. Then, with that handle, you can call GetExitCodeStatus and check if the lpExitCode == STILL_ACTIVE .
Hope this helps
|
|
|
|
|
thx
i'll check it
|
|
|
|
|
While you can use GetExitCodeThread() for this, a well-behaved application should not be concerned with what other threads are doing. By having threads communicate back and forth, you've effectively added an unnecessary level of complication to the application. The primary thread should create the other threads, give them a job to do, and then go off and do something else while not waiting around wondering about those threads. These other threads can then communicate back to the primary thread (e.g., PostMessage() ) as to what their status is.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-- modifed at 13:45 Thursday 25th August, 2005
|
|
|
|
|
look into WaitForInputIdle()
|
|
|
|
|
Hi all,
Is it Possible to stop the resizing of a Dialog,from inside the "OnSize" event.
Depening on the cx,CY values,I would like the dialog to be resized or not.
If this is not the right place to the control the dialog size,where should I do it & how?
>>OnSize(UINT nType, int cx, int cy)
Thanks
|
|
|
|
|
If it is MFC, do not call Base class version of OnSize()(CDialog::OnSize()) method..
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
Pazzuzu wrote:
Is it Possible to stop the resizing of a Dialog,from inside the "OnSize" event.
Nope!
you have to handle WM_GETMINMAXINFO for limiting size of the Dialog Box
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
Hi,
I need to block the key operations in the Menu. I have a menu in the button click( Using CMenu -> TrackPopupMenu ).When I click keys in the key bord, it focus to the menu item of the pressed key begins with that letter.
Eg If presss "F", It will focus to "File" menu..
How I can Block this
Thanks in advance
Shiju
shijuck
|
|
|
|
|
shijuck wrote:
Eg If presss "F", It will focus to "File" menu..
How I can Block this
This would seem counterintuitive as to how most Windows applications behave. Is that your intent?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
How to add a open door button that when I click on the button, it will send a "open door" message?
|
|
|
|
|
Tsaejen wrote:
open door button that when I click on the button, it will send a "open door" message
I am afraid, I don't understand your problem, could you repharse your problem.... thanks
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I have designed a dialog that have some button and some of the button I want it to be send a "open door" message when I click on that button. Which mean the button can send a message hen I click on the button. And the message send must same with the label of the button.
|
|
|
|
|
I assume you wan't to eject the CD/DVD. If that's the case, use this:
BOOL ejectDisk(void)
{
char Drive[MAX_PATH];
HANDLE hDrive = INVALID_HANDLE_VALUE;
DWORD dwErr;
BOOL bRetVal = TRUE;
DWORD dwDummy;
// m_drive is a char, containing the drive letter for the unit you want to eject.
// I.e. char m_drive = 'G';
sprintf(Drive,"\\\\.\\%c:", m_drive);
hDrive = CreateFile(Drive, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
dwErr = GetLastError();
if(hDrive != INVALID_HANDLE_VALUE && dwErr == NO_ERROR) {
// Open OK, issue the eject command.
bRetVal = DeviceIoControl(hDrive, IOCTL_DISK_EJECT_MEDIA, NULL,
0, NULL, 0, &dwDummy, NULL);
}
else {
// Error at opening of the drive.
bRetVal = FALSE;
}
if(hDrive != INVALID_HANDLE_VALUE) CloseHandle(hDrive);
return bRetVal;
}
You need ntddstor.h from the DDK. That's where IOCTL_DISK_EJECT_MEDIA is defined.
|
|
|
|
|
If kakan has interpreted your request correctly, there's also this:
MCI_OPEN_PARMS mciOpenParms;
MCI_SET_PARMS mciSetParms;
DWORD dwResult;
mciOpenParms.lpstrDeviceType = (LPCSTR) MCI_DEVTYPE_CD_AUDIO;
dwResult = mciSendCommand(NULL, MCI_OPEN, MCI_WAIT | MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID,
(DWORD) ((LPMCI_OPEN_PARMS) &mciOpenParms));
if (0 == dwResult)
{
dwResult = mciSendCommand(mciOpenParms.wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN,
(DWORD) ((LPMCI_SET_PARMS) &mciSetParms));
}
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-- modifed at 10:08 Thursday 25th August, 2005
|
|
|
|