一段實例代碼
以下是引用片段
private void btnCreate_Click(object sender
int hWnd = FindWindow(null
//check if PowerReuse is launched or not
//if yes
//or
if (hWnd >
MessageBox
//SendMessage to PowerReuse
return;
}
try
Process Main_P = new Process();
//this path should be retrieved from Windows Registry
//the loaction is written by Installter during process of installation
Main_P
//This URL is passed to PowerReuse to open
Main_P
Main_P
Main_P
//
//we have to wait for a while until UI has been initialized
//
Main_P
//although UI has been initialzied
//it does not mean main form of application has been completed
//we may wait for another
for (int i =
hWnd = FindWindow(null
//hWnd = Main_P
if (hWnd >
Thread
}
//Here
if (hWnd ==
//Handle exception
MessageBox
}
else
//other handling
//
MessageBox
}
}
catch (Exception ex)
MessageBox
}
}
From:http://tw.wingwit.com/Article/program/net/201311/12709.html