Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I want to click yes on a dialog that has the options yes, no, and help.
I think that the DIALOG_CLASS_NAME="ComboLBox" and EXE_FILE_NAME="OUTLOOK.EXE".

HWND GetOutlookAsDialog(void) {
    datastruct ds = {0};
    EnumWindows(GetOutlookAsDialogProc, (LPARAM)&ds);
    Save_ProcessID = ds.ProcessID;
    Save_HWND=ds.hWnd;
    return ds.hWnd;
}

//I need to modify this block below
void _stdcall Handle_Outlook_Prompts() {
    if (HWND hWnd = GetOutlookAsDialog()) {
        HWND Button_SaveAs = ::GetDlgItem(hWnd, IDYES);
        {
            HANDLE ProcessHandle_SaveAs = OpenProcess(SYNCHRONIZE, FALSE, Save_ProcessID);
            ::PostMessage(hWnd, WM_COMMAND, MAKEWPARAM(IDYES, BN_CLICKED), (LPARAM)Button_SaveAs);
            WaitForSingleObject(ProcessHandle_SaveAs, INFINITE);
            CloseHandle(ProcessHandle_SaveAs);
        }
    }
}
Posted
Comments
Albert Holguin 1-Apr-11 22:16pm    
is there a question here? please clarify...
T2102 1-Apr-11 22:19pm    
I am looking for help on Windows automation. How can I modify the code above to click the yes button? I think I need to modify the ::PostMessage code and Button_SaveAs code.

1 solution

I think AutoIt is what you want! AutoIt script can be compiled in EXE form, just try!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900