I want to create a Custom Action for my installer that checks to see if Outlook is running and if it is, it prompts the user to close Outlook before continuing.
Everything works great except that when the MessageBox appears informing the user they must close Outlook, it appears behind the current MSI installation window. I'd like to have it appear in front but I cannot figure out how to do that.
I've done some research and the MSIProcessMessage function looks like it would work but it is an API function and I cannot figure out how to call it from my code.
Here is my code snippet:
Dim bCont As Boolean = True
While bCont
If Process.GetProcessesByName("OUTLOOK").Length > 0 Then
MsgBox("Please close Microsoft Outlook before you install the MissingLink Project Management add-in.", MsgBoxS开发者_C百科tyle.Information, "MissingLink Project Center")
Else
bCont = False
End If
End While
Thanks,
Kevin
Sample VBScript code on MSIProcessMessage can be found at http://msdn.microsoft.com/en-us/library/xc8bz3y5.aspx
However you really shouldn't be using VBScript for writing Custom Actions. If you haven't already, read Why VBScript (and JScript) Custom Actions Suck.
I've had some pretty horrible experiences with VBScript in the past, to the extent where they were 100% OK in our test lab but failed nearly 10% of the time for customers. It's really just not worth it.
精彩评论