Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to use Msi API to uninstall an application?


3 replies to this topic

cuiqimeng

cuiqimeng
  • Full Members
  • 4 posts

Posted 31 October 2009 - 13:57

I only have its "Product Code", how can i uninstall the application with MSI API?

I know that there's a method,

C++
UINT MsiInstallProduct(
__in LPCTSTR szPackagePath,
__in LPCTSTR szCommandLine
);

However, it needs a package path, then how can i get it by product code?

Thanks!

Edited by cuiqimeng, 31 October 2009 - 15:05.


VBScab

VBScab
  • Full Members
  • 436 posts

Posted 02 November 2009 - 09:20

It's a lot easier to use the WindowsInstaller.Installer object but the APi is documented thoroughly (with examples) on MSDN as well as in the SDK.
- Don't know why 'x' happened? Want to know why 'y' happened? ProcMon will tell you.
- Try using http://www.google.com before posting.
- I answer questions only via forums. Please appreciate the time I give here and don't send me personal emails.

cuiqimeng

cuiqimeng
  • Full Members
  • 4 posts

Posted 02 November 2009 - 14:33

QUOTE (VBScab @ 2009-11-02 09:20)
It's a lot easier to use the WindowsInstaller.Installer object but the APi is documented thoroughly (with examples) on MSDN as well as in the SDK.

Thanks.

I'm on the C++ land, and API might be more suitable for me.

I find that, by MsiGetProductInfo() with paramter "INSTALLPROPERTY_LOCALPACKAGE", I can get the cached msi file in "C:\Windows\Installer\...".

If I delete this cached file, and try to uninstall the program in "Add/Remove Program", it will look for the original msi file(which I used to install the program).

How can I get the original msi file path with API?

VBScab

VBScab
  • Full Members
  • 436 posts

Posted 02 November 2009 - 14:43

Check out the WI SourceList property
- Don't know why 'x' happened? Want to know why 'y' happened? ProcMon will tell you.
- Try using http://www.google.com before posting.
- I answer questions only via forums. Please appreciate the time I give here and don't send me personal emails.