using rundll32 in an installer .... Installshield works ... Visual Studio .NET msi does not

I am trying to create a shortcut in my app folder to a CPL (control panel object.)

I have used Installshield and used to following to add a shortcut to allow me to run the shortcut to the CPL.

AddFolderIcon(SHELL_OBJECT_FOLDER,
                "<my application name>",
                "rundll32.exe shell32.dll,Control_RunDLL \""+TARGETDIR+"\\<cpl file>.cpl\"",
                TARGETDIR,
                TARGETDIR+"\\<cpl file>.cpl", // Icon executable
                0,
                "",
                REPLACE);

This works ok and allows me to add a shortcut in XP / 2K.

Now I am migrating to .NET and using the "Setup Wizard" in .NET 2003.

I want to do the same as above and I have tried creating a shortcut to my cpl (with the arguements "shell32.dll,Control_RunDLL [TARGETDIR]UDMCPL.cpl" , but it asks for the rundll32.exe file. Now obviously if I try and run the cpl shortcut on any OS other than the one I am developing on then is get an error

"The procedure entry point ActivateActCtx could not be located in the dynamic link library KERNEL32.dll".

Can't switch between rundll32. OS specific.

So how do I create a shortcut to the CPL in the same way as Installshield so that it will work on 2K as well as XP?

I don't want to copy the rundll32.exe, but create a shortcut on the desktop. Any way to script it?

G.
jeffreygAsked:
Who is Participating?
 
LunchyCommented:
Closed, 125 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin
0
 
jeffreygAuthor Commented:
I managed to get it working with a hack.

Created a batch file (runCPL.bat) that ran my cpl, but this also popped up a dos box ..... not very nice.

rundll32.exe shell32.dll,Control_RunDLL ".\<cpl file>.cpl"

So I used a vbs to hide the dos box.

const blindscript = "runCPL.bat"
dim scriptobject, alienobject
set alienobject = CreateObject("Scripting.FileSystemObject")
set scriptobject = WScript.CreateObject("Wscript.Shell")
if not alienobject.FileExists(blindscript) then
 MsgBox "No script exists in that location!", vbOkOnly + vbCritical, "Error"
 WScript.Quit
end if
scriptobject.run blindscript, 0

I call the vbs and it works. Not the neatest though. I would rather not have these two files floating around but if no-one comes up with any ideas then this will have to do.

G.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.