3
votes

I have a problem debugging a C++ DLL project in Visual Studio 2010. While debuging I want the DLL to be loaded by rundll32.exe automatically. To do so I follow these steps (like here http://msdn.microsoft.com/en-us/library/c91k1xcf.aspx):

  1. In Solution Explorer, I select the project that creates the DLL.

  2. From the View menu, I choose Property Pages.

  3. In the Property Pages dialog box, I open the Configuration Properties folder and select the Debugging category.

  4. In the Command box, I type: "C:\Windows\System32\rundll32.exe"

  5. In the Command Arguments box I type (main is the function to be executed): output.dll, main

  6. In the Working Directory I type: $(SolutionDir)$(Configuration)

  7. Attach -> yes

After following these steps, I try to debug the DLL, but I get this error:

"Unable to attach. Process "C:/Windows/System32\rundll32.exe" is not running on "MY-PC", Refresh the process list before attempting another attach."

Anyone know how to debug a DLL, without manually starting rundll32.exe from command prompt and manually attaching to this process?

1

1 Answers

4
votes

You should set:

"Attach -> no"

otherwise the VS is not trying to start new rundll32.exe process. Setting Attach -> yes tells VS to attach to existing process.