473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Managed C# Control in Unmanged C++ CView

Dan
I'm trying to create and display a user control written in C# in one of our
legecy C++ apps.

Everything compiles and links fine and the managed control is being created
but there's no sign of it in the window. That is, I get no run-time errors. I
created test apps to bypass the complexities of the real classes I have to
deal with.

When I had no luck using the managed class directly through the gcroot
template I added the CWnd wrapper but it made no difference.

I'm pretty sure I'll be able to expose the managed class as an ActiveX
control and all will be OK but I'd rather avoid the extra step.

In the CView derived class I have:
gcroot<TransCore::TIS::Controls::TISList *> tisList;
CWnd * tisListWrapper;

In the View's OnInitialUpdate override:
#pragma push_macro("new")
#undef new
tisList = new TransCore::TIS::Controls::UserControlDontCheckMeIn ();
#pragma pop_macro("new")

tisListWrapper = new CWnd();
tisListWrapper->Attach ( (HWND)tisList->Handle.ToInt32() );

And in the OnSize handler:
if ( tisListWrapper != NULL )
tisListWrapper->SetWindowPos( &wndTop, 0, 0, cx, cy, SWP_SHOWWINDOW );

--
Thanks,
Dan
Nov 17 '05 #1
0 860

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mr Topom | last post by:
Hello, I have a C++ (unmanaged) class named K in a DLL. I create a managed C++ class named K in an other DLL that wrapped the unmanaged one. To refer the unmanaged one I use ::K and the...
2
by: NGM | last post by:
Hello All I have a unmanaged C++ DLL, which has been wrapped up with a manged C++ DLL. When i refer to this managed DLL in Windows form based applications it works out fine. But when i refer to...
2
by: Sandy | last post by:
I am confused about Unmanaged Code, How .Net Framework treate that code, What is the use of that. Thanks in advance Sandeep Chitode
5
by: Maxwell | last post by:
Hello, Newbie question here. I have a VS.NET 2003 MC++ (not C++/cli) project where I have a managed class reference in a unmanaged class...simple enough. To keep things short I am for the most...
14
by: Notre Poubelle | last post by:
Hello, I have a worker thread that needs to call a method that only works on the main/UI thread. One way to accomplish this in managed code is to use Control.Invoke. However, in my case I...
1
by: mschuck | last post by:
Here is the scenario I'm trying to make work. I've got 2 managed C++ classes, each of which wrappes an unmanaged C++ class, kind of like so: __nogc class UnmanagedClassA { public: void...
6
by: B. | last post by:
my small project has two files, umg.cpp (unmanaged c++) and mged.cpp (MC++), and unmanged code will call managed code. However, I cannot debug from unmanged code into managed code. Can anyone help...
5
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I have a class that is writen in unmanaged pure native C++. This class files (h and cpp) are inserted to a managed C++ (VC++ 2005, C++/CLI) DLL compoenet. This DLL compoenet is used in a C#...
0
by: ElysianEagle | last post by:
Hi, I have a DLL written in C that creates a structure as a local variable, populates it, and then calls a function in managed c#. here is what im talking about: //-----unmanged code's header...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.