Hilfe - wie krieg ich die Variable von a nach b
-
Oder er meint "System.String" (.NET Framework, C++/CLI).
-
angezeigt wird aber System::String
Edit: Ok. System.String.
System::String zeigt er an wenn ich drauf fahre und oben steht System.StringEdit2: Noch was - geht es mit einem #ifdef befehl zwischen xp und vista zu unterscheiden? oder wie soll ich das sonst machen?
-
TDK schrieb:
Edit2: Noch was - geht es mit einem #ifdef befehl zwischen xp und vista zu unterscheiden? oder wie soll ich das sonst machen?
Präprozessor-Makros kenne ich keine - aber eventuell hilft GetVersionEx() weiter bei der Auswahl (XP liefert MajorVersion 5, Vista 6).
-
GetVersionEx() is leider noch zu hoch für mich. versteh ich nicht. gibtsne andere möglichkeit?
-
Was verstehst du daran denn nicht?
Und nutzt du überhaupt WinApi? Ich hab überhaupt nicht verstanden was du hier für Probleme hattest
schirrmie
-
ja ich verwende ne normale windows form application. frag mich nit was genau - scheint so die mods würden es auch nicht wissen denn ich werde immer zwischen WinAPI und CLI hin und her geschoben^^.
Mein Problem war:
Ich möchte gerne einige Variablen von einer eigenen Methode in eine Timer Methode bringen. Sprich die Variablen von a nach b (mit den Werten^^ sonst hätte es ja keinen sinn)
bezüglich GetVersionEx()
wenn dass gemeint ist:
http://msdn2.microsoft.com/en-us/library/ms724451.aspx
hab ich keine ahnung was ich machen soll!
dann war da noch wegen der Zeit:
ich möchte gerne 3:3:3 so aussehen lassen : 3:03:03
sprich wenn nur einstellig nen 0er davor!
-
Also so wie ich das sehe benutzt du kein WinApi sondern die WinForms. Und anscheinend mischt du das immermal mit WinApi. Das solltest du sein lassen und WinApi nur nutzen wenn es nix in deinem Framework gibt!
Also zu dem ersten Problem kann ich dir nicht viel sagen weil ich mit mit WinForms nicht auskenne. Aber vielleicht hilft dir ja ne globale Variable.
Wie gesagt schau ob es ein Funktion wie GetVerseionEx in WinForms gibt und benutze die wenn nicht was verstehst du an diesem Link nicht da ist doch alles erklärt und sogar ein Bsp. bei!
Und zu deinem anderen Problem wurde doch schon eine Lösung geschrieben.schirrmie
-
wenn mir jemand sagt wo der unterschied zwischen den untersprachen ist

und was war das mit dem 0er? da kam doch die frage auf ob es ein system.string oder was auch immer ist.
Gibts hier keinen allrounder der mir mal per icq zur seite stehen könnte oder so? das buch was ich hab erklärt halt auch nicht alles.
-
Naja Untersprachen ist schlecht ausgedrückt. Also WinApi ist sogesehen pur Windows. In der User32.dll oder kernel32.dll (oder wie die alle heißen) sind halt die Funktionen von der WinApi drin. Das heist WinApi ist die unterste Ebene zum Programmieren. (Was ich jetzt zu Winforms sage ist keine Garantie kenn mich damit nicht aus!)
Winforms (ähnlich wie MfC) kapselt die WinApi in ein Framework, also in Klassen. Wenn du ein gutes Framework hast solltest du alle Funktionen aus der WinApi dort wiederfinden. Aber z.B. in VB6 greift man öfter mal auf die WinApi zurück weil man in VB nicht alles so hat.
So vielleicht hilft dir das erstmal ein bisschen weiter. Jetzt wieder zu deinen Problemen. Als das mit den 0. Guck mal nach ob du bei deinem System.String eine Funktion/Methode/wieauchimmerdasbeidirheist hast die Format heißt. Dann kannst du mit den formatangaben deinen String formatieren (wie das eine bsp. hier im Thread). Wie gesagt entweder gibt es was bei dir wie GetVersionEx oder du musst auf die WinApi zurückgreifen und dir das Bsp. anschauen.MfG schirrmie
-
meinste das:
printf("%02d:%02d:%02d", stunde, minute, sekunde);
zum GetVersionEx : was müsste ich bei
__inout LPOSVERSIONINFOA lpVersionsInformationoder
__inout LPOSVERSIONSINFOW lpVersionsInformatoineingeben? (das schlägt vs vor das ich eingeben soll - hab keine ahnung was das sein sollte!)
-
1.) Ja das meinte ich. Guck ob es eine Funktion namens Format oder so gibt wenn nicht musst du auf c++ oder so zurückgreifen. Findet sich auf jeden Fall was

2.) Da ist doch ein Bsp.
und wenn dir das nicht reicht dann guck dir das an. Da ist eigentlich jede Windowsversion aufgeführt http://msdn2.microsoft.com/en-us/library/ms724429.aspxschirrmie
-
habs jetzt geschafft (bis auf ein problem bei den domainupdown und das mit dem 0er) nur kann es mein freund auf seinen computer nicht ausführen! er hat selbst vs aber nur für c# (keine ahnung wie genau das jetzt heißt). ich hab das programm released und im die released exe gegeben.
nur kann er es nicht ausführen! an was kann das liegen?
-
Vermutlich daran, daß er "kein C# hat" - .NET Programme (C#, C++/CLI etc) benötigen eine eigene Laufzeitumgebung, um arbeiten zu können. Es ist zwar eventuell ein Schritt nach hinten, aber im Notfall mußt du auf .NET verzichten und die MFC nutzen.
(und bei MFC's CString gibt es eine Methode Format(), mit der du im (s)printf()-Stil Strings zusammenbauen kannst)
-
doch er hat c# - ok ich werd ihm sagen er soll noch mal brav .net installn^^ oder hab ich das jetzt falsch verstanden von dir?
-
Ups, da hatte ich etwas falsch verstanden. (und C# installiert afair das .NET Framework gleich mit). Aber ich glaube, du solltest mal darauf warten, daß der Thread ins C++/CLI-Board verschoben wird, dort dürfte eher eine Lösung zu finden sein.
-
Noch was - geht es mit einem #ifdef befehl zwischen xp und vista zu unterscheiden? oder wie soll ich das sonst machen?
Ja, das geht.
Für XP ist das hier definiert:
WINVER=0x0501Für Vista:
WINVER=0x0600http://msdn2.microsoft.com/en-us/library/aa383745.aspx
HTH
rya.edit: heut ist nicht mein tag.. der thread hat ja 3 seiten.. -.- egal
hab nur die erste gelesen
-
Mittlerweile fühl ich mich nicht mehr so gut bei den gedanken an c++^^
wieder ein problem besser gesagt zwei
1)
scorcher24 hat mir ein prog empfohlen mit dem man die gebrauchten dll's herausfindet
hab geschaut
aber mein freund hat alle die
der einzigeunterschied ist das er xp und ich vista hab
2)
also
wenn ich mein programm mit vs debugge geht es normal.
wenn ich die released exe ausführe bekomm ich immer eine fehlermeldung
scorcher meinte den code hier rein, vllt erkennt ja von euch einer was:#pragma once #include <ctime> namespace WindowsZeitausschalter { 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> int dayEnd; int hourEnd; int minEnd; int secEnd; public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } void TimeRenew(void){ std::time_t Zeit; std::tm *jetzt; Zeit = std::time(0); jetzt = std::localtime(&Zeit); labelTimeNow->Text = "" + jetzt->tm_hour + " : " + jetzt->tm_min+ " : " + jetzt->tm_sec; } void TimeCalculate(int hour, int min, int sec){ std::time_t Zeit; std::tm *jetzt; Zeit = std::time(0); jetzt = std::localtime(&Zeit); dayEnd = jetzt->tm_mday; hourEnd = hour + jetzt->tm_hour; minEnd = min + jetzt->tm_min; secEnd = sec + jetzt->tm_sec; while(secEnd >= 60){ minEnd = minEnd + 1; secEnd = secEnd - 60; } while(minEnd >= 60){ hourEnd = hourEnd + 1; minEnd = minEnd - 60; } labelTimeOut->Text = hourEnd + ":" + minEnd + ":" + secEnd; if (hourEnd >= 24) { hourEnd = hour - 24; int dayEnd = jetzt->tm_mday + 1; } int *ptrday = &dayEnd; int *ptrsec = &secEnd; int *ptrmin = &minEnd; int *ptrhour = &hourEnd; } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::TextBox^ textBoxHour; private: System::Windows::Forms::TextBox^ textBoxMinute; private: System::Windows::Forms::TextBox^ textBoxSecond; private: System::Windows::Forms::Label^ label2; private: System::Windows::Forms::Label^ label3; private: System::Windows::Forms::Label^ label4; private: System::Windows::Forms::Label^ label5; private: System::Windows::Forms::Button^ buttonTimer; private: System::Windows::Forms::Button^ buttonTime; private: System::Windows::Forms::DomainUpDown^ domainUpDownHour; private: System::Windows::Forms::DomainUpDown^ domainUpDownMinute; private: System::Windows::Forms::DomainUpDown^ domainUpDownSecond; private: System::Windows::Forms::Label^ label6; private: System::Windows::Forms::Label^ label7; private: System::Windows::Forms::Label^ label8; private: System::Windows::Forms::Label^ labelTimeNow; private: System::Windows::Forms::Label^ labelTimeOut; private: System::Windows::Forms::Label^ label9; private: System::Windows::Forms::Timer^ timer1; private: System::Windows::Forms::Timer^ timer2; private: System::Windows::Forms::Timer^ timer3; private: System::Windows::Forms::Button^ buttonStop; private: System::ComponentModel::IContainer^ components; protected: private: /// <summary> /// Required designer variable. /// </summary> #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->components = (gcnew System::ComponentModel::Container()); System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid)); this->label1 = (gcnew System::Windows::Forms::Label()); this->textBoxHour = (gcnew System::Windows::Forms::TextBox()); this->textBoxMinute = (gcnew System::Windows::Forms::TextBox()); this->textBoxSecond = (gcnew System::Windows::Forms::TextBox()); this->label2 = (gcnew System::Windows::Forms::Label()); this->label3 = (gcnew System::Windows::Forms::Label()); this->label4 = (gcnew System::Windows::Forms::Label()); this->label5 = (gcnew System::Windows::Forms::Label()); this->buttonTimer = (gcnew System::Windows::Forms::Button()); this->buttonTime = (gcnew System::Windows::Forms::Button()); this->domainUpDownHour = (gcnew System::Windows::Forms::DomainUpDown()); this->domainUpDownMinute = (gcnew System::Windows::Forms::DomainUpDown()); this->domainUpDownSecond = (gcnew System::Windows::Forms::DomainUpDown()); this->label6 = (gcnew System::Windows::Forms::Label()); this->label7 = (gcnew System::Windows::Forms::Label()); this->label8 = (gcnew System::Windows::Forms::Label()); this->labelTimeNow = (gcnew System::Windows::Forms::Label()); this->labelTimeOut = (gcnew System::Windows::Forms::Label()); this->label9 = (gcnew System::Windows::Forms::Label()); this->timer1 = (gcnew System::Windows::Forms::Timer(this->components)); this->timer2 = (gcnew System::Windows::Forms::Timer(this->components)); this->timer3 = (gcnew System::Windows::Forms::Timer(this->components)); this->buttonStop = (gcnew System::Windows::Forms::Button()); this->SuspendLayout(); // // label1 // this->label1->AutoSize = true; this->label1->Location = System::Drawing::Point(12, 44); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(62, 13); this->label1->TabIndex = 0; this->label1->Text = L"Nach Timer"; // // textBoxHour // this->textBoxHour->Location = System::Drawing::Point(15, 61); this->textBoxHour->Name = L"textBoxHour"; this->textBoxHour->Size = System::Drawing::Size(70, 20); this->textBoxHour->TabIndex = 1; // // textBoxMinute // this->textBoxMinute->Location = System::Drawing::Point(107, 61); this->textBoxMinute->Name = L"textBoxMinute"; this->textBoxMinute->Size = System::Drawing::Size(70, 20); this->textBoxMinute->TabIndex = 2; // // textBoxSecond // this->textBoxSecond->Location = System::Drawing::Point(199, 61); this->textBoxSecond->Name = L"textBoxSecond"; this->textBoxSecond->Size = System::Drawing::Size(70, 20); this->textBoxSecond->TabIndex = 3; // // label2 // this->label2->AutoSize = true; this->label2->Location = System::Drawing::Point(91, 64); this->label2->Name = L"label2"; this->label2->Size = System::Drawing::Size(10, 13); this->label2->TabIndex = 7; this->label2->Text = L":"; // // label3 // this->label3->AutoSize = true; this->label3->Location = System::Drawing::Point(183, 64); this->label3->Name = L"label3"; this->label3->Size = System::Drawing::Size(10, 13); this->label3->TabIndex = 8; this->label3->Text = L":"; // // label4 // this->label4->AutoSize = true; this->label4->Location = System::Drawing::Point(91, 137); this->label4->Name = L"label4"; this->label4->Size = System::Drawing::Size(10, 13); this->label4->TabIndex = 9; this->label4->Text = L":"; // // label5 // this->label5->AutoSize = true; this->label5->Location = System::Drawing::Point(183, 137); this->label5->Name = L"label5"; this->label5->Size = System::Drawing::Size(10, 13); this->label5->TabIndex = 10; this->label5->Text = L":"; // // buttonTimer // this->buttonTimer->Location = System::Drawing::Point(242, 87); this->buttonTimer->Name = L"buttonTimer"; this->buttonTimer->Size = System::Drawing::Size(75, 23); this->buttonTimer->TabIndex = 11; this->buttonTimer->Text = L"Start"; this->buttonTimer->UseVisualStyleBackColor = true; this->buttonTimer->Click += gcnew System::EventHandler(this, &Form1::buttonTimer_Click); // // buttonTime // this->buttonTime->Location = System::Drawing::Point(242, 163); this->buttonTime->Name = L"buttonTime"; this->buttonTime->Size = System::Drawing::Size(75, 23); this->buttonTime->TabIndex = 12; this->buttonTime->Text = L"Start"; this->buttonTime->UseVisualStyleBackColor = true; this->buttonTime->Click += gcnew System::EventHandler(this, &Form1::buttonTime_Click); // // domainUpDownHour // this->domainUpDownHour->Items->Add(L"0"); this->domainUpDownHour->Items->Add(L"23"); this->domainUpDownHour->Items->Add(L"22"); this->domainUpDownHour->Items->Add(L"21"); this->domainUpDownHour->Items->Add(L"20"); this->domainUpDownHour->Items->Add(L"19"); this->domainUpDownHour->Items->Add(L"18"); this->domainUpDownHour->Items->Add(L"17"); this->domainUpDownHour->Items->Add(L"16"); this->domainUpDownHour->Items->Add(L"15"); this->domainUpDownHour->Items->Add(L"14"); this->domainUpDownHour->Items->Add(L"13"); this->domainUpDownHour->Items->Add(L"12"); this->domainUpDownHour->Items->Add(L"11"); this->domainUpDownHour->Items->Add(L"10"); this->domainUpDownHour->Items->Add(L"9"); this->domainUpDownHour->Items->Add(L"8"); this->domainUpDownHour->Items->Add(L"7"); this->domainUpDownHour->Items->Add(L"6"); this->domainUpDownHour->Items->Add(L"5"); this->domainUpDownHour->Items->Add(L"4"); this->domainUpDownHour->Items->Add(L"3"); this->domainUpDownHour->Items->Add(L"2"); this->domainUpDownHour->Items->Add(L"1"); this->domainUpDownHour->Location = System::Drawing::Point(15, 135); this->domainUpDownHour->Name = L"domainUpDownHour"; this->domainUpDownHour->Size = System::Drawing::Size(70, 20); this->domainUpDownHour->TabIndex = 13; // // domainUpDownMinute // this->domainUpDownMinute->Items->Add(L"0"); this->domainUpDownMinute->Items->Add(L"59"); this->domainUpDownMinute->Items->Add(L"58"); this->domainUpDownMinute->Items->Add(L"57"); this->domainUpDownMinute->Items->Add(L"56"); this->domainUpDownMinute->Items->Add(L"55"); this->domainUpDownMinute->Items->Add(L"54"); this->domainUpDownMinute->Items->Add(L"53"); this->domainUpDownMinute->Items->Add(L"52"); this->domainUpDownMinute->Items->Add(L"51"); this->domainUpDownMinute->Items->Add(L"50"); this->domainUpDownMinute->Items->Add(L"49"); this->domainUpDownMinute->Items->Add(L"48"); this->domainUpDownMinute->Items->Add(L"47"); this->domainUpDownMinute->Items->Add(L"46"); this->domainUpDownMinute->Items->Add(L"45"); this->domainUpDownMinute->Items->Add(L"44"); this->domainUpDownMinute->Items->Add(L"43"); this->domainUpDownMinute->Items->Add(L"42"); this->domainUpDownMinute->Items->Add(L"41"); this->domainUpDownMinute->Items->Add(L"40"); this->domainUpDownMinute->Items->Add(L"39"); this->domainUpDownMinute->Items->Add(L"38"); this->domainUpDownMinute->Items->Add(L"37"); this->domainUpDownMinute->Items->Add(L"36"); this->domainUpDownMinute->Items->Add(L"35"); this->domainUpDownMinute->Items->Add(L"34"); this->domainUpDownMinute->Items->Add(L"33"); this->domainUpDownMinute->Items->Add(L"32"); this->domainUpDownMinute->Items->Add(L"31"); this->domainUpDownMinute->Items->Add(L"30"); this->domainUpDownMinute->Items->Add(L"29"); this->domainUpDownMinute->Items->Add(L"28"); this->domainUpDownMinute->Items->Add(L"27"); this->domainUpDownMinute->Items->Add(L"26"); this->domainUpDownMinute->Items->Add(L"25"); this->domainUpDownMinute->Items->Add(L"24"); this->domainUpDownMinute->Items->Add(L"23"); this->domainUpDownMinute->Items->Add(L"22"); this->domainUpDownMinute->Items->Add(L"21"); this->domainUpDownMinute->Items->Add(L"20"); this->domainUpDownMinute->Items->Add(L"19"); this->domainUpDownMinute->Items->Add(L"18"); this->domainUpDownMinute->Items->Add(L"17"); this->domainUpDownMinute->Items->Add(L"16"); this->domainUpDownMinute->Items->Add(L"15"); this->domainUpDownMinute->Items->Add(L"14"); this->domainUpDownMinute->Items->Add(L"13"); this->domainUpDownMinute->Items->Add(L"12"); this->domainUpDownMinute->Items->Add(L"11"); this->domainUpDownMinute->Items->Add(L"10"); this->domainUpDownMinute->Items->Add(L"9"); this->domainUpDownMinute->Items->Add(L"8"); this->domainUpDownMinute->Items->Add(L"7"); this->domainUpDownMinute->Items->Add(L"6"); this->domainUpDownMinute->Items->Add(L"5"); this->domainUpDownMinute->Items->Add(L"4"); this->domainUpDownMinute->Items->Add(L"3"); this->domainUpDownMinute->Items->Add(L"2"); this->domainUpDownMinute->Items->Add(L"1"); this->domainUpDownMinute->Location = System::Drawing::Point(107, 135); this->domainUpDownMinute->Name = L"domainUpDownMinute"; this->domainUpDownMinute->Size = System::Drawing::Size(70, 20); this->domainUpDownMinute->TabIndex = 14; // // domainUpDownSecond // this->domainUpDownSecond->Items->Add(L"0"); this->domainUpDownSecond->Items->Add(L"59"); this->domainUpDownSecond->Items->Add(L"58"); this->domainUpDownSecond->Items->Add(L"57"); this->domainUpDownSecond->Items->Add(L"56"); this->domainUpDownSecond->Items->Add(L"55"); this->domainUpDownSecond->Items->Add(L"54"); this->domainUpDownSecond->Items->Add(L"53"); this->domainUpDownSecond->Items->Add(L"52"); this->domainUpDownSecond->Items->Add(L"51"); this->domainUpDownSecond->Items->Add(L"50"); this->domainUpDownSecond->Items->Add(L"49"); this->domainUpDownSecond->Items->Add(L"48"); this->domainUpDownSecond->Items->Add(L"47"); this->domainUpDownSecond->Items->Add(L"46"); this->domainUpDownSecond->Items->Add(L"45"); this->domainUpDownSecond->Items->Add(L"44"); this->domainUpDownSecond->Items->Add(L"43"); this->domainUpDownSecond->Items->Add(L"42"); this->domainUpDownSecond->Items->Add(L"41"); this->domainUpDownSecond->Items->Add(L"40"); this->domainUpDownSecond->Items->Add(L"39"); this->domainUpDownSecond->Items->Add(L"38"); this->domainUpDownSecond->Items->Add(L"37"); this->domainUpDownSecond->Items->Add(L"36"); this->domainUpDownSecond->Items->Add(L"35"); this->domainUpDownSecond->Items->Add(L"34"); this->domainUpDownSecond->Items->Add(L"33"); this->domainUpDownSecond->Items->Add(L"32"); this->domainUpDownSecond->Items->Add(L"31"); this->domainUpDownSecond->Items->Add(L"30"); this->domainUpDownSecond->Items->Add(L"29"); this->domainUpDownSecond->Items->Add(L"28"); this->domainUpDownSecond->Items->Add(L"27"); this->domainUpDownSecond->Items->Add(L"26"); this->domainUpDownSecond->Items->Add(L"25"); this->domainUpDownSecond->Items->Add(L"24"); this->domainUpDownSecond->Items->Add(L"23"); this->domainUpDownSecond->Items->Add(L"22"); this->domainUpDownSecond->Items->Add(L"21"); this->domainUpDownSecond->Items->Add(L"20"); this->domainUpDownSecond->Items->Add(L"19"); this->domainUpDownSecond->Items->Add(L"18"); this->domainUpDownSecond->Items->Add(L"17"); this->domainUpDownSecond->Items->Add(L"16"); this->domainUpDownSecond->Items->Add(L"15"); this->domainUpDownSecond->Items->Add(L"14"); this->domainUpDownSecond->Items->Add(L"13"); this->domainUpDownSecond->Items->Add(L"12"); this->domainUpDownSecond->Items->Add(L"11"); this->domainUpDownSecond->Items->Add(L"10"); this->domainUpDownSecond->Items->Add(L"9"); this->domainUpDownSecond->Items->Add(L"8"); this->domainUpDownSecond->Items->Add(L"7"); this->domainUpDownSecond->Items->Add(L"6"); this->domainUpDownSecond->Items->Add(L"5"); this->domainUpDownSecond->Items->Add(L"4"); this->domainUpDownSecond->Items->Add(L"3"); this->domainUpDownSecond->Items->Add(L"2"); this->domainUpDownSecond->Items->Add(L"1"); this->domainUpDownSecond->Location = System::Drawing::Point(199, 135); this->domainUpDownSecond->Name = L"domainUpDownSecond"; this->domainUpDownSecond->Size = System::Drawing::Size(70, 20); this->domainUpDownSecond->TabIndex = 15; // // label6 // this->label6->AutoSize = true; this->label6->Location = System::Drawing::Point(15, 116); this->label6->Name = L"label6"; this->label6->Size = System::Drawing::Size(69, 13); this->label6->TabIndex = 16; this->label6->Text = L"Nach Uhrzeit"; // // label7 // this->label7->AutoSize = true; this->label7->Location = System::Drawing::Point(12, 251); this->label7->Name = L"label7"; this->label7->Size = System::Drawing::Size(43, 13); this->label7->TabIndex = 17; this->label7->Text = L"Uhrzeit:"; // // label8 // this->label8->AutoSize = true; this->label8->Location = System::Drawing::Point(2, 274); this->label8->Name = L"label8"; this->label8->Size = System::Drawing::Size(72, 13); this->label8->TabIndex = 18; this->label8->Text = L"Ausschaltzeit:"; // // labelTimeNow // this->labelTimeNow->AutoSize = true; this->labelTimeNow->Location = System::Drawing::Point(61, 251); this->labelTimeNow->Name = L"labelTimeNow"; this->labelTimeNow->Size = System::Drawing::Size(0, 13); this->labelTimeNow->TabIndex = 19; // // labelTimeOut // this->labelTimeOut->AutoSize = true; this->labelTimeOut->Location = System::Drawing::Point(101, 274); this->labelTimeOut->Name = L"labelTimeOut"; this->labelTimeOut->Size = System::Drawing::Size(0, 13); this->labelTimeOut->TabIndex = 20; // // label9 // this->label9->AutoSize = true; this->label9->Location = System::Drawing::Point(291, 289); this->label9->Name = L"label9"; this->label9->Size = System::Drawing::Size(90, 13); this->label9->TabIndex = 21; this->label9->Text = L"Copyright by TDK"; // // timer1 // this->timer1->Enabled = true; this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick); // // timer2 // this->timer2->Tick += gcnew System::EventHandler(this, &Form1::timer2_Tick); // // timer3 // this->timer3->Tick += gcnew System::EventHandler(this, &Form1::timer3_Tick); // // buttonStop // this->buttonStop->Location = System::Drawing::Point(15, 221); this->buttonStop->Name = L"buttonStop"; this->buttonStop->Size = System::Drawing::Size(75, 23); this->buttonStop->TabIndex = 22; this->buttonStop->Text = L"Abbrechen"; this->buttonStop->UseVisualStyleBackColor = true; this->buttonStop->Click += gcnew System::EventHandler(this, &Form1::buttonStop_Click); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(393, 311); this->Controls->Add(this->buttonStop); this->Controls->Add(this->label9); this->Controls->Add(this->labelTimeOut); this->Controls->Add(this->labelTimeNow); this->Controls->Add(this->label8); this->Controls->Add(this->label7); this->Controls->Add(this->label6); this->Controls->Add(this->domainUpDownSecond); this->Controls->Add(this->domainUpDownMinute); this->Controls->Add(this->domainUpDownHour); this->Controls->Add(this->buttonTime); this->Controls->Add(this->buttonTimer); this->Controls->Add(this->label5); this->Controls->Add(this->label4); this->Controls->Add(this->label3); this->Controls->Add(this->label2); this->Controls->Add(this->textBoxSecond); this->Controls->Add(this->textBoxMinute); this->Controls->Add(this->textBoxHour); this->Controls->Add(this->label1); this->Icon = (cli::safe_cast<System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon"))); this->MaximizeBox = false; this->Name = L"Form1"; this->Text = L"Windows - Zeitausschalter"; this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void buttonTimer_Click(System::Object^ sender, System::EventArgs^ e) { int stdIn; int minIn; int secIn; dayEnd = 0; hourEnd = 0; minEnd = 0; secEnd = 0; try { stdIn = Convert::ToInt32(textBoxHour->Text); } catch (FormatException^) { textBoxHour->Text = "0"; } try { minIn = Convert::ToInt32(textBoxMinute->Text); } catch (FormatException^) { textBoxMinute->Text = "0"; } try { secIn = Convert::ToInt32(textBoxSecond->Text); } catch (FormatException^) { textBoxSecond->Text = "0"; } if(stdIn >= 24 || minIn >= 60 || secIn >= 60){ MessageBox::Show("Fehler, bitte auf Überschreitungen bei der Eingabe achten!"); } TimeCalculate(stdIn,minIn,secIn); timer3->Start(); } private: System::Void buttonTime_Click(System::Object^ sender, System::EventArgs^ e) { int stdIn; int minIn; int secIn; dayEnd = 0; hourEnd = 0; minEnd = 0; secEnd = 0; try { stdIn = Convert::ToInt32(domainUpDownHour->Text); } catch (FormatException^) { domainUpDownHour->Text = "0"; } try { minIn = Convert::ToInt32(domainUpDownMinute->Text); } catch (FormatException^) { domainUpDownMinute->Text = "0"; } try { secIn = Convert::ToInt32(domainUpDownSecond->Text); } catch (FormatException^) { domainUpDownSecond->Text = "0"; } labelTimeOut->Text = stdIn + " : " + minIn + " : " + secIn; timer2->Start(); } private: System::Void buttonStop_Click(System::Object^ sender, System::EventArgs^ e) { timer2->Stop(); timer3->Stop(); dayEnd = 0; hourEnd = 0; minEnd = 0; secEnd = 0; labelTimeOut->Text = ""; } private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) { TimeRenew(); } private: System::Void timer2_Tick(System::Object^ sender, System::EventArgs^ e) { std::time_t Zeit; std::tm *jetzt; Zeit = std::time(0); jetzt = std::localtime(&Zeit); if(hourEnd == jetzt->tm_hour && minEnd == jetzt->tm_min && secEnd == jetzt->tm_sec && dayEnd == jetzt->tm_mday){ System::Diagnostics::Process::Start("shutdown.exe /s /t 1"); System::Diagnostics::Process::Start("shutdown.exe -s -t 1"); } } private: System::Void timer3_Tick(System::Object^ sender, System::EventArgs^ e) { std::time_t Zeit; std::tm *jetzt; Zeit = std::time(0); jetzt = std::localtime(&Zeit); if (hourEnd == jetzt->tm_hour && minEnd == jetzt->tm_min && secEnd == jetzt->tm_mon){ System::Diagnostics::Process::Start("shutdown.exe /s /t 1"); System::Diagnostics::Process::Start("shutdown.exe -s -t 1"); } } private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { } }; }so jetzt erst mal BIG THX an Scorcher!
und euch allen auch mal für die erste hilfe!
und ´bitte helft mir jetzt auch!