Click here to Skip to main content
15,911,132 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Outlook won't close!!! Pin
User 46247825-Aug-04 23:15
User 46247825-Aug-04 23:15 
QuestionHow to enumerate user-defined event handlers? Pin
peraita24-Aug-04 5:57
peraita24-Aug-04 5:57 
AnswerRe: How to enumerate user-defined event handlers? Pin
Charlie Williams24-Aug-04 12:37
Charlie Williams24-Aug-04 12:37 
GeneralMS Office Interop Disaster! Need help urgently please... Pin
User 46247824-Aug-04 5:25
User 46247824-Aug-04 5:25 
GeneralRe: MS Office Interop Disaster! Need help urgently please... Pin
User 46247824-Aug-04 5:26
User 46247824-Aug-04 5:26 
GeneralI need Explaination for... Pin
mtone24-Aug-04 3:28
mtone24-Aug-04 3:28 
GeneralRe: I need Explaination for... Pin
Colin Angus Mackay24-Aug-04 5:49
Colin Angus Mackay24-Aug-04 5:49 
GeneralHosting Managed Controls in MFC Pin
Amir Harel23-Aug-04 23:12
Amir Harel23-Aug-04 23:12 
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
QuestionHow do I run SQL Script from .msi installer?? Pin
IrishSonic23-Aug-04 22:21
IrishSonic23-Aug-04 22:21 
GeneralASp.net Mobile Forms authentication on Nokia Mobile Browser 4.0 Pin
rmalone23-Aug-04 3:18
rmalone23-Aug-04 3:18 
General.NET equivilent of CATID's Pin
James Hughes23-Aug-04 0:56
James Hughes23-Aug-04 0:56 
GeneralProblem veryfing a XML signed document Pin
Escroto22-Aug-04 8:23
Escroto22-Aug-04 8:23 
QuestionA mistake within the MSDN .NET 1.1 docs? Pin
Member 131295721-Aug-04 9:48
Member 131295721-Aug-04 9:48 
AnswerRe: A mistake within the MSDN .NET 1.1 docs? Pin
Colin Angus Mackay21-Aug-04 11:23
Colin Angus Mackay21-Aug-04 11:23 
GeneralDrawing to the screen DC with GDI+ Pin
Jon Rista20-Aug-04 17:23
Jon Rista20-Aug-04 17:23 
GeneralRe: Drawing to the screen DC with GDI+ Pin
Shafqat Ahmed (Shiplu)21-Aug-04 12:11
Shafqat Ahmed (Shiplu)21-Aug-04 12:11 
GeneralRe: Drawing to the screen DC with GDI+ Pin
Jon Rista24-Aug-04 12:02
Jon Rista24-Aug-04 12:02 
Generalcrystal reporots login faild Pin
kings_120-Aug-04 14:21
kings_120-Aug-04 14:21 
GeneralLNK 2019: Build Debug Win32 DLL from Dot NEt Pin
sankar20-Aug-04 3:33
sankar20-Aug-04 3:33 
GeneralHelp trapping Sync event with .NET CF Pin
Andre Oschadlin20-Aug-04 0:11
Andre Oschadlin20-Aug-04 0:11 
Questionhelp me plz? Pin
prozac8819-Aug-04 4:19
prozac8819-Aug-04 4:19 
GeneralCrystal Report Error: Fail to render the page Pin
spn19-Aug-04 3:20
spn19-Aug-04 3:20 
General.Net framework update Pin
Small Rat18-Aug-04 14:26
Small Rat18-Aug-04 14:26 
GeneralRe: .Net framework update Pin
ZippyV20-Aug-04 4:01
ZippyV20-Aug-04 4:01 
GeneralRe: .Net framework update Pin
Colin Angus Mackay20-Aug-04 4:04
Colin Angus Mackay20-Aug-04 4:04 

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.