How can I remove components like the Downloaded Program Files shell does?

Hello all.

I want to be able to do the exact same functionality that the Windows Explorer shell does for the Downloaded Program Files folder, when you right-click an object and select Remove.

Is there an interface I can use for this via C++? Any code sample reference would be great as well.

Thanks so much, it would really help our QA dept. if I could provide this functionality, then they could write a "clean up" script for our web application that installs a bunch of controls.

[518 byte] By [LowRider2112] at [2008-1-10]
# 1
I've been trying to do this as well with no luck. anyone out there figure this out?

thanks,
allen

all3nmfa at 2007-10-3 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Web Development...
# 2
the API you need is called RemoveControlByName and it is documented on MSDN 
all3nmfa at 2007-10-3 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Web Development...
# 3

Well that explains why I couldn't find it, as I was looking in IE interfaces and Win32 libraries for anything that looked like it might have to do with removing controls.

Looks like RemoveControlByName() is part of the OCCACHE.DLL. Here's the MSDN link I found on it: http://msdn2.microsoft.com/en-us/library/Aa768173.aspx

Thank you!

LowRider2112 at 2007-10-3 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Web Development...
# 4
hey lowrider,

are you going to make your app in c++? or .net? i can't figure this out for the life of me. still learning programming. if you can, can you post a sample when you figure this out? or send via email?

thanks!

allen

all3nmfa at 2007-10-3 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Web Development...
# 5
i gave this a try and need some help. it deletes the INF file within the downloaded program but doesn't clean up the dll's or the registry entries. am i passing the correct parameters? or something wrong with my declarations? TIA
Code Block

[DllImport("occache", EntryPoint = "RemoveControlByName")]
static extern int RemoveControlByName(string lpszFile, string lpszCLSID, string lpszTypelibid, bool bForceRemove, int dwISDistUnit);

retval = RemoveControlByName(@"C:\WINDOWS\Downloaded Program Files\MFA.dll", "{53A8AEF8-5503-4B78-A091-634BB68DEECE}", "ActiveX Control", true, 0);


all3nmfa at 2007-10-3 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Web Development...