[C++] 4Story

09/04/2011 13:06 oOSevenDeluxeOo#1
Hallo,
Ich schreibe momentan ein Auto MSG Programm.
Das eigentliche Programm ist schon fertig und läuft auch.
Allerdings nur bei Editor,...
Ich weiß nur noch nicht was ich falsch mache es muss In 4Story Game eingebunden werden.
Ich habe es in einer Windows Form Anwendung.
Quelltet:
PHP Code:
#pragma once
#include <windows.h>
#include <iostream.h>

HWND VictWind;
VictWind=FindWindow(null,"4Story");
SetForegroundWindow(VictWind);

namespace 
AutoMSGC {

    
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>
    /// Zusammenfassung für Form1
    /// </summary>
    
public ref class Form1 : public System::Windows::Forms::Form
    
{
    public:
        
Form1(void)
        {
            
InitializeComponent();
            
//
            //TODO: Konstruktorcode hier hinzufügen.
            //
        
}

    protected:
        
/// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        
~Form1()
        {
            if (
components)
            {
                
delete components;
            }
        }
    private: 
System::Windows::Forms::Button^  button1;
    protected: 
    private: 
System::Windows::Forms::Button^  button2;
    private: 
System::Windows::Forms::RichTextBox^  richTextBox1;
    private: 
System::Windows::Forms::Timer^  timer1;
    private: 
System::Windows::Forms::Label^  label1;



    private: 
System::ComponentModel::IContainer^  components;

    private:
        
/// <summary>
        /// Erforderliche Designervariable.
        /// </summary>


#pragma region Windows Form Designer generated code
        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        
void InitializeComponent(void)
        {
            
this->components = (gcnew System::ComponentModel::Container());
            
this->button1 = (gcnew System::Windows::Forms::Button());
            
this->button2 = (gcnew System::Windows::Forms::Button());
            
this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox());
            
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
            
this->label1 = (gcnew System::Windows::Forms::Label());
            
this->SuspendLayout();
            
// 
            // button1
            // 
            
this->button1->Location System::Drawing::Point(12203);
            
this->button1->Name L"button1";
            
this->button1->Size System::Drawing::Size(7523);
            
this->button1->TabIndex 0;
            
this->button1->Text L"Start";
            
this->button1->UseVisualStyleBackColor true;
            
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
            
// 
            // button2
            // 
            
this->button2->Location System::Drawing::Point(93203);
            
this->button2->Name L"button2";
            
this->button2->Size System::Drawing::Size(7523);
            
this->button2->TabIndex 1;
            
this->button2->Text L"Stop";
            
this->button2->UseVisualStyleBackColor true;
            
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
            
// 
            // richTextBox1
            // 
            
this->richTextBox1->Location System::Drawing::Point(1225);
            
this->richTextBox1->Name L"richTextBox1";
            
this->richTextBox1->Size System::Drawing::Size(50393);
            
this->richTextBox1->TabIndex 2;
            
this->richTextBox1->Text L"";
            
// 
            // timer1
            // 
            
this->timer1->Interval 10000;
            
this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
            
// 
            // label1
            // 
            
this->label1->AutoSize true;
            
this->label1->Location System::Drawing::Point(129);
            
this->label1->Name L"label1";
            
this->label1->Size System::Drawing::Size(7113);
            
this->label1->TabIndex 3;
            
this->label1->Text L"Hier der Text:";
            
// 
            // Form1
            // 
            
this->AutoScaleDimensions System::Drawing::SizeF(613);
            
this->AutoScaleMode System::Windows::Forms::AutoScaleMode::Font;
            
this->ClientSize System::Drawing::Size(527238);
            
this->Controls->Add(this->label1);
            
this->Controls->Add(this->richTextBox1);
            
this->Controls->Add(this->button2);
            
this->Controls->Add(this->button1);
            
this->Name L"Form1";
            
this->Text L"Auto MSG | By SevenDeluxe";
            
this->ResumeLayout(false);
            
this->PerformLayout();

        }
#pragma endregion
    
private: System::Void button1_Click(System::Object^  senderSystem::EventArgs^  e) {
                 
timer1->Start ();
             }
    private: 
System::Void button2_Click(System::Object^  senderSystem::EventArgs^  e) {
                 
timer1->Stop ();
             }
    private: 
System::Void timer1_Tick(System::Object^  senderSystem::EventArgs^  e) {
                 
SendKeys::Send ("{Enter}");
                 
SendKeys::Send (richTextBox1->Text);
                 
SendKeys::Send ("{Enter}");
             }
};

Dann ist da nochwas..
Bei "#include <iostream.h>" kommt eine Fehlermeldung:
PHP Code:
Fehler    1    error C1083Datei (Include) kann nicht geöffnet werden"iostream.h"No such file or directory 
Wenn ich nur "#include <iostream>" nehme kommen gleich 6 Fehlermeldungen...:
PHP Code:
Fehler    1    error C4430Fehlender Typspezifizierer int wird angenommenHinweis"default-int" wird von C++ nicht unterstützt
PHP Code:
Fehler    2    error C2040'VictWind''int' unterscheidet sich von 'HWND' in Bezug auf die Anzahl vorgenommener Dereferenzierungen 
PHP Code:
Fehler    3    error C2065'null'nichtdeklarierter Bezeichner 
PHP Code:
Fehler    4    error C4430Fehlender Typspezifizierer int wird angenommenHinweis"default-int" wird von C++ nicht unterstützt
PHP Code:
Fehler    5    error C2365"SetForegroundWindow"Erneute Definitionvorherige Definition war "Funktion"
PHP Code:
Fehler    6    error C2440'Initialisierung''HWND' kann nicht in 'int' konvertiert werden 
Grüße SevenDeluxe
09/04/2011 14:26 Logexx#2
Quote:
<iostream.h>
ist veraltet!
benutze einfach nur
Quote:
<iostream>
EDIT : Sry es geht ja auch nicht mit <iostream>
Bei Fehler 3 musst du anstatt null, einfach NULL schreiben ;)
09/04/2011 14:44 oOSevenDeluxeOo#3
Was muss ich dann nehmen wen beides nicht geht???
Habe das mit der NULL geändert es kommen immer noch 6 Fehler
Neuer quelltext:
PHP Code:
#pragma once
#include <windows.h>
#include <iostream>

HWND VictWind;
VictWind=FindWindow(NULL,"4Story");
SetForegroundWindow(VictWind);

namespace 
AutoMSGC {

    
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>
    /// Zusammenfassung für Form1
    /// </summary>
    
public ref class Form1 : public System::Windows::Forms::Form
    
{
    public:
        
Form1(void)
        {
            
InitializeComponent();
            
//
            //TODO: Konstruktorcode hier hinzufügen.
            //
        
}

    protected:
        
/// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        
~Form1()
        {
            if (
components)
            {
                
delete components;
            }
        }
    private: 
System::Windows::Forms::Button^  button1;
    protected: 
    private: 
System::Windows::Forms::Button^  button2;
    private: 
System::Windows::Forms::RichTextBox^  richTextBox1;
    private: 
System::Windows::Forms::Timer^  timer1;
    private: 
System::Windows::Forms::Label^  label1;



    private: 
System::ComponentModel::IContainer^  components;

    private:
        
/// <summary>
        /// Erforderliche Designervariable.
        /// </summary>


#pragma region Windows Form Designer generated code
        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        
void InitializeComponent(void)
        {
            
this->components = (gcnew System::ComponentModel::Container());
            
this->button1 = (gcnew System::Windows::Forms::Button());
            
this->button2 = (gcnew System::Windows::Forms::Button());
            
this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox());
            
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
            
this->label1 = (gcnew System::Windows::Forms::Label());
            
this->SuspendLayout();
            
// 
            // button1
            // 
            
this->button1->Location System::Drawing::Point(12203);
            
this->button1->Name L"button1";
            
this->button1->Size System::Drawing::Size(7523);
            
this->button1->TabIndex 0;
            
this->button1->Text L"Start";
            
this->button1->UseVisualStyleBackColor true;
            
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
            
// 
            // button2
            // 
            
this->button2->Location System::Drawing::Point(93203);
            
this->button2->Name L"button2";
            
this->button2->Size System::Drawing::Size(7523);
            
this->button2->TabIndex 1;
            
this->button2->Text L"Stop";
            
this->button2->UseVisualStyleBackColor true;
            
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
            
// 
            // richTextBox1
            // 
            
this->richTextBox1->Location System::Drawing::Point(1225);
            
this->richTextBox1->Name L"richTextBox1";
            
this->richTextBox1->Size System::Drawing::Size(50393);
            
this->richTextBox1->TabIndex 2;
            
this->richTextBox1->Text L"";
            
// 
            // timer1
            // 
            
this->timer1->Interval 10000;
            
this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
            
// 
            // label1
            // 
            
this->label1->AutoSize true;
            
this->label1->Location System::Drawing::Point(129);
            
this->label1->Name L"label1";
            
this->label1->Size System::Drawing::Size(7113);
            
this->label1->TabIndex 3;
            
this->label1->Text L"Hier der Text:";
            
// 
            // Form1
            // 
            
this->AutoScaleDimensions System::Drawing::SizeF(613);
            
this->AutoScaleMode System::Windows::Forms::AutoScaleMode::Font;
            
this->ClientSize System::Drawing::Size(527238);
            
this->Controls->Add(this->label1);
            
this->Controls->Add(this->richTextBox1);
            
this->Controls->Add(this->button2);
            
this->Controls->Add(this->button1);
            
this->Name L"Form1";
            
this->Text L"Auto MSG | By ";
            
this->ResumeLayout(false);
            
this->PerformLayout();

        }
#pragma endregion
    
private: System::Void button1_Click(System::Object^  senderSystem::EventArgs^  e) {
                 
timer1->Start ();
             }
    private: 
System::Void button2_Click(System::Object^  senderSystem::EventArgs^  e) {
                 
timer1->Stop ();
             }
    private: 
System::Void timer1_Tick(System::Object^  senderSystem::EventArgs^  e) {
                 
SendKeys::Send ("{Enter}");
                 
SendKeys::Send (richTextBox1->Text);
                 
SendKeys::Send ("{Enter}");
             }
};

09/04/2011 17:06 cooler7878#4
Gott verdammt da schreibt man einmal einen Pseudocode und. Die Leute kopieren es und wundern sich über Fehler.Man ruft Funktionen auch in der Main Funktion und nicht in einer Headerdatei auf.Des Weiteren wundere ich mich ueber deinen Konstruktor der Konstruktor muss doch den gleichen namen wie die Klasse haben. Weiteres zum c4430 ErrorCode [Only registered and activated users can see links. Click Here To Register...]