sample02 (adding label)
$ make mmm
cat sample02.cpp
// sample02.cpp
// add Label
// http://msdn2.microsoft.com/ja-jp/library/system.windows.forms.formborderstyle
(VS.80).aspx
//
// still requires task manager to quit....
#using <mscorlib.dll>
#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
using namespace System;
using namespace System::ComponentModel;
using namespace System::Drawing;
using namespace System::Windows::Forms;
ref class MyForm : public Form
{
public:
MyForm();
Label ^m_label; // use ^ for gcnew staff
};
int __stdcall WinMain()
{
Application::Run(gcnew MyForm()); // message loop
return 0;
}
MyForm ::MyForm()
{
//set some form properties/fields
this->Text = "This should be a caption";
this->FormBorderStyle=::FormBorderStyle::Fixed3D; // notice started with
::
this->MaximizeBox=false;
this->ClientSize=System::Drawing::Size(400,300);
//create the Label object and set its properties/fields
m_label=gcnew Label();
m_label->Text="This is a text coded in sample02.cpp";
m_label->Size=System::Drawing::Size(300,50);
m_label->Location=Point(5,5);
//add the label to the form
this->Controls->Add(m_label);
}
cat makefile
TARGET=sample02
all: $(TARGET).exe
PHONY=all test mmm clean
.SUFFIXES: .obj
OBJS=$(TARGET).obj
$(TARGET).obj: $(TARGET).cpp
$(TARGET).exe: $(OBJS)
link $(OBJS)
.cpp.obj:
cl -c -Wall -Od -clr $<
test:
./$(TARGET).exe &
clean:
-rm $(TARGET).exe *.obj *~
mmm:
cat $(TARGET).cpp
@echo
cat makefile
html:
cat /dev/clipboard | code2html.exe | unix2dos