Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 19:45

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C++ SendMEssage Problem

Discussion on C++ SendMEssage Problem within the C/C++ forum part of the Coders Den category.

Reply
 
Old 02/11/2010, 19:02   #31
 
Σternαl.'s Avatar
 
elite*gold: 20
Join Date: Dec 2009
Posts: 1,850
Received Thanks: 484
Bitte helf mir einfach weiter D:
Du hast mich jetzt sowas von verwirrt, gib mir einfach pls
den fertigen Source und erklärs mir, wenn du so nett wärest
Danke.

Und bitte bleib so nett wie du jetzt warst und denk daran,
dass ich noch in den Anfängen des Programmierens bin
Σternαl. is offline  
Old 02/11/2010, 19:10   #32


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,904
Received Thanks: 25,394
Quote:
Originally Posted by Adroxxx View Post
Nein. NULL ist nicht 0. (null)
NULL ist eine Referenz. Bei C++ weist es darauf hin, dass ein Pointer niergens hinzeigt. Bei Java zB. das kein Objekt referenziert wird.
Aber wenn man sich die Definition ansieht:

Code:
 #define NULL 0
Liegt es doch nahe, zu glauben, es sei das selbe
Aber ich frage mich, wie eine Funktion dann beim Parameter zwischen 0 und NULL unterscheiden kann...
Oder würde bei
Code:
bool foo(int i)
{
      if(i==NULL)
            return true;
      if(i==0)
            return false;
}
foo(NULL); und foo(0); etwas anderes returned werden? o.O
Wie geht das denn dann, wenn es als 0 defined ist?
Also ich habe es auch so gelernt, wie flo geschrieben hat.
(und Stroustrup meint auch, das NULL Makro wäre nicht sehr schön^^)
Quote:
Die Aussage, dass er NULL ahnung hat, war einfach nur ein wortspiel.
Also so weit kann ich auch noch denken
Quote:
Originally Posted by flo8464 View Post
NULL ist alter C-Stil, es ist völlig egal ob 0 oder NULL.
Aber es ist durchaus beliebter Stil Zeiger mit NULL auf 0 zu setzen, Integer mit 0.
Ist mir ja klar, so habe ich es auch aus Stroustrups Buch gelernt.

Quote:
Originally Posted by FooFightah View Post
Bitte helf mir einfach weiter D:
Du hast mich jetzt sowas von verwirrt, gib mir einfach pls
den fertigen Source und erklärs mir, wenn du so nett wärest
Danke.

Und bitte bleib so nett wie du jetzt warst und denk daran,
dass ich noch in den Anfängen des Programmierens bin
Ähm nunja...nun schließe ich mich auch an:

C&P hilft dir nicht weiter, lern erst die Grundlagen oder denk mal logisch nach
Er hat nichts wirklich kompliziertes gesagt, wenn man die Grundlagen kennt.
MrSm!th is offline  
Old 02/11/2010, 19:11   #33
 
elite*gold: 20
Join Date: Sep 2006
Posts: 1,100
Received Thanks: 184
@flo
bist du dir sicher das der lparam den KeyCode nimmt?
Also laut msdn müsste wparam den Keycode nehmen, schau mal hier und hier
Bot_interesierter is offline  
Old 02/11/2010, 19:12   #34
 
Σternαl.'s Avatar
 
elite*gold: 20
Join Date: Dec 2009
Posts: 1,850
Received Thanks: 484
Compiliert einwandfrei, aber im Spiel tut sich immernoch nichts oO
Σternαl. is offline  
Old 02/11/2010, 19:15   #35
 
flo8464's Avatar
 
elite*gold: 0
Join Date: Nov 2008
Posts: 161
Received Thanks: 38
Uhhh, ja, kann gut sein, ich habe nur kurz MSDN aufgeschlagen und da wurde nicht darauf
eingegangen.

Ich habe nie irgendwelche Keystrokes geschickt, mit C++ injected man einfach seine DLL und ruft entsprechende Engine-Funktionen auf. Wenn man auf OutOfProcess steht bietet sich sowieso eher Python oder C# an...
flo8464 is offline  
Old 02/11/2010, 19:17   #36
 
Σternαl.'s Avatar
 
elite*gold: 20
Join Date: Dec 2009
Posts: 1,850
Received Thanks: 484
Und wie sieht der Source jetzt aus, wenn lParam keine KeyCodes nimmt?
Σternαl. is offline  
Old 02/11/2010, 19:23   #37


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,904
Received Thanks: 25,394
Lies doch die Texte Dann nimmste den wParam dafür
MrSm!th is offline  
Old 02/11/2010, 19:34   #38
 
Σternαl.'s Avatar
 
elite*gold: 20
Join Date: Dec 2009
Posts: 1,850
Received Thanks: 484
Also da, wo dann NULL steht (ist doch wParam) auch keystroke hin und bei keystroke NULL?
SendMessage(wHandle, WM_KEYDOWN, NULL, keystroke);
↓↓
SendMessage(wHandle, WM_KEYDOWN, keystroke, NULL); ?

und

LPARAM keystroke = LOWORD(VkKeyScanA(character));
↓↓
WPARAM keystroke = LOWORD(VkKeyScanA(character)); ?
Σternαl. is offline  
Old 02/11/2010, 19:41   #39
 
flo8464's Avatar
 
elite*gold: 0
Join Date: Nov 2008
Posts: 161
Received Thanks: 38
Ja. Und ersetz mal LOWORD durch LOBYTE
flo8464 is offline  
Old 02/11/2010, 19:51   #40
 
Σternαl.'s Avatar
 
elite*gold: 20
Join Date: Dec 2009
Posts: 1,850
Received Thanks: 484
Nope, es rührt sich immernoch nichts.
PHP Code:
#include <iostream> 
#include <windows.h> 

using namespace std

HWND wHandle FindWindow(0,L"Guild Wars");
void sendKeystroke(char character

    
WPARAM keystroke LOBYTE(VkKeyScanA(character)); 

    
SendMessage(wHandleWM_KEYDOWNkeystrokeNULL); 
    
SendMessage(wHandleWM_CHARkeystrokeNULL); 
    
Sleep(20); 
    
SendMessage(wHandleWM_KEYUPkeystrokeNULL); 
}

int main() 

        
cout << "Starteee!!!!" << endl
 
        
HWND wHandle FindWindow(0,L"Guild Wars"); 
        if(!
wHandle
        { 
            
cout << "Starte das verdammte Spiiiieeeelll!!!!"  
            
<< " Errorcode: " << GetLastError() << '\n' << endl
        } 
     
        else 
        { 
            
cout << "WindowHandle: " << wHandle << endl;

            while(
wHandle)
            {
                
sendKeystroke('w');
            } 
        } 

Σternαl. is offline  
Old 02/11/2010, 19:56   #41

 
Adroxxx's Avatar
 
elite*gold: 15
Join Date: Nov 2005
Posts: 13,021
Received Thanks: 5,323
@smith:
ja stimmt, in c++ ist das etwas unsauber da ist NULL mit 0 definiert. In java aber nicht :P ^^
Adroxxx is offline  
Old 02/11/2010, 20:01   #42
 
Σternαl.'s Avatar
 
elite*gold: 20
Join Date: Dec 2009
Posts: 1,850
Received Thanks: 484
Adroxxx kannst du mir vllt helfen?
Hab jetzt nochmal was geändert, aber mein Chara läuft nicht.
PHP Code:
#include <iostream> 
#include <windows.h> 

using namespace std

HWND wHandle FindWindow(0,L"Guild Wars");
void sendKeystroke(char character

    
WPARAM keystroke LOBYTE(VkKeyScanA(character)); 

    
SendMessage(wHandleWM_KEYDOWNkeystrokeNULL); 
    
SendMessage(wHandleWM_CHARkeystrokeNULL); 
    
Sleep(20); 
    
SendMessage(wHandleWM_KEYUPkeystrokeNULL); 
}

int main() 

        
cout << "Starteee!!!!" << endl
 
        
HWND wHandle FindWindow(0,L"Guild Wars"); 
        if(!
wHandle
        { 
            
cout << "Starte das verdammte Spiiiieeeelll!!!!"  
            
<< " Errorcode: " << GetLastError() << '\n' << endl
        } 
     
        else 
        { 
            
cout << "WindowHandle: " << wHandle << endl;

            while(
wHandle)
            {
                
sendKeystroke('w');
            } 
        } 

Σternαl. is offline  
Old 02/11/2010, 20:09   #43
 
flo8464's Avatar
 
elite*gold: 0
Join Date: Nov 2008
Posts: 161
Received Thanks: 38
Und die Moral der Geschichte:

DirectX-Spiele haben keinen Message-Loop sondern nutzen Direct Input was bedeutet dass deine ganzen SendMessage Calls ins Leere gehen, wie von mir bereits auf Seite 2 angedeutet.
flo8464 is offline  
Old 02/11/2010, 20:14   #44
 
Σternαl.'s Avatar
 
elite*gold: 20
Join Date: Dec 2009
Posts: 1,850
Received Thanks: 484
Und welche Befehle triggern bei DirectInput?
PostMessage oder wie kann ich das jetzt anders machen?
€dit: Hmm, auf Wiki stand jetzt, dass DirectInput die Windows
Messages umgeht und direkt auf die Hardware geht (oder so ähnlich).
Heißt das jetzt, dass ich mit C++ nicht weiter komme, muss ich das über AutoIt machen?
Σternαl. is offline  
Old 02/11/2010, 20:32   #45
 
flo8464's Avatar
 
elite*gold: 0
Join Date: Nov 2008
Posts: 161
Received Thanks: 38
Nein, du kommst jediglich mit SendMessage nicht weiter.
Die Idee, dass du mit AutoShit mehr machen könntest als mit C++ ist idiotisch, vergiss die wieder.

Hier mal der Source von AutoIt:
Viel Spaß beim Lesen. Sieh es als Übung an.

Edit: hier der ganze Source:
flo8464 is offline  
Reply

Tags
c++, problem, sendmessage


Similar Threads Similar Threads
C++ SendMessage Problem
08/02/2010 - C/C++ - 1 Replies
Also ich versuche gerade in C++ einen kleinen Spammer zu programmieren habe aber leider ein Problem. Mein Code: #include <iostream> #include <windows.h> #include <string> using namespace std;
delphi sendmessage
07/27/2010 - General Coding - 3 Replies
hallo leute ich hab mal eine frage ob mir jemand kurz erläutern könnte wie ich mit sendmessage eine mausbewegung in einem minimierten fenster ausgebe ich habe embarcadero rad studio 2010 hier ist der bisherige "source": uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm)
[Help] C# SendMessage()
05/11/2010 - CO2 Programming - 19 Replies
I'm currenty trying to use the SendMessage Function with CO. According to msdn I need to use this: static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); My question is: How do I find the hWnd? What are the wParam and lParam? And what can I use as wParam and lParam? Any help will be greatly appreciated.
sendmessage?
12/26/2008 - CO2 Programming - 0 Replies
just wondering how it works in C# tried few tutorials with notepad in it and it doesnt send the letters/close it even it finds the window this is how i got it so far (pretty much copypasted, just to see how it works...) private static extern IntPtr FindWindow(string winClass, string WinName); private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); private static extern IntPtr PostMessage(IntPtr hWnd,...
how do i sendmessage a password box
05/11/2007 - Conquer Online 2 - 11 Replies
HI, I'm trying to sendmessage the password to the password box. It gives me the *** in the box but when i click the enter button it gives me the wrong password error. any help would be appreciated



All times are GMT +2. The time now is 19:45.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.