how to verify my program was uninstalled successfully
this is my first post to this community, please let me know if more information is needed.
i am trying to determine whether a program has been uninstalled successfully from Windows 8.1. below is the method i have attempted:
// the alias here is the Add/Remove Program in Windows
var my_program = Aliases.explorer.wndCabinetWClass.ShellTabWindowClass.
DUIViewWndClassName.DirectUIHWND.CtrlNotifySink.ShellView.FolderView.wItem("XT 300", 0);
Log.Message( "my program name is " + my_program); // shows "XT 300", my application
// during my test, i would uninstall the program at this point. but to test my logic, i keep the XT 300
// program installed. i would like to see the error below happen but it never does
if( Aliases.explorer.wndCabinetWClass.ShellTabWindowClass.DUIViewWndClassName.
DirectUIHWND.CtrlNotifySink.ShellView.FindChild( "wItem(\"XT 300\", 0)", "XT 300" ).Exists ) {
Log.Error( "XT 300 application is still installed after running Uninstall" ); // why am i not seeing this?
} else {
// continue
}
i have tried finding information on the web, thinking that this must be a common thing to do, but i haven't found anything. if there is a better way to test that my program is uninstalled correctly, please let me know. but i would still like to know why i'm having such a difficult time with the wItem property. i believe it has to do with the fact that the property takes parameters. i have tested my code with other properties (that do not take parameters) of the Add/Remove Program and they work with no issue (for instance, wColumnCount worked with no problem). so there is something i am missing in trying to pass a property that has parameters to the FindChild method (i've tried other Findxxx methods and they don't work either).
any help will be greatly appreciated!
so, i figured out a different way to test this. instead of looking for a child object, i decided to look directly at the objects properties. interestingly, saw this in the Remarks section of WaitProperty method:
"The
WaitProperty
method does not support indexed properties (that is, properties that require parameters). "so there must be something unusual with having indexed properties. so right after that line, they give an example of a while loop to use instead of the WaitProperty. so i did that (with a for loop) and got what i needed. here is the new code:
var XT300_uninstalled = false;
var folderViewObj = Aliases.explorer.wndCabinetWClass.ShellTabWindowClass.DUIViewWndClassName.DirectUIHWND.CtrlNotifySink.ShellView.FolderView;
// waitproperty method doesn't support indexed properties like the wItem on the folderview object. so need
// to check the property using for loop. wait up to 5 seconds for XT 300 application to be uninstalled
for( var i=0; i<5; i++ ) {
if( aqString.Compare( folderViewObj.wItem(2, 0), "XT 300", true ) != 0 ) {
XT300_uninstalled = true;
break;
} else {
Delay( 1000 );
folderViewObj.Refresh();
}}