Chinaunix首页 | 论坛 | 博客
  • 博客访问: 89597
  • 博文数量: 20
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 200
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 10:49
文章分类

全部博文(20)

文章存档

2009年(2)

2008年(18)

我的朋友
最近访客

分类: WINDOWS

2008-12-11 15:22:11

Hello there! Since it's the first time I post in this blog, allow me to introduce myself. My name is Jin Zhang and I've been the tester for Application Management for the past year. If you are wondering what Application Management is, it consists of wceload (and related binaries), cabwiz and cabsigntool.

This might be an old topic but doing a quick search online I noticed this question is still being asked. There are several ways to uninstall your application programmatically but perhaps the simplest way to do it is using the (CSP). Being able to programmatically do things is always a good thing, but for uninstalling programmatically, perhaps the most common use case would be the ability to remove a program without any user-intervention.

Essentially, you need to "push" an XML file that the Uninstall CSP will process. Provisioning an XML file can be achieved in different ways but for this post I'll go over the API .

In native code all you need to do is include "cfgmgrapi.h" and call the function:
DMProcessConfigXML(LPCWSTR pszWXMLin, DWORD dwFlags, LPWSTR* ppszwXMLout)

In managed code, a managed wrapper is provided by the object found in the namespace Microsoft.WindowsMobile.Configuration:
public static XmlDocument ProcessConfiguration ( XmlDocument configDoc, bool metadata)

As for the actual XML string, take the following but replace "Your App" with the name of your application:








The code above will trigger the uninstall of your application without any prompting. Keep in mind that if your application contains a and your Uninstall_Init function displays UI, this will might defeat the purpose of a silent uninstall. Of course, you can design your setup.dll in such a way that will not prompt during a programmatically initiated uninstall.

I hope the above will help some of you. If you are burning to know about a specific topic regarding Application Management, leave your comments below and if there is enough interest, I'll consider it as a future topic.

阅读(703) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~