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

Posted on 2005-04-26
Last Modified: 2007-12-19
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.

                "<my application name>",
                "rundll32.exe shell32.dll,Control_RunDLL \""+TARGETDIR+"\\<cpl file>.cpl\"",
                TARGETDIR+"\\<cpl file>.cpl", // Icon executable

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?

Question by:jeffreyg

    Author Comment

    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"
    end if 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.

    LVL 2

    Accepted Solution

    Closed, 125 points refunded.
    Friendly Neighbourhood Community Support Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now