How to use C# usercontrol in VC++ 6.0? - interop

I have a legacy application written using VC++ MFC. For a latest feature, I have created a C# user control. I want to be able to use this control in the legacy VC application. How can I do it?

What do you mean by legacy application? Can you compile MFC application in Visual Studio 2005? Can you add Common Language Runtime (clr) support during compilation? If so, it's pretty simple to host a user control in MFC application. Just follow the instructions here.
If you can't do that, just create a wrapper C++/CLI AcitveX control and host the user control in it. Resize the hosted control to fill the area of the ActiveX. Now you can use this ActiveX in your MFC application. The drawback is like Wrapper pattern, you have to forward all public methods and properties from UserControl to ActiveX Control.

Related

How many ways to develop outlook add in?

I found some ways below.
1. Add-in Express
2. VSTO
3. unmanaged c++
I'm not sure is this right?
And which way can compile only a dll without any dependency.
Using outlook add in, could I get the drag attachment event?
You will be surprised but there is only one way for developing Office COM add-ins - implement the IDTExtensibility2 interaface. All the paths you mentioned follow this pattern and have their own pros and cons.
You can use managed programming languages for developing an add-in as well (C# or VB.NET). C++ is not required. Erlier VS versions had a template for that called "shared COM add-in". VSTO and Add-in Express provides shims (loaders) that create a new Application domain to run your add-in code in isolation from other add-ins. It is up to you which framework to use, or just not to use any.

Viewing, building & debugging Borland C++ Builder project in Visual Studio 2010

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.

How was the gui for Visual Studio 2012 achieved and how can we make similar looking applications

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.

Visual Studio 2012 Resources Editor for non MFC applications

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.

How do you show a dialog when a project is created in Visual Studio?

I'm trying to create a web application project template for everyone to use here at work that will minimize the amount of work that we have to do to create a new application with all our normal stuff, and I was thinking that it would be nice to do some setup stuff (add some records to a database) when the developer creates a new application (only if they tell it to), and I would like to do it through a dialog like the one that pops up for unit testing when you create a new ASP.Net MVC project. Is there any way to write a custom dialog that will pop up when you create a new project from the our custom project template? I'm assuming they're just using some public interface for the MVC unit testing dialog, right?
We're still on Visual Studio 2005, though, so maybe something like that isn't supported until 2008?
You're going to need a little VSX for this (Visual Studio Extensibility). Install the Visual Studio SDK and look for samples about the IWizard interface.
That may be all you need. However, if you need a more extensive and powerful experience around custom creation of projects and project items, and easy addition of context-sensitive commands to Visual Studio, then take a look at the Guidance Automation Extensions and Guidance Automation Toolkit.

Resources