Click here to Skip to main content
15,915,160 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Using acceleraor keys in Dialog application Pin
David Crow24-Aug-04 3:41
David Crow24-Aug-04 3:41 
GeneralRe: Using acceleraor keys in Dialog application Pin
WesleyPipes24-Aug-04 3:55
WesleyPipes24-Aug-04 3:55 
GeneralUsing the timer Pin
wicked_guy24-Aug-04 0:03
wicked_guy24-Aug-04 0:03 
GeneralRe: Using the timer Pin
Antony M Kancidrowski24-Aug-04 0:33
Antony M Kancidrowski24-Aug-04 0:33 
GeneralRe: Using the timer Pin
wicked_guy24-Aug-04 0:59
wicked_guy24-Aug-04 0:59 
GeneralRe: Using the timer Pin
Antony M Kancidrowski24-Aug-04 1:24
Antony M Kancidrowski24-Aug-04 1:24 
GeneralRe: Using the timer Pin
wicked_guy24-Aug-04 1:33
wicked_guy24-Aug-04 1:33 
GeneralHosting Managed Controls in MFC Pin
Amir Harel23-Aug-04 23:13
Amir Harel23-Aug-04 23:13 
I created a simple user control in C# which has a button in it.
//DemoControl.cs

namespace DemoControl
{
public class UserControl1 : System.Windows.Forms.UserControl
{
private System.Windows.Forms.Button button1;
///
/// Required designer variable.
///

private System.ComponentModel.Container components = null;

public UserControl1()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();

// TODO: Add any initialization after the InitComponent call

}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}

#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 16);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 32);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// UserControl1
//
this.Controls.Add(this.button1);
this.Name = "UserControl1";
this.Size = new System.Drawing.Size(608, 248);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.UserControl1_MouseMove);
this.ResumeLayout(false);

}
#endregion


}
}

The i created an MFC ActiveX control to host the C# control

//HostCtrol.cpp
int CMfcHostCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;

AfxEnableControlContainer();
DemoControl::UserControl1* pcal = new DemoControl::UserControl1();


CComPtr<iunknown> spunkControl;
spunkControl.Attach((IUnknown*)System::Runtime::InteropServices::Marshal::GetIUnknownForObject(pcal).ToPointer());

CRect rectPlaceHolder;
GetClientRect( &rectPlaceHolder );
m_ctrl.Create(spunkControl, WS_VISIBLE | WS_TABSTOP, rectPlaceHolder, this, 0);

return 0;
}

where m_ctrl is CWinFormsControlWnd class which i downloaded from the MSDN Magazine at http://msdn.microsoft.com/msdnmag/issues/03/03/WindowsForms/default.aspx

It works great, but the hosting application stuck when i press the button.

Does anyone knwos whats wrong?

Amir.

Amir Harel
GeneralConvert VB code to C++ Pin
Vivek Jishtu23-Aug-04 22:52
Vivek Jishtu23-Aug-04 22:52 
GeneralRe: Convert VB code to C++ Pin
Cedric Moonen23-Aug-04 23:11
Cedric Moonen23-Aug-04 23:11 
GeneralRe: Convert VB code to C++ Pin
Vivek Jishtu24-Aug-04 0:09
Vivek Jishtu24-Aug-04 0:09 
GeneralRe: Convert VB code to C++ Pin
Cedric Moonen24-Aug-04 1:12
Cedric Moonen24-Aug-04 1:12 
GeneralRe: Convert VB code to C++ Pin
Antony M Kancidrowski24-Aug-04 0:27
Antony M Kancidrowski24-Aug-04 0:27 
GeneralRe: Convert VB code to C++ Pin
Vivek Jishtu24-Aug-04 0:48
Vivek Jishtu24-Aug-04 0:48 
GeneralCreateMsgService fails Pin
kanetheterrible123-Aug-04 22:36
kanetheterrible123-Aug-04 22:36 
GeneralISAPI causes crashing to IIS when connection to SQL Server Pin
raed23-Aug-04 22:17
raed23-Aug-04 22:17 
GeneralRe: ISAPI causes crashing to IIS when connection to SQL Server Pin
Graham Bradshaw23-Aug-04 23:22
Graham Bradshaw23-Aug-04 23:22 
GeneralRe: ISAPI causes crashing to IIS when connection to SQL Server Pin
raed24-Aug-04 0:49
raed24-Aug-04 0:49 
GeneralRe: ISAPI causes crashing to IIS when connection to SQL Server Pin
raed24-Aug-04 1:56
raed24-Aug-04 1:56 
GeneralRe: ISAPI causes crashing to IIS when connection to SQL Server Pin
Graham Bradshaw24-Aug-04 2:56
Graham Bradshaw24-Aug-04 2:56 
GeneralRe: ISAPI causes crashing to IIS when connection to SQL Server Pin
raed24-Aug-04 4:12
raed24-Aug-04 4:12 
GeneralRe: ISAPI causes crashing to IIS when connection to SQL Server Pin
raed24-Aug-04 5:21
raed24-Aug-04 5:21 
QuestionHow to Disable Ctrl Tab in my application Pin
Omar Alvi23-Aug-04 21:50
Omar Alvi23-Aug-04 21:50 
Questionhow to make the background of CListCtrl transparent Pin
boyboy23-Aug-04 21:07
boyboy23-Aug-04 21:07 
AnswerRe: how to make the background of CListCtrl transparent Pin
Antony M Kancidrowski24-Aug-04 0:44
Antony M Kancidrowski24-Aug-04 0:44 

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.