010
10.07.2006, 16:09 Uhr
der Leitman
|
danke, das war sehr hilfreich *gg*
Terminalserver schön und gut, aber ich hab nur mit dem Client zu tun, das einzige was ich zurzeit brauche ist, wie ich im ganzen Programm ein schließen durch ALT F4 sperren kann. Hab eigentlich nur gefragt, ob es eine Alternative zum Kexboardhook gibt, oder einen andern Anatz!?
Quellcode:
C++: |
// //only TestWinFormApp //July 2006 //
#pragma once
namespace TestWinFormApp {
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> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // }
protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::Button^ button2; private: newControl::newControlControl^ newControlControl1; //to use CustomControl in TestWinFormApp private: static int flankcounter = 0;
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 = (gcnew System::Windows::Forms::Button()); this->button2 = (gcnew System::Windows::Forms::Button()); this->newControlControl1 = (gcnew newControl::newControlControl()); this->SuspendLayout(); // // button1 // this->button1->Location = System::Drawing::Point(102, 208); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(75, 23); this->button1->TabIndex = 0; this->button1->TabStop = false; this->button1->Text = L"beenden"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); this->button1->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyDown); // // button2 // this->button2->Location = System::Drawing::Point(102, 159); this->button2->Name = L"button2"; this->button2->Size = System::Drawing::Size(75, 23); this->button2->TabIndex = 0; this->button2->TabStop = false; this->button2->Text = L"button2"; this->button2->UseVisualStyleBackColor = true; this->button2->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyDown); // // newControlControl1 // this->newControlControl1->ButtonText = L"ändern"; this->newControlControl1->LabelText = L"Weiche 1"; this->newControlControl1->Location = System::Drawing::Point(200, 159); this->newControlControl1->Name = L"newControlControl1"; this->newControlControl1->Size = System::Drawing::Size(127, 72); this->newControlControl1->StatusFlank = newControl::newControlControl::FlankStatus::StatusMiddle; this->newControlControl1->TabIndex = 0; this->newControlControl1->button->Click += gcnew System::EventHandler(this, &Form1::newControlControl1_Click); this->newControlControl1->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyDown); this->newControlControl1->button->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyDown); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(1280, 1024); this->ControlBox = false; this->Controls->Add(this->newControlControl1); this->Controls->Add(this->button2); this->Controls->Add(this->button1); this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None; this->Name = L"Form1"; this->Text = L"Form1"; this->TopMost = true; this->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyDown); this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); this->ResumeLayout(false);
} #pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { }
//KeyEventHandler to catch downKeys private: System::Void Form1_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) {
if (e->Alt) { //ALT F4 Catch: if (e->KeyCode == Keys::F4) { MessageBox::Show("Couldn`t close Program!"); }
//doesn`t work /* //ALT TAB Catch: if (e->KeyCode == Keys::Tab) { MessageBox::Show("Couldn`t switch Program!"); } */ } //Event Handled e->Handled = true; }
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { this->Close(); }
private: System::Void newControlControl1_Click(System::Object^ sender, System::EventArgs^ e) { switch(flankcounter%3) { case 0: this->newControlControl1->StatusFlank = newControl::newControlControl::FlankStatus::StatusLeft; break; case 1: this->newControlControl1->StatusFlank = newControl::newControlControl::FlankStatus::StatusMiddle; break; case 2: this->newControlControl1->StatusFlank = newControl::newControlControl::FlankStatus::StatusRight; break; }
this->Refresh(); flankcounter++;
}
}; }
|
-- Das Leben ist ein Scheiß-Spiel... aber die Grafik ist saugeil!!! |