|
You last visited: Today at 19:17
Advertisement
[Help]C# Postmessage send string
Discussion on [Help]C# Postmessage send string within the .NET Languages forum part of the Coders Den category.
04/22/2012, 10:46
|
#1
|
elite*gold: 0
Join Date: Aug 2010
Posts: 94
Received Thanks: 14
|
[Help]C# Postmessage send string
hey mates,
need some help i know how to send keys:
Code:
PostMessage(p.MainWindowHandle, WM_KEYDOWN, (int)Keys.A,1);
Code:
PostMessage(p.MainWindowHandle, WM_KEYUP, (int)Keys.A,1);
but i want to send a string to the window i tryed :
Code:
foreach (char item in text)
{
PostMessage(p.MainWindowHandle,WM_KEYDOWN,Convert.Int32(item), 1);
PostMessage(p.MainWindowHandle, WM_KEYUP, Convert.Int32(item), 1);
System.Threading.Thread.Sleep(10);
}
but i wont work
if i send "test" i get "tt55" in my window :S
pls help
|
|
|
04/27/2012, 13:17
|
#2
|
elite*gold: 5
Join Date: Mar 2008
Posts: 460
Received Thanks: 436
|
If you want to send text to notepad try this:
Code:
//WM_PASTE = 0x302
//Copy the String/Text what you want to Clipboard,
//PostMessage Send you Clipboard via Paste to the Handle what you choose
Clipboard.SetText(text);
PostMessage(p.MainWindowHandle, WM_PASTE, 0, 0);
Do not forget the "thanks" button if this is what you wan't
|
|
|
04/27/2012, 13:45
|
#3
|
elite*gold: 0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,810
|
why would u need to copy the text to ur clipboard before..? kinda senseless
|
|
|
04/28/2012, 11:21
|
#4
|
elite*gold: 5
Join Date: Mar 2008
Posts: 460
Received Thanks: 436
|
Because PostMessage only let you push 1 button,
so with this method you only have to call the method 1 time's.
If you have a better solution you can post it here, but dont spam in this thread! he want help and no spam!
|
|
|
04/28/2012, 11:26
|
#5
|
elite*gold: 0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,810
|
There are many ways on how to use Post-/SendMessage.
|
|
|
04/29/2012, 11:28
|
#6
|
elite*gold: 0
Join Date: May 2011
Posts: 5,084
Received Thanks: 3,458
|
Code:
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, IntPtr lParam);
SendMessage(Handle, 0x000C, 0, Marshal.StringToHGlobalAuto("Message goes here"));
If I remember right, 0x000C was WM_SENDTEXT.
That's what I'm using.
|
|
|
04/29/2012, 11:56
|
#7
|
elite*gold: 0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,810
|
Well, its VB.NET but that should not be a big problem..
And yes, 0xC is WM_SETTEXT
|
|
|
04/29/2012, 15:42
|
#8
|
elite*gold: 0
Join Date: Aug 2010
Posts: 94
Received Thanks: 14
|
Quote:
thats not a good solution but the only one works with PostMessage
-----------
hm tryed it wont work dunno why :S
Quote:
public static void sendstring(string text, string prozess)
{
Process[] procs = Process.GetProcessesByName(prozess);
proccID = procs[0].Id;
Process p = Process.GetProcessById(proccID);
Clipboard.SetText(text);
PostMessage(p.MainWindowHandle, WM_PASTE, 0, 0);
}
|
|
|
|
04/29/2012, 16:12
|
#9
|
elite*gold: 0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,810
|
Any error message?
|
|
|
04/30/2012, 11:05
|
#10
|
elite*gold: 5
Join Date: Mar 2008
Posts: 460
Received Thanks: 436
|
on which process do you want to send text?
if it's a mmorpg there are much more problem's. Test it with notepad
|
|
|
05/01/2012, 11:43
|
#11
|
elite*gold: 0
Join Date: Aug 2010
Posts: 94
Received Thanks: 14
|
i want to send it to the login from League of Legends.
Sending keys with
Quote:
works great but i wanna login background
|
|
|
05/03/2012, 09:28
|
#12
|
elite*gold: 5
Join Date: Mar 2008
Posts: 460
Received Thanks: 436
|
That is what i mean,
MMORPG's are very different from normal Applications like notepad or textpad etc...
with Send/PostMessage you will have no success, try another method, like funktion hooking or send login packets etc...
Or you make your LoL 1 Sek to the aktiv form an send all keystrokes within 1 second and reaktivate the form where you are before. Because it's only the login :/
|
|
|
05/03/2012, 10:18
|
#13
|
elite*gold: 0
Join Date: Aug 2010
Posts: 94
Received Thanks: 14
|
my problem is iam able to send keys like thw 2th method in my first post ...
u know any good methodes ? my u can help me :O
---------------- edit --------------------
think u are right but just because if the window is not active the textbox ist also not aktive
|
|
|
05/03/2012, 11:18
|
#14
|
elite*gold: 5
Join Date: Mar 2008
Posts: 460
Received Thanks: 436
|
yes, you don't have a focus to the Nickname field or the Password field.
You can try to Set this via ProcessRead/Write Memory,
and then only send the "Return" for Login.
i don't play LoL so i can't help you exactly only can give you "tips"
|
|
|
|
Similar Threads
|
PostMessage UDF
06/27/2017 - AutoIt - 48 Replies
Benötigt wird mindestens AutoIt v3.3.8.1.
Die UDF beinhaltet 9 Funktionen:
_PostMessage_Send($hWnd, $Key, $Delay = 10)
_PostMessage_SendDown($hWnd, $Key, $Delay = 10)
_PostMessage_SendUp($hWnd, $Key, $Delay = 10)
_PostMessage_Click($hWnd, $X = -1, $Y = -1, $Button = "left", $Clicks = 1, $Delay = 10)
_PostMessage_ClickDown($hWnd, $X = -1, $Y = -1, $Button = "left")
_PostMessage_ClickUp($hWnd, $X = -1, $Y = -1, $Button = "left")
_PostMessage_ClickDrag($hWnd, $X1, $Y1, $X2, $Y2, $Button...
|
[VB08]String in String mit mehreren Funden
08/08/2011 - .NET Languages - 6 Replies
Hey,
bin gerade auf ein Problem gestoßen, an dem ich mir seit 3 Stunden die Zähne ausbeiße.
Ich will eine Funktion schreiben, die der _StringBetween Funktion von AutoIt gleich ist. _StringBetween gibt in einem Array alle Strings zwischen zwei SubStrings und dem ganzen String aus. Die Ausgabe bei
_StringBetween("<h1>test1</h1>&l t;h1>test2</h1>", "<h1>", "</h1>") wäre also idealer Weiße ein Array (x = "test1", x = "test2")...
da man in VB08 kein Array returnen kann, komme ich aber einfach...
|
Storm hack with .send | .send lesson Part 1
08/21/2010 - Kal Online - 30 Replies
This is lesson 1 of what useful things .send can do =P
later i'll post some more nice things
I know that kocp dont allow kalhackit... but u can have some fun with it on servers without kocp
or if you smart enough you can do it on servers without kalhackit or even on int if you even smarter :P
First of all you need KalHackIt that works on private server with sniffing
(Download attached... thx to syntex for the snif.ini add)
|
Play sound via Packet Send?? [Question String Packet]
07/14/2010 - CO2 Private Server - 5 Replies
Yow im trying to figure out why i cant play music with the string packet
What im doin is;
MyChar.Client.SendPacket(Game.Packet.String(MyCha r.UID, 20, Splitter));
My Packet is:
public byte String(long CharId, byte Type, string name)
|
[osds] problem send item & send weapon
11/12/2009 - Dekaron Private Server - 3 Replies
Hello i have 2 problems with osds control panel
when i try to send weapon i have no more weapon available i cant choice i have nothing but i can send armor succesfully and my second problem is send item when i try to send item the browser say Login Error, Please login again.anyone can be fix that please?
i post screenshots http://panzer.power-heberg.com/itembug.JPG
http://panzer.power-heberg.com/noweapon.JPG
|
All times are GMT +2. The time now is 19:17.
|
|