Visual Studio Resources Editor undoubtedly contains valuable set of tools that help when creating UI for MFC applications, especially various dialogue boxes and graphic elements.
I have reasons to stay with non-managed C++, which mean staying without the usage of Windows Forms. I therefore got an idea, if it is possible to use resources created with VS2012 Resources Editor in non-managed C++ while creating non-MFC applications.
How to refer to the GUI elements from within my non-managed C++ code?
can I completely abandon MFC structure and use my own C++ design?
Would you know about any good tutorial that covers this? I searched on the net and tried YouTube too, but I did not find suitable example covering this question.
I use:
Visual Studio 2012 Ultimate
Windows 7 x64
non-managed C++
Thank you.
MFC is essentially a wrapper around WinAPI and as such resource files can be used completely without MFC. At design/compile time:
Drag and drop your resources to create the .rc file
Include the generated header file - #include "resource.h"
At runtime:
In your code, make sure to call InitCommonControlsEx
Load the resources with WinAPI calls such as DialogBox, CreateDialog, etc.
Related
After being away for a decade, I am using Jeff Prosie's Programing MFC to rebuild my understanding of MFC using visual studio 2012. His simple Hello World program generates a LNK 1561: entry point must be defined error. Since I have a global CWinApp declared, I do not understand this. All of the suggestions I saw cited a VS 2010 menu item that does not appear in VS 2012.Can anyone get me started (I don't want to use the MFC wizard yet).
If you "hand-crafted" a project, chances are that you haven't set all the settings correctly for an MFC program, including linking of the MFC libraries and setting the correct entry point.
I know you say that you don't want to use the MFC wizard, although I'm not sure why you don't... but the answer to that is Use the MFC wizard.
I've written a series of ActiveX controls in Delphi to be used in other development environments (like Visual Studio or dBASE for Windows, as two examples)
I used the ActiveX wizards provided as part of the RAD Studio IDE to generate the ActiveX "bindings" (for want of a better word) for my VCL-based controls, however it appears not to produce the source necessary to make them appear on IDE component pallets.
Ordinarily on those IDEs (Visual Studio and dBASE Plus), I can simply import an ActiveX control and it will show up on their toolbox (their version of a component pallet) complete with their defined icon.
Well, my own ActiveX controls produced in Delphi do not (they import just fine, but don't show up on the pallet/toolbox), and I've been scouring Google trying to find a solution for the last two weeks.
Having failed miserably, I've decided to ask here:
How do I make my ActiveX controls show up on the Toolbox in Visual Studio (and others)?
Thanks for any advice/suggestions.
EDIT: Some extra info...
I've been trying to do this with both XE2 and XE3, and it has failed every time... however, when I do the same thing (using the Wizards) with Delphi 2007, the component's icon does show up in the Pallet/Toolbox of other IDEs as desired.
This means the issue was introduced sometime after Delphi 2007, and is likely the result of some RTL/VCL modification.
My research has concluded that Unicode versions of Delphi (2009 to XE3) do not generate the correct markup for ActiveX Controls using the provided wizards.
Further-more, changes to the RTL and VCL since Delphi 2007 mean that, even if you produce the necessary source markup manually, your controls will not behave properly when embedded in non-Delphi applications (such as Visual Studio and dBASE Plus). Much of this relates to the VCL's presumption of a VCL-compliant Parent property value, where the update of properties such as ParentFont will result in an Access Violation error.
The solution in my case has been to produce the exported ActiveX Controls in Delphi 2007 (with it being the latest version to "play fair" with other ActiveX Control consumers)
Hopefully this information will save you the long and annoying fact-finding process I had to go through in order to come to this conclusion.
I would like to use VC2010 to handle a BCB 2006 project I have. I do not want to convert the code to VC since much UI will need to be ported. I just want to be able to view build & debug from VS IDE.
Viewing: I assume once I create VS projects for the native BCB code viewing will be possible, although the UI editor will not.
Building: I found the "C++ Native Multi-Targeting" option of VS, although I'm not sure on what to set the different options there to (Daffodil is mentioned as helpful although I'm not sure what the added value is over existing functionality).
Debugging: not sure how to do this at all from within VS. There are some stand alone console tools that convert debug info files e.g. tds2pdb (wheres the documentation link?).
If anyone has experience with such a task I would thank you for any advice.
No. The C++ Builder IDE is a stand-alone, separate Win32 executable that has nothing to do with VC or Visual Studio, and can't be embedded in it in any way. You'll have to use C++ Builder itself to view, build, and debug it's apps; there's no way to do so as part of Visual Studio.
Even simply using the C++ Builder code will most likely not be possible if there is any UI involved at all. C++ Builder's GUI components are based on the Visual Component Library (VCL) that it shares with Delphi, and therefore it uses a Delphi Object Pascal compiler to build those parts of the application. There are also data types and set operations that VC will not understand or support, and some special #pragmas and #hppemit statements the VC compiler wouldn't be able to use.
Visual studio 2012, being run under desktop mode under windows 8. Doesn't share the look of other windows 8 desktop applications.
How was this GUI achieved?
Did Microsoft scrap MFC/Winapi altogether (since its so different) and use Direct2d to create the custom gui? Or, have they just made calls to Winapi to customize it they way it looks?
Is there any shortcut for us developers to implement the vs2012 theme in our applications? Using the MFC Application template wizard we can chose from many themes but no vs2012 alike is available.
Indeed, Visual Studio 2010/2012 leverages WPF.
LEVERAGING WPF
WPF utilizes DirectX. WPF attempts to provide a consistent programming model for building applications and provides a separation between the user interface and the business logic. WPF leverages XAML, which is a declarative markup language. XAML stands for eXtensible Application Markup Language, which is based on XML. XAML is designed as a more efficient method of developing application user interfaces
ITS ABOUT MULTIPLE DOCUMENT WINDOWS AND FLOATING TOOL WINDOWS
Visual Studio was written to support multiple document windows and floating tool windows.
GREAT LIBRARIES ARE AVAILABLE
Codeplex provides a library to model the multiple document windows.
http://wpfmdi.codeplex.com/
There is also a docking library you can leverage:
http://avalondock.codeplex.com/
MEF IS USED HEAVILY
The internals have been redesigned using Managed Extensibility Framework (MEF).
MEF allows application developers to discover and use extensions without messing around with configuration files.
MEF allows you to easily encapsulate code and avoid fragile hard dependencies.
This allows developers to create add-ins to modify the behavior of the IDE.
DESIGN GOALS
In Visual Studio 2012, a one change is that the interface uses of all-caps menu bar.
Some design goals include reduced clutter and visual complexity by removing excessive lines and gradients in the UX.
The UI has been modernized by removing outdated 3D bevels.
You can take Spy++ which comes with Visual Studio and inspect the windows/class names of the application. If you do it with VS 2008, it's obvious that it's MFC. If you do it with VS 2010 and later, you will see that it's all WPF stuff--no MFC involved.
I tried to search but if this is a duplicate it is hidden by some noise. Alternate title to the question:
What skills to look for when needing integration with the Visual Studio IDE?
Visual Studio 2008 is written in both native and managed code, though the bulk is written in C++. There are several pieces of Visual Studio that have always been written in managed code (e.g. the property browser, the WinForms Designer). And of course, Visual Studio 2008 is stitched together with COM.
In Visual Studio 2010, there is an effort to move more of the IDE to managed code. The text editor and the shell (i.e., menus, toolbars, document and tool window frames, etc.) are written in C#. In addition, pieces of the C# and VB IDEs are being written in C# and VB respectively. The new language, F#, is written completely in managed code -- the compiler, the language service, the project system, etc. -- are all written in F#.
You can use C#, VB or C++ to integrate with Visual Studio 2008. However, given that Visual Studio is built on COM, a good understanding of COM/ATL will be helpful. In addition, if you choose to use a managed language, a knownledge of COM interop and mixed-mode debugging will be extremely helpful. Note that there are a few levels of VS integration:
Macros -- the simplest way to run custom code in the IDE.
Add-in -- A simple but powerful way to build custom functionality into the IDE. With an add-in, you can create custom commands, listen to events, manipulate text in the editor, etc. However, you cannot add, say, a new language or editor to the IDE with an add-in. For many purposes, an add-in works fine.
Package -- this is the same level of integration as Microsoft's features use. With a package, you can create pretty much anything in the Visual Studio IDE, including adding new languages.
You should note that these become progressively more complex to author and deploy.
In Visual Studio 2010, a new form of extensibility is being introduced in several areas of the IDE, but primarily for extending the new WPF text editor. Going forward, integration with Visual Studio will require MEF (Managed Extensibility Framework) components rather than COM. So, in VS 2010, extending the text editor will simply require authoring a MEF component in your favorite managed language.
The podcast Herding Code episode #48 features an interview with Dustin Campbell, a program manager on the Visual Studio Managed Languages Group.
In that interview he talks for several minutes about this exact issue and gets into details about why the changes in 2010 are breaking compat with 2008 and how the future looks.
If this is strictly a curiousity question the other answers are correct. But if you want to dig a little deeper, listening to the podcast would be well worth your time.
At least the following languages are used inside of Visual Studio 2008
C++
C#
VB.Net
C
C++/CLI
C++ with managed extensions
Probably a few others that I forgot about.
A mix. The core is C++/COM stuff, but a lot of the newer stuff is managed code (C# etc). Due to the core being C++/COM (with a pile of code 'borrowed' from MS Office), VS integration is a funny experience.