YES! I figured it out!
I appreciate everyone's help but unfortunately nothing that anyone suggested was working. But I stumbled across a post at
www.experts-exchange.com for someone requesting their C++ project automatically hit an 'OK' button.
They were using WM_COMMAND to post a message using a call to the system library user32.dll, sending it the command of the button ID. They linked to a little app called MessageSender that allows you to test things like sending and posting messages to dialogs using different commands.
http://www.google.com/search?hl=en&ie=UTF-8&q=MessageSender
Anyway... for those interested, here is the complete code I use to close both windows automatically by virtually pressing the dialog buttons:
Function closeWFP
;Find and close first dialog
FindWindow $0 "" "Windows File Protection"
System::Call 'user32::PostMessageA(i,i,i,i) i($0,${WM_COMMAND},2,0)'
;Find and close second dialog
FindWindow $1 "" "Windows File Protection"
System::Call 'user32::PostMessageA(i,i,i,i) i($1,${WM_COMMAND},6,0)'
FunctionEnd
So to close just one dialog you just need two lines of code:
1)FindWindow $0 "" "Windows File Protection"
2)System::Call 'user32::PostMessageA(i,i,i,i) i($0,${WM_COMMAND},2,0)'
The first line finds the HWND of the window with the title "Windows File Protection" and stores it as $0
The second line uses the system plugin and uses the call function. The only parameters you need to worry about are the ones in the last parenthesis ($0,${WM_COMMAND},2,0)
- $0 = The variable that we stored the HWND from FindWindow
- ${WM_COMMAND} = leave as is
- 2 = The ID of the button you want to press. In this case the "Cancel" ID is 2
- 0 = leave as is