Ok now that's pretty clear..and of course this post contain highly useful
information for any installer developer and appreciate for that.


Boris Krivonog wrote:
> 
> The KillMeSoftly library contains fairly simple code. It contains an 
> entry point, named "KillMeSoftly", which, when called, reads the value 
> of MSI property "CustomActionData". The value of "CustomActionProperty" 
> contains the name of the process to kill. The 
> "CustomActionProperty"property is set within installation, as already 
> described in my previous post. "KillMeSoftly" function than calls 
> KillMeSoftlyInternal function, which does all the heavy lifting:
> * calls the CreateToolhelp32Snapshot Win32 API function to get all 
> currently running processes
> * iterate through processes and compares the name of the running process 
> to the value, contained within "CustomActionData" property; if process 
> name matches the value within "CustomActionData" property, it will call 
> the TerminateApp function.
> 
> The TerminateApp function enumerates all windows (using EnumWindows 
> Win32 API function) and finds those windows, that belong to the process 
> we are about to terminate. If a window belongs to that process, it posts 
> a WM_CLOSE message to its message que. After all process's windows have 
> received WM_CLOSE message, the TerminateApp function waits for maximal 2 
> seconds if the process was actually terminated. If not, the TerminateApp 
> function will call the TerminateProcess Win32 API function to forcibly 
> terminate the process.
> 
> I believe that this post should be posted to some Win32 Programming 
> group rather than here, but I hope anyone will find it useful :)
> 
> Cheers,
>   Boris
> 
> P.S. How to "softly" terminate an application is described
> 
> http://support.microsoft.com/kb/178893 as already pointed out within my
> previous post. The code sample also contains extensive comments for better
> understanding.
> 
> 
> 
> Anidil wrote:
>> Hi Boris..
>>
>> I am going through the KillMeSoftly code and trying to create a similar
>> wrapper custom action for another DLL to make it MSI compatible.Do you
>> have
>> any pointers or links which would help me understand how the code works?
>>
>> thanks
>> Praveen
>>
>> Boris Krivonog wrote:
>>   
>>> Attached is a simple VS 2005 project which locates a process by name and 
>>> sends it a WM_CLOSE. If that doesn't close the app, it will forcibly 
>>> kill the app; as specified by http://support.microsoft.com/kb/178893.
>>> In order to use it, build the attached project, add the build library 
>>> (KillMeSoftly.dll) to WiX project: If you would want to terminate 
>>> notepad.exe, you would add something like:
>>>
>>> <Binary Id="KillMeSoftlyDll" SourceFile="<path to KillMeSoftly.dll>" />
>>>
>>> Add a custom action:
>>>
>>> <CustomAction Id="TerminateNotepad.SetProperty" Return="check" 
>>> Property="CustomActionData" Value="Notepad.exe" />
>>> <CustomAction Id="TerminateNotepad" BinaryKey="KillMeSoftlyDll" 
>>> DllEntry="KillMeSoftly" />
>>>
>>> Add custom actions to i.e. InstallExecuteSequence:
>>>
>>> <InstallExecuteSequence>
>>>      <Custom Action="TerminateNotepad.SetProperty" 
>>> After="CostFinalize">1</Custom> <!-- Adjust your condition properly -->
>>>      <Custom Action="TerminateNotepad" 
>>> After="TerminateNotepad.SetProperty">1</Custom> <!-- Adjust your 
>>> condition properly -->
>>> </InstallExecuteSequence>
>>>
>>> KillMeSoftly.dll will read the name of the process to "softly" terminate 
>>> from CustomActionData property, therefore you must set its value prior 
>>> calling it. This way you can terminate more processes without modifying 
>>> the KillMeSoftly.dll.
>>> Of course, use the attached code on your own risk.
>>>
>>> P.S. Rename attached file to KillMeSoftly.zip.
>>>
>>>     
>>>> Anidil wrote:
>>>>       
>>>>> Thanks for the reply Boris.
>>>>> As per my understanding, there is a feature <CloseApplication/> with
>>>>> Wix
>>>>> v3.0 which sends the WM_CLOSE message to the systray.exe.But right 
>>>>> now i'm
>>>>> using WiX v2.0; any idea how to implement the same here?
>>>>>
>>>>>
>>>>> Boris Krivonog wrote:
>>>>>  
>>>>>         
>>>>>> You should terminate your system tray application "softly", meaning 
>>>>>> that you send WM_CLOSE message to systray.exe. This way, the 
>>>>>> systray.exe application is notified that it is about to shut down 
>>>>>> and has time to remove icon from tray. See link for details: 
>>>>>> http://support.microsoft.com/kb/178893. Off course, systray.exe must 
>>>>>> have a valid window which will shut down you app when this message 
>>>>>> is received.
>>>>>>
>>>>>> Hope this helps.
>>>>>>
>>>>>> Anidil wrote:
>>>>>>    
>>>>>>           
>>>>>>> Oki..I could get the systray process killed but the tray icon waits 
>>>>>>> for a
>>>>>>> mouse over to disapear, because of that the installer throws an 
>>>>>>> icon file
>>>>>>> in
>>>>>>> use dialog.Is there a way to avoid this ?
>>>>>>>
>>>>>>>
>>>>>>> Alexander Shevchuk wrote:
>>>>>>>        
>>>>>>>             
>>>>>>>> "Files In Use" dialog is shown by InstallValidate action.  
>>>>>>>> Schedule your
>>>>>>>> custom action before InstallValidate.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: [EMAIL PROTECTED]
>>>>>>>> [mailto:[EMAIL PROTECTED] On Behalf Of
>>>>>>>> Anidil
>>>>>>>> Sent: Friday, February 22, 2008 3:16 AM
>>>>>>>> To: wix-users@lists.sourceforge.net
>>>>>>>> Subject: [WiX-users] Custom action sequencing problem
>>>>>>>>
>>>>>>>>
>>>>>>>> I use the following custom action to kill systray process befre the
>>>>>>>> uninstall.
>>>>>>>> <Binary Id= ...... />
>>>>>>>> <CustomAction Id="StopUserExe" BinaryKey="taskkill" ExeCommand
>>>>>>>> ="/im
>>>>>>>> systray.exe /t /f" Impersonate="yes" Return="asyncNoWait" />
>>>>>>>>
>>>>>>>>
>>>>>>>> <InstallExecuteSequence>
>>>>>>>>       <Custom Action="StopUserExe"
>>>>>>>> Before="RemoveFiles">Installed</Custom>
>>>>>>>> </InstallExecuteSequence>
>>>>>>>>
>>>>>>>> This works fine but i get the Files in Use dialog before the CA 
>>>>>>>> actually
>>>>>>>> runs.How do i be sequencing the CA to run at the start of 
>>>>>>>> uninstall? Or
>>>>>>>> is
>>>>>>>> there any way to sequence 'Files in Use' dialog? Please help
>>>>>>>> -- 
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/Custom-action-sequencing-problem-tp15632069p15632069.html
>>>>>>>>  
>>>>>>>>
>>>>>>>> Sent from the wix-users mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>> -------------------------------------------------------------------------
>>>>>>>>  
>>>>>>>>
>>>>>>>> This SF.net email is sponsored by: Microsoft
>>>>>>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>>>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>>>>>> _______________________________________________
>>>>>>>> WiX-users mailing list
>>>>>>>> WiX-users@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>>>>>>>
>>>>>>>> -------------------------------------------------------------------------
>>>>>>>>  
>>>>>>>>
>>>>>>>> This SF.net email is sponsored by: Microsoft
>>>>>>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>>>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>>>>>> _______________________________________________
>>>>>>>> WiX-users mailing list
>>>>>>>> WiX-users@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>>>>>>>
>>>>>>>>
>>>>>>>>             
>>>>>>>>               
>>>>>>>         
>>>>>>>             
>>>>>> -------------------------------------------------------------------------
>>>>>>  
>>>>>>
>>>>>> This SF.net email is sponsored by: Microsoft
>>>>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>>>> _______________________________________________
>>>>>> WiX-users mailing list
>>>>>> WiX-users@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>>>>>
>>>>>>
>>>>>>     
>>>>>>           
>>>>>   
>>>>>         
>>>  
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> WiX-users mailing list
>>> WiX-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>>
>>>
>>>     
>>
>>   
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Custom-action-sequencing-problem-tp15632069p15827685.html
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to