fehlerbereinigung von übergabeparametern etc



  • hi...
    ich hab die erfahrung gemacht, dass hier ne gute community am start is,
    darum wende ich mich mit meinem prob gleich am zu euch...
    ich hab hier n kleine sprog geschrieben, welchen tastatureinagben simuliert...
    nur hab ich in der "neuen" version die mit funktionen ausgelagert ist haufenweise fehler (14)... ich würde euch bitten mir bei meinem problem(en) zu helfen.
    mfg chaoz

    //Author: Thomas 'Chaoz' Krueger
    //Homepage: FXGaming.de
    //Contact: Chaoz@esl.eu
    
    #include <windows.h>
    #include <ctime>
    #include <string>
    using namespace std;
    
    int myrnd(int);
    void mykeypress(string, int);
    void mykeypress2(string, string, int);
    void mymsg();
    int main()
    {
    	Sleep(10000); // wait 10s
    
    while(true)
    {
    	mykeypress2(VK_LMENU, 'I', 1);		//Tastenkombi ALT+I delay -> 1s - 5s 
    	mymsg();							//Msg ausgeben
    	mykeypress2(VK_LMENU, 'Q', 1);		//Tastenkombi ALT+Q delay -> 1s - 5s 
    	mykeypress('B', 1);				   	//Tastenkombi ALT+I delay -> 1s - 5s 
    	mykeypress(VK_SPACE, 0);			//Tastenkombi ALT+I delay -> 0s
    
    }		//end while
    
    	return 0;
    }
    int myrnd(int x)
    {
    	int i = 0;
    	srand(time(NULL));
    	i = rand()%5 +1;	// rnd 1-5
    	i *= 1000;			//rnd *1000 -> 1s-5s
    	i *= x;
    	return i; 
    }
    void mykeypress(string abc, int mysleep) {
    		keybd_event(abc, 0xb8, KEYEVENTF_EXTENDEDKEY | 0, 0 ); 
    		keybd_event(abc, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 ); 
    		Sleep(myrnd(mysleep));
    }
    void mykeypress(string abc, string xyz, int mysleep) {
    		keybd_event(abc, 0xb8, KEYEVENTF_EXTENDEDKEY | 0, 0 ); 
    		keybd_event(xyz, 0xb8, KEYEVENTF_EXTENDEDKEY | 0, 0 ); 
    		keybd_event(abc, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
    		keybd_event(xyz, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
    		Sleep(myrnd(mysleep));
    }
    void mymsg{
    		char buf[] = {'l', 'e', 'a', 'v', 'e', ' ', 'p', 'l', 'z'}; // "leave plz"
    		char buf1[] = {'g', 'l', ' ', 'n', ' ', 'h', 'f', ' ', ' '}; // "gl n hf  "
    		char buf2[] = {'a', 'b', 'u', 's', 'e', 'r', ' ', ':', 'p'}; // "abuser :p"
    
    		mykeypress(ENTER, 0);	//Enter
    
    	for (int y = 0; y < 10; y++)
    		{
    		mykeypress(toupper(buf[y]), 0);
    		}	
    		mykeypress(ENTER, 0);	//Enter
    		if(rand()%3 < 2)
    		{			
    		mykeypress(ENTER, 0);	//Enter
    		for (int y = 0; y < 10; y++)
    		{
    		mykeypress(toupper(buf1[y]), 0);
    		}
    		else if(rand()%3 < 3)
    		{
    		mykeypress(ENTER, 0);	//Enter
    			for (int y = 0; y < 10; y++)
    			{
    			mykeypress(toupper(buf2[y]), 0);
    			}
    		mykeypress(ENTER, 0);	//Enter
    		}
    };
    


  • Hallo

    nur hab ich in der "neuen" version die mit funktionen ausgelagert ist haufenweise fehler (14)...

    Ahja... und was für welche?

    bis bald
    akari



  • die hier:

    lb1.cpp(20) : error C2664: 'mykeypress2' : cannot convert parameter 1 from 'const int' to 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
            No constructor could take the source type, or constructor overload resolution was ambiguous
    lb1.cpp(22) : error C2664: 'mykeypress2' : cannot convert parameter 1 from 'const int' to 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
            No constructor could take the source type, or constructor overload resolution was ambiguous
    lb1.cpp(23) : error C2664: 'mykeypress' : cannot convert parameter 1 from 'const char' to 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
            No constructor could take the source type, or constructor overload resolution was ambiguous
    lb1.cpp(24) : error C2664: 'mykeypress' : cannot convert parameter 1 from 'const int' to 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
            No constructor could take the source type, or constructor overload resolution was ambiguous
    lb1.cpp(40) : error C2664: 'keybd_event' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'unsigned char'
            No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    lb1.cpp(41) : error C2664: 'keybd_event' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'unsigned char'
            No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    lb1.cpp(45) : error C2664: 'keybd_event' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'unsigned char'
            No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    lb1.cpp(46) : error C2664: 'keybd_event' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'unsigned char'
            No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    lb1.cpp(47) : error C2664: 'keybd_event' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'unsigned char'
            No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    lb1.cpp(48) : error C2664: 'keybd_event' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'unsigned char'
            No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    lb1.cpp(51) : error C2182: 'mymsg' : illegal use of type 'void'
    lb1.cpp(51) : error C2373: 'mymsg' : redefinition; different type modifiers
            lb1.cpp(13) : see declaration of 'mymsg'
    lb1.cpp(51) : error C2239: unexpected token '{' following declaration of 'mymsg'
    lb1.cpp(80) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.
    
    lb1.exe - 14 error(s), 0 warning(s)
    

    ich würde mich echt freuen wenn ihr mir helfen könntet!



  • Hallo

    mykeypress2(VK_LMENU, 'I', 1);
    ...
    void mykeypress2(string, string, int);
    

    VK_LMENU ist nunmal kein std::string, sondern eine Integer-Konstante

    bis bald
    akari



  • joar das hat man mir heute auch schon auf arbeit denn erzählt ^^
    also wie amch ich es jetzt, DASS

    -ich KEINE funktion überladen muss
    -ich für die funktion ALLE tastatureingaben simulieren kann

    -> weitesgehend weiss ich jetzt, dass vm_xxx n dqord is,
    nur is die frage woher ich die einzelnen dwords für alle tastaturkeys bekomm. 😞
    ( gibtz da nich ne tabelle oda so?)



  • update:

    ich hab "string" durch "dword" ersetzt,
    nur kennt er "dword" nich ... was muss ich includen etc damit das läuft? 😞

    danke im voraus!



  • aus der windows api (windows.h bzw windefs.h)

    typedef unsigned long DWORD;
    

    schreibweise beachten - großbuchstaben, wie so ziemlich alles aus der windows api - dann klappts auch.


Anmelden zum Antworten