Click here to Skip to main content
15,893,663 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Trying to build a DLL but only getting an EXE Pin
EnemyMaker4-Jul-04 22:02
EnemyMaker4-Jul-04 22:02 
GeneralRe: Trying to build a DLL but only getting an EXE Pin
reznod5-Jul-04 4:55
reznod5-Jul-04 4:55 
GeneralSaving BMP/JPEG from Stream Pin
Emiliano2-Jul-04 6:47
Emiliano2-Jul-04 6:47 
GeneralPinnig Pointers Pin
EnemyMaker1-Jul-04 3:05
EnemyMaker1-Jul-04 3:05 
GeneralRe: Pinnig Pointers Pin
palbano1-Jul-04 17:43
palbano1-Jul-04 17:43 
GeneralRe: Pinnig Pointers Pin
EnemyMaker1-Jul-04 19:14
EnemyMaker1-Jul-04 19:14 
GeneralSubclassing a .NET winform control Pin
Matt Newman30-Jun-04 10:53
Matt Newman30-Jun-04 10:53 
GeneralRe: Subclassing a .NET winform control Pin
Csharp™2-Jul-04 16:51
Csharp™2-Jul-04 16:51 
here's a quick example i knocked together for you ...
#pragma once


namespace managed_cplus
{
	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary> 
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the 
	///          'Resource File Name' property for the managed resource compiler tool 
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	//static sclass* s;
public __gc class sClass :  public System::Windows::Forms::NativeWindow
{
public: Form* frm;

	public:
		sClass(System::IntPtr handle)
		{
			this->AssignHandle(handle);
			frm = dynamic_cast<Form*>(Form::get_ActiveForm());
			
		}
protected:
	void WndProc(Message* m)
	{
		NativeWindow::WndProc(m);
		frm->Text = m->Msg.ToString();
	}
};
	public __gc class Form1 : public System::Windows::Forms::Form
	{	
		
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}
  
	protected:
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
	private: System::Windows::Forms::Button *  button1;
	private: System::Windows::Forms::Panel *  panel1;

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container * components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->button1 = new System::Windows::Forms::Button();
			this->panel1 = new System::Windows::Forms::Panel();
			this->SuspendLayout();
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(28, 13);
			this->button1->Name = S"button1";
			this->button1->TabIndex = 0;
			this->button1->Text = S"button1";
			this->button1->Click += new System::EventHandler(this, &Form1::button1_Click);
			// 
			// panel1
			// 
			this->panel1->BackColor = System::Drawing::SystemColors::ActiveCaption;
			this->panel1->Location = System::Drawing::Point(116, 26);
			this->panel1->Name = S"panel1";
			this->panel1->TabIndex = 1;
			// 
			// Form1
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
			this->ClientSize = System::Drawing::Size(716, 444);
			this->Controls->Add(this->panel1);
			this->Controls->Add(this->button1);
			this->Name = S"Form1";
			this->Text = S"Form1";
			this->ResumeLayout(false);

		}	
#pragma endregion
	private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
			 {
				 sClass* sc = new sClass(panel1->Handle);
			 }

	};
}


hope it helps.



<font color="blue">Csharp</font> me = (<font color="blue">Csharp</font>)Dynamic_Sysop; <font color="#008000">// My Signature.</font><br><font color="#008000">$twins</font> = <font color="#008000">me.twins</font>(<font color="#800080">"Taylor"</font> , <font color="#800080">"Delta"</font>); <font color="#C0C0C0">// My twin daughters.</font><br>echo <font color="#008000">$twins</font>;
GeneralRe: Subclassing a .NET winform control Pin
Matt Newman2-Jul-04 17:49
Matt Newman2-Jul-04 17:49 
Generalstd::queue and Managed class Pin
Vadim Tabakman28-Jun-04 19:00
Vadim Tabakman28-Jun-04 19:00 
GeneralRe: std::queue and Managed class Pin
palbano29-Jun-04 4:48
palbano29-Jun-04 4:48 
GeneralRe: std::queue and Managed class Pin
Vadim Tabakman29-Jun-04 13:17
Vadim Tabakman29-Jun-04 13:17 
GeneralRe: std::queue and Managed class Pin
adrian cooper5-Aug-04 1:49
adrian cooper5-Aug-04 1:49 
GeneralC++ help!! Pin
tyaramis24-Jun-04 23:09
tyaramis24-Jun-04 23:09 
GeneralRe: C++ help!! Pin
Kevin McFarlane26-Jun-04 4:06
Kevin McFarlane26-Jun-04 4:06 
GeneralThis tutorial looks better Pin
Kevin McFarlane26-Jun-04 4:15
Kevin McFarlane26-Jun-04 4:15 
GeneralPorting : MFC on Linux Pin
a_mlt124-Jun-04 22:14
a_mlt124-Jun-04 22:14 
GeneralRe: Porting : MFC on Linux Pin
Anthony_Yio28-Jun-04 18:03
Anthony_Yio28-Jun-04 18:03 
GeneralRe: Porting : MFC on Linux Pin
Anonymous16-Jul-04 7:35
Anonymous16-Jul-04 7:35 
GeneralPorting : MFC on Linux Pin
a_mlt124-Jun-04 22:12
a_mlt124-Jun-04 22:12 
GeneralRe: Porting : MFC on Linux Pin
Kevin McFarlane26-Jun-04 3:57
Kevin McFarlane26-Jun-04 3:57 
GeneralSystem Menu in rebar Pin
duvaft24-Jun-04 5:51
duvaft24-Jun-04 5:51 
GeneralConversion of Managed C++ 7 function pointer to unmanaged User defined Type pointer Pin
Bilal Farooq22-Jun-04 1:48
Bilal Farooq22-Jun-04 1:48 
GeneralMicrosoft recommends C++ for .NET 2.0 and Longhorn Pin
Kevin McFarlane21-Jun-04 22:56
Kevin McFarlane21-Jun-04 22:56 
GeneralRe: Microsoft recommends C++ for .NET 2.0 and Longhorn Pin
cppmanuf25-Jun-04 17:48
cppmanuf25-Jun-04 17:48 

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.