I want to start VB project in Visual Studio 2010 when I am debugging the .ocx - visual-studio-2010

Well, I am writing an ActiveX component in Visual Studio 2010 and using MFC wizard. When I debug the solution I want to start the actual program ( it is VS 2010) that is going to use that .ocx. In VC++ 6.0, I am able to do that by following steps:
1) Click Project in menubar
2) Select settings in the drop menu
3) Select the debug tab: With Category as General I put the path of VB.exe in box for executable during debug session and in program arguments I would write the path of VB project that uses the said .ocx.
I would like to do same thing, for MFC wizard in Visual Studio 2010. How to do it?

If you right-click on the ActiveX project, select 'Properties', then under 'Configuration properties|Debugging' you can set the name of the executable to start ('Command') and its command-line arguments ('Command Arguments').
You should select the EXE of you VB host program (I am not 100% sure what is the program you need to start)
An alternative is to start the program that uses the OCX and then attach the debugger to it: select 'Debug|Attach to process...' in the main menu, and then select the process in the dialog.

Related

Make Visual Studio 2019 Always Run as Administrator from Start Bar Recent Solutions List

I recently upgraded to Windows 10 and Visual Studio 2019.
Prior to the upgrade, Visual Studio 2017 would always run as Administrator. I did not think much of this, but now that it is gone it is causing me problems.
The primary one is that it will not load my projects that use my local instance of IIS.
I usually launch Visual Studio from my start bar. Right now this goes like this:
Right click on the icon on the start bar and select my solution.
It loads and then I realize that the main project did not load.
Close visual studio, open as admin
Pick my solution and then it loads.
I would really like to only have to do #1 above. Is there someway I can edit the shortcut on the start bar to have it always launch as Administrator?
Turns out that Visual Studio uses different permissions when you click on the list of shortcut options it offers in the start menu. (IE to load a recent solution directly.)
Selecting the Properties->Advanced->"Run as Administrator" did not cause these to run as administrator.
But this did it:
Find devenv.exe (Visual Studio's executable)
Right Click on it and select "Troubleshoot Compatibility".
On the Program Compatibility Troubleshooter window, click on Troubleshoot Program
Check that the program requires additional permissions and click Next
On the next window, click on Test the program… and VS will open as administrator
Click next and then click on Yes, save these settings for this program
Now Visual Studio will ALWAYS run as administrator.
(Taken from: https://ppolyzos.com/2017/08/08/always-run-visual-studio-as-administrator/)

Visual Studio shortcut for opening command prompt in current project path

On a keyboard shortcut, I want to be able to start the Windows command prompt with the working directory set to the current project directory selected in solution explorer (or text editor). Unfortunately, I am unable to find an appropriate keyboard shortcut in the Visual Studio settings.
Is such a thing possible inside Visual Studio and Visual Studio Code? And if so, how can I set it up?
Sure this is possible!
Configure an external tool
You have to set up a custom external tool. For that, go to Tools > External Tools... and click Add and configure the tool like this:
Setup the keyboard shortcut
Next, you want to bind a shortcut to that external tool. For that go to Tools > Options > Environment > Keyboard and bind your desired shortcut to Tools.ExternalCommand1. Make sure you have moved the external tool to the first position in the window shown above.
Additional Information (For Visual Studio Code)
To Open New Command Prompt use Ctrl+Shift+C to perform same action
named workbench.action.terminal.openNativeConsole

Visual Studio 2012 MSVSMON.EXE does not work

I'm really tired of this error.
Most of the time, when I want to debug the program , I'm faced with this message.
Microsoft to offer solutions, but it is quite confusing:
1.
Make sure the Visual Studio Remote Debugging Monitor is installed and running on the remote machine.
2.
Make sure the Remote Server Name is correct in the Name box in the Project Properties dialog box.
3.
Verify that the remote machine is accessible on the network.
please someone help and guide me because all of my projects have been suspended and i need visual studio debugging.
meanwhile, when i dc from internet, visual studio will work.
Windows 7 x64, VS 2012, VB.NET
I fixed it like this:-
Create a shortcut on your desktop to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe".
Right-click shortcut and select "Properties" from the dropdown menu.
Select the "Compatibity" tab
Tick "Run this program as administrator"
Click OK
Create a shortcut on your desktop to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe".
Right-click shortcut and select "Properties" from the dropdown menu.
Select the "Compatibity" tab
Tick "Run this program as administrator"
Click OK
To start VS2012:-
1) Double-click the msvsmon shortcut icon (that you created above, to launch msvsmon)
2) Double-click the "Visual Studio 2012 Professional" shortcut icon (that you created above, to launch VS2012)
3) In VS2012, ensure standard toolbar is visible.
4) In VS2012, ensure "Solution Platforms" dropdown (on standard toolbar) is visible and set to "x86".
and ... wowee ... debug works !
I had the same problem. I fixed changing in properties/compile/target platform to x86 instead of Any CPU. It was the problem in my case. Hope it helps.
I got this error when starting VS2012 as a normal user. When starting as an administrator it opened up a UserControl TestContainer window instead.
What have happend was that the startup project was changed. I changed back to my ordinary startup project by right-click on it and choose "Set as StartUp Project".
I have started vs 2012 as administrator and it is fixed

Visual Studio 2010 - Debug DLL - Debug Command using rundll32 doesn't work

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):
In Solution Explorer, I select the project that creates the DLL.
From the View menu, I choose Property Pages.
In the Property Pages dialog box, I open the Configuration Properties folder and select the Debugging category.
In the Command box, I type: "C:\Windows\System32\rundll32.exe"
In the Command Arguments box I type (main is the function to be executed): output.dll, main
In the Working Directory I type: $(SolutionDir)$(Configuration)
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?
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.

Visual Studio - I want "Go To Definition" to open Object Browser, not "metadata"

In Visual Studio version 2002 and 2003 "Go To Definition" would find the selected type or member in the Object Browser. In 2005 onwards it opens a source window "generated from metadata" instead. How do I configure these newer versions to go to Object Browser? (In other words, I have the opposite problem to this one.)
Installing ReSharper makes this change, so I know it must be possible, but how do I do it without ReSharper?
As workaround you can create the following macro:
Sub GoToDefinitionUsingObjectBrowser()
DTE.ExecuteCommand("Edit.SelectCurrentWord")
DTE.ExecuteCommand("View.ObjectBrowser")
DTE.ExecuteCommand("View.ObjectBrowserSearch", DTE.ActiveDocument.Selection.Text)
End Sub
Then go to Tools/Options/Keyboard and assign hot key for this macro.
Tested in Visual Studio 2010.
I believe what re-sharper is doing is doing some hooks on that click event with the Visual Studio SDK I do not think there is any simple menu or location that can change that setting.
Instructions (pulled from CODE Magazine) edited down a bit to the part that pertainst to making the right click menus.
Creating a VSPackage
...The VS SDK installs a few more project
templates in Visual Studio, one of
them being the Visual Studio
Integration Package (Figure 1),
located under Other Project Types >
Extensibility on the New Project
dialog box.
After this standard dialog box, the
Visual Studio Integration Package
Wizard guides you through creating the
new package project:
Select a programming language. The wizard currently supports Visual
C++ and Visual C#. You can create or
pick a key file to sign the new
package.
Supply basic VSPackage information. The wizard prompts you
for details such as the company name,
VSPackage name, version, icon,
detailed information, and minimum
Visual Studio edition (such as
Professional or Enterprise) that the
package is designed to at this step.
This information goes into the Visual
Studio splash screen and About dialog
box and is also used to request a PLK
for the package (covered later).
Select VSPackage options. A package may add three types of
functionality: Menu Command, Tool
Window, and Custom Editor.
A menu command is a command added either to the menu
at the top of Visual Studio or
to a context menu (right-click).
When the wizard finishes its job, the
VS SDK adds core elements to the
solution to support the new package.
For instance, if you selected Tool
Window as part of the functionality
for the package, the project contains
a user control where you should place
the visual controls for the window.
The project also contains files for
.NET code to handle the functionality
that you will add to the package.
A CtcComponents folder contains
pseudo-C++ files (ctc files) where you
define things like menu, groups,
buttons, etc. Fortunately, Microsoft
is phasing out CTC files and replacing
them with a friendlier, XML-based VSCT
file format (which will ship in the
SDK for Visual Studio 2008).
The wizard creates a few other files
with .NET code required for the
plumbing of the package within Visual
Studio. Some of these files contain
classes that map the C++ constants to
.NET constants and other files contain
configuration information for the
package when it’s installed.
I know it has been a long time, but it appears, at least in newer versions of Visual Studio for the VB (Basic) language, to be an setting in the options.
Text Editor > Basic > Advanced
Under "Go to Definition".
I don't know why they don't have that for other languages...
Place the mouse cursor on the object you want to access on the object browser. Then, use the keyboard shortcut ctrl + alt + j, which will take you directly to the Object Browser window.

Resources