Customise Default WinMain.cpp on Project Creation - visual-studio-2010

When I create a new Win32 Project in Microsoft Visual C++ 2010 Express and it creates the default WinMain.cpp file with the default WinMain function...
Is it possible to load a different WinMain.cpp file, ie, my own WinMain.cpp file/template?
Hope that makes sense. To be more specific, I want to have different default code in WinMain.cpp whenever I create a new Win32 Project.

I have done it years ago with VC6 - it is known as Custom Project Wizard.
In New Project -> General select Custom Wizard to start off.
Using custom wizard, you can create a new wizard type to create project. You'd setup the wizard as per your needs, code the logic and things like that. Once done, and registered your wizard will come as another type.
Check this: http://msdn.microsoft.com/en-us/library/vstudio/bhceedxx.aspx

Related

Add a new folder to a solution while debugging on Visual Studio 2017

A dumb question.
Is it possible to configure VS2017 to allow adding new folders while running a solution on debug mode? I'm trying to organize multiple styles and scripts defined inside the views.
Thank you very much.
Is it possible to configure VS2017 to allow adding new folders while
running a solution on debug mode? I'm trying to organize multiple
styles and scripts defined inside the views.
For a framework project, there is no such option to realize it to add new file into a project under debugging. And when the project is under debug, the files under the solution explorer and we cannot modify such as add a new folder in Solution Explorer.And you cannot add new item into it.
For a core project, you can add a folder in this new type of the project. After that, you can add existing new item and import new files into it. As far as l know, it can work for showing the style of the page and you can modify it and then refresh the page,you will see the effect.
Note: if your project is based on Net Core 3.0 and later, you can refer to this link to install a new nuget package called Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.
Hope it could help you.

Split window upon new C++ class creation in QtCreator

Is it possible to customize QtCreator to make it automatically split editor with header and code files upon creating new C++ class in QtCreator?
It's not exactly what you asked for but did you know about the OpenHeaderSourceInNextSplit command (Ctrl+E,F4)? As the wizard opens up the cpp file automatically it might be good enough to hit that after creation.
Alternatively, You might be able to achieve it by creating a custom wizard?

Visual Studio 2015 - New Project Windows Obscuring Details

Hi I have Visual Studio 2015 - And when I try to create a new Windows Form Application - both the Location, SolutionName, CreateDirectoryforSolution box and Add to Source Control are missing - Yet if I select a "Telerik" type or other types it shows - I've checked on my colleagues machine and his works as predicted. ie Shows the other project elements.
Two images below - Any clues? Resizing the frame does not help.
Thanks
and with the correct details:-
Visual Studio allows you to create new projects without having to save them (temporary projects).
If you create a new Forms application, it will generate all the files etc. If you wish to save, click the Save menu option and the following window is shown:
You can control this behaviour via the options:
On the Tools menu, click Options.
Expand the Projects and Solutions node, and select the General node.
Make sure Save new projects when created is cleared, if you want to allow temporary projects; otherwise, make sure it's checked to be prompted for location and solution name when creating a new project.
Click OK.
With the Save new projects option is checked, you'll be prompted for a Name, Location and Solution Name when selecting the project type, as per the screenshot below.
This MSDN article: Temporary Projects provides a fuller explanation on the subject.

ActiveX Control Versioning VB 6.0

I have OCX created using VB 6.0. And this OCX has custom activex controls in it. The custom controls are used in my application. I have installed my application in a system in which I have registered mu first application.
My second application needs the custom controls which are available in my OCX , few enhancements in previous controls and new custom controls.
For this purpose I have created new OCX with previous controls and new control added. In this case in future if I need different controls I need to create more OCX files. This is difficult to maintain different OCX.
If I add new functionalities in the existing OCX and register in the system, already existing application couldn't able to find the previous version of activex control.
How to add new features in already existing ocx with out affecting the applications already using these controls?
Thanks
Publishing a component with "Binary Compatibility" allows this (with several caveats involving what you can safely change) by examining the existing version of the activex control and then re-using IDs from the type library in the new version at compile time.
See here for an explanation: http://wynport.wynsys.net/Visual_Basic_Binary_Compatibility.htm which includes a list of what incremental changes you can make.
When you compile your project, Visual Basic only creates new Class and Interface IDs when necessary. It preserves the class and interface IDs from the previous version(s) so that programs compiled using an earlier version will continue to work. If you are making a change that will result in an incompatible version, Visual Basic will warn you. If you want to maintain compatibility with older, released versions of an ActiveX component.
Ref: http://support.microsoft.com/kb/161137
To make your control binary compatible,
Open the properties dialog of project
Select Component tab
Select Binary Compatibility radio button
Browse your existing control which you have compiled
Click OK button and recompile your project

How can an Empty Visual C++ project be created programmatically?

I wanted to know how to use the template for an Empty Visual C++ project to programmatically create a new solution with this empty project. The code (C#) I have right now is:
string VSProgID = "VisualStudio.Solution.10.0";
Type solnObjType = System.Type.GetTypeFromProgID(VSProgID, true);
Solution4 soln = (Solution4) System.Activator.CreateInstance(solnObjType, true);
soln.Create(#"C:\NewSoln", "New");
soln.SaveAs(#"C:\NewSoln\New.sln");
string emptyVCProjPath = soln.GetProjectTemplate("General/Empty Project", "VC++"); // Here's where I need help
soln.AddFromTemplate(emptyVCProjPath, #"C:\NewSoln\NewProj", "New.vcxproj", false);
I wasn't able to find the VC++ Empty Project template in the location where all the other templates (C#/F#/VB) are located. The VC++ Empty Project Template does appear in the installed templates when I create a new project manually through the IDE. What should the parameters be for soln.GetProjectTemplate()? It doesn't seem to recognize "VC++" as a language. I know that "CSharp" and "VisualBasic" are valid options. But I wanted a VC++ Empty Project. Any help will be greatly appreciated.
I am posting this answer in the hope that it may help someone facing the same problem that I was facing.
Apparently the Visual Studio Extensibility framework API doesn't provide an option to create an Empty Visual C++ project programmatically. I had to generate the solution and project files to achieve this. Specifically, the [solution_name].sln, [project_name].vcxproj, and [project_name].vcxproj.filters files had to be generated. A GUID had to be generated for the new project and inserted at the appropriate places. If one needs to add files to this empty project, ClInclude tags need to be generated for header files, and ClCompile tags for source files. These tags are added to the [project_name].vcxproj, and [project_name].vcxproj.filters files. Refer to an existing Visual C++ project's files to help you figure out what goes where. It is pretty straightforward.
UPDATE
For some reason, the VC++ solution generated this way does not open directly (by double-clicking the solution file in Windows Explorer). I have to launch Visual Studio and open the solution from there.

Resources