|
You last visited: Today at 17:48
Advertisement
SendMessage() Positionenproblem
Discussion on SendMessage() Positionenproblem within the C/C++ forum part of the Coders Den category.
03/26/2016, 21:44
|
#1
|
elite*gold: 51
Join Date: Nov 2008
Posts: 486
Received Thanks: 69
|
SendMessage() Positionenproblem
Guten Abend,
ich habe ein Problem, seitdem ich mit einer Schleife ein Programm starte, hwnd catche und versuche Befehle zusenden.
Bevor ich diese Schleife eingebaut habe, lief alles reibungslos. Ich gehe stark davon aus, das es sich hier um die Postionen handelt, die das Problem verursachen. :/
Code:
do {
system(("\"" + path + "/S4 Bot/start.bat\"").c_str());
Sleep(4000);
cout << "Versuche FensterHWND zu finden..." << endl;
handle = ::GetForegroundWindow();
if (!handle) {
cout << "FensterHWND wurde nicht gefunden! Wiederhole..." << endl;
}
Sleep(1000);
} while (handle == NULL);
//SHOW HANDLE TITLE
char title[255];
GetWindowTextA(handle, (LPSTR)title, 255);
cout << "FensterHWND gefunden: " << title << endl;
GetWindowRect(handle, &fenster);
SwitchToThisWindow(handle, true);
//SET DATA
cout << "Fokussiere E-Mail-/Benutzernamefeld..." << endl;
SendMessage(handle, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(mouseACC.x - fenster.left, mouseACC.y - fenster.top));
SendMessage(handle, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(mouseACC.x - fenster.left, mouseACC.y - fenster.top));
cout << "Trage E-Mail-/Benutzername ein!" << endl;
Sleep(500);
for (int i = 0; i < benutzername.size(); i++) {
if (isupper(benutzername.at(i))) {
keybd_event(VK_SHIFT, 0, 0, 0);
keybd_event(VkKeyScan(benutzername.at(i)), 0, 0, 0);
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
}
else {
keybd_event(VkKeyScan(benutzername.at(i)), 0, 0, 0);
}
}
Sleep(500);
cout << "Fokussiere Passwortfeld..." << endl;
SendMessage(handle, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(mousePW.x - fenster.left, mousePW.y - fenster.top));
SendMessage(handle, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(mousePW.x - fenster.left, mousePW.y - fenster.top));
cout << "Trage Passwort ein!" << endl;
Sleep(500);
for (int i = 0; i < passwort.size(); i++) {
if (isupper(passwort.at(i))) {
keybd_event(VK_SHIFT, 0, 0, 0);
keybd_event(VkKeyScan(passwort.at(i)), 0, 0, 0);
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
}
else {
keybd_event(VkKeyScan(passwort.at(i)), 0, 0, 0);
}
}
Sleep(500);
//PRESS SUBMIT
cout << "Druecke Submit-Button..." << endl;
SendMessage(handle, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(mouseSUBMIT.x - fenster.left, mouseSUBMIT.y - fenster.top));
SendMessage(handle, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(mouseSUBMIT.x - fenster.left, mouseSUBMIT.y - fenster.top));
Sleep(1000);
keybd_event(VK_EXECUTE, 0, 0, 0);
Vielleicht findet Ihr ja den Fehler.
Mit freundlichen Grüßen
Halbax
|
|
|
03/29/2016, 07:22
|
#2
|
elite*gold: 51
Join Date: Nov 2008
Posts: 486
Received Thanks: 69
|
//solved
|
|
|
 |
Similar Threads
|
C# - SendMessage/PostMessage
12/21/2013 - CO2 Programming - 3 Replies
Hello, I have recently started to toy around with the idea of sending a mouse click, or other events, to a conquer client that is minimized, or just not in focus. I have been using Spy++ to help along in all the messages the client receives and what not. I have got it kind of working and was wondering if anyone here could give me a hand.
//WM_PARENTNOTIFY-SendMessage-ParentWindow
bool seven = MouseClickHandler.SendMessage(new IntPtr(0x004F04CA), (int)0x0210, new IntPtr(0x00000201), new...
|
Sendmessage Tabcontrol
12/14/2013 - .NET Languages - 0 Replies
Hallöchen
Ich habe momentan ein Problem
und zwar will ich mit Hilfe von Sendmessage ein Tab in einen anderen Programm wechseln
Als erstest hatte ich versucht die Tabpage wie ein Button zu verwenden und einfach mit dem Code anzuklicken
SendMessage(recpacketcontrol, BM_Click, 0, 0)
|
SRO SendMessage API
02/26/2012 - SRO Coding Corner - 5 Replies
Hello.
I want make simple clicker on vSRO.
but I can't do so would only click on SRO
I know I need to use SendMessage API but I do not know how to do it
Can someone show me it on this code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
|
[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,...
|
All times are GMT +1. The time now is 17:49.
|
|