Click here to Skip to main content
15,884,176 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to store spcial characters including NUL (0x00) in MS ACCESS(*.mdb) using c++ Pin
Madhu Nair8-May-09 4:24
Madhu Nair8-May-09 4:24 
QuestionNaN comparison in vc6 & vc8 Pin
dotnetkoders8-May-09 2:27
dotnetkoders8-May-09 2:27 
AnswerRe: NaN comparison in vc6 & vc8 Pin
David Crow8-May-09 2:45
David Crow8-May-09 2:45 
GeneralRe: NaN comparison in vc6 & vc8 Pin
dotnetkoders8-May-09 3:02
dotnetkoders8-May-09 3:02 
QuestionRe: NaN comparison in vc6 & vc8 Pin
David Crow8-May-09 3:46
David Crow8-May-09 3:46 
AnswerRe: NaN comparison in vc6 & vc8 Pin
Stuart Dootson8-May-09 3:25
professionalStuart Dootson8-May-09 3:25 
QuestionRe: NaN comparison in vc6 & vc8 Pin
CPallini8-May-09 5:53
mveCPallini8-May-09 5:53 
QuestionDynamically place .NET controls on Win32/MFC windows. Pin
rwe18128-May-09 2:24
rwe18128-May-09 2:24 
Hello,

I have a C++/MFC application, which can be extended by its users by means of a PlugIn interface. This interface uses simple dll mechanisms (no COM). Now I want to add a functionality to allow these PlugIns to be written in .NET languages. Therefore I created a wrapper PlugIn, which sits between the MFC application and the .NET user PlugIn. This works very well so far. However, I have one problem. Some PlugIns might require to extend the user interface of the MFC app by controls in order to apply specific settings. The method for this, which is to be implemented in the native dlls, has the following prototype:

HWND CreateSettingsWindow(HWND wndParent);


Where wndParent is the window handle of the parent window on which the control should be placed.

What I do in the wrapper is create a .NET form control from this handle and pass it to the wrapped .NET PlugIn like this.

HWND CreateSettingsWindow(HWND wndParent)
{
	System::Windows::Forms::Control^ ctrl = System::Windows::Forms::Control::FromHandle((System::IntPtr)wndParent);
	System::Windows::Forms::Control^ ctrlSettings = (*this->m_pWrappedPlugIn)->CreateSettingsWindow(ctrl);
	if (ctrlSettings != nullptr)
	{
		return (HWND)ctrlSettings->Handle.ToPointer();
	}
	else
	{
		return NULL;
	}
}


The wrapped .NET PlugIn now creates its control (derived from System.Windows.Forms.UserControl) and attaches it to the controls collection of the parent window:

public override System.Windows.Forms.Control CreateSettingsWindow(System.Windows.Forms.Control parent)
{
	MySettingsControl ctrl = new MySettingsControl();
	parent.Controls.Add(ctrl);
	return ctrl;
}


The control is created correctly and as it seems I can even access it from the MFC application (at least I can read its size). But it will not show up on the parent window. Regardless what I do (visible property, show method, ...) it will not become visible.

Any idea what could be wrong with my approach or what might be missing would be very helpful.
Thank you very much


AnswerRe: Dynamically place .NET controls on Win32/MFC windows. Pin
Stuart Dootson8-May-09 8:24
professionalStuart Dootson8-May-09 8:24 
GeneralRe: Dynamically place .NET controls on Win32/MFC windows. Pin
rwe181210-May-09 22:42
rwe181210-May-09 22:42 
GeneralRe: Dynamically place .NET controls on Win32/MFC windows. Pin
Stuart Dootson10-May-09 23:27
professionalStuart Dootson10-May-09 23:27 
QuestionHow to Recognise a window Pin
john56328-May-09 2:12
john56328-May-09 2:12 
AnswerRe: How to Recognise a window Pin
_AnsHUMAN_ 8-May-09 2:16
_AnsHUMAN_ 8-May-09 2:16 
QuestionRe: How to Recognise a window Pin
David Crow8-May-09 2:35
David Crow8-May-09 2:35 
AnswerRe: How to Recognise a window Pin
john56328-May-09 2:43
john56328-May-09 2:43 
QuestionRe: How to Recognise a window Pin
David Crow8-May-09 2:53
David Crow8-May-09 2:53 
AnswerRe: How to Recognise a window Pin
john56328-May-09 3:12
john56328-May-09 3:12 
QuestionRe: How to Recognise a window Pin
David Crow8-May-09 3:47
David Crow8-May-09 3:47 
AnswerRe: How to Recognise a window Pin
john56328-May-09 6:53
john56328-May-09 6:53 
QuestionRe: How to Recognise a window Pin
john56328-May-09 3:42
john56328-May-09 3:42 
GeneralBasics Pin
Anil Kumar.Arvapalli8-May-09 2:04
Anil Kumar.Arvapalli8-May-09 2:04 
GeneralRe: Basics Pin
_AnsHUMAN_ 8-May-09 2:11
_AnsHUMAN_ 8-May-09 2:11 
QuestionHelp in win32 dll & c# Pin
ashish8patil8-May-09 1:40
ashish8patil8-May-09 1:40 
AnswerRe: Help in win32 dll & c# Pin
_AnsHUMAN_ 8-May-09 1:51
_AnsHUMAN_ 8-May-09 1:51 
GeneralRe: Help in win32 dll & c# Pin
ashish8patil8-May-09 2:10
ashish8patil8-May-09 2:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.