Valhalla Legends Forums Archive | .NET Platform | C++ .NET

AuthorMessageTime
iNsaNe
Sorry guys about the topic name, I just didn't know what to name it.

I have a question -- how can I create a program that reacts when a user types something into the Warcraft III chat line? Preferably C++.NET
December 2, 2007, 11:32 PM
Hell-Lord
I don't think you can do that because it is almost impossible to determine when other people are typing on there computers. Unless you mean your own computer or on a network?
December 3, 2007, 12:04 AM
BreW
[quote author=Hell-Lord link=topic=17200.msg175174#msg175174 date=1196640264]
I don't think you can do that because it is almost impossible to determine when other people are typing on there computers. Unless you mean your own computer or on a network?
[/quote]
... ehh..
I'm pretty sure he means on his own computer. There are a few ways, really (I'm not sure what chat line you're talking about...). If it's out of game, on battle.net, you could just hook that textbox, and if you mean ingame, you could use GetAsyncKeyState to detect presses of the enter button, if the game is active and the warcraft 3 hwnd == GetFocus. Sorry it's win32 api, I doubt there are any special classes in C++ .NET for this.
December 3, 2007, 1:01 AM
iNsaNe
yeah that's what I thought, I've just never done anything like this before. An example would be wc3banlist, like when the user types "/fromall"in the warcraft chat line it determines the origin of every player in the custom game. I'm just making a simple program that will return ladder records when the user types their name into the chat line.
December 3, 2007, 2:54 AM
BreW
Are you sure hooking the socket and intercepting the commands sent wouldn't be an even better idea?
December 3, 2007, 3:09 AM
Myndfyr
Why are you wasting your time with C++/CLI?

If you're going to use a .net language, IMO, you should be using one of the ones created *for* .net (C#, VB).  C++/CLI was introduced for control developers who had a significant investment already in C++/ActiveX controls.  Doing .net stuff in C++ sucks balls.
December 3, 2007, 3:15 AM
Hell-Lord
It would still be suitable to write C++ code in the VS2005 IDE because the compiler is better and more standarized right?
December 3, 2007, 3:24 AM
St0rm.iD
[quote author=Hell-Lord link=topic=17200.msg175190#msg175190 date=1196652245]
It would still be suitable to write C++ code in the VS2005 IDE because the compiler is better and more standarized right?
[/quote]

The C++ code generator, which is the important part to have "better" and "standardized" is entirely different between C++ and C++.NET. The C++.NET compiler is real young.
December 3, 2007, 4:38 PM
iNsaNe
hey thanks guys i got it working and i appreciate the help but is there any better way of recording keystrokes other than GetAsyncKeyState? Sometimes when i go to type the letters quickly it scrambles all the letters around..
December 4, 2007, 6:11 AM
l2k-Shadow
[quote author=iNsaNe link=topic=17200.msg175216#msg175216 date=1196748697]
hey thanks guys i got it working and i appreciate the help but is there any better way of recording keystrokes other than GetAsyncKeyState? Sometimes when i go to type the letters quickly it scrambles all the letters around..
[/quote]

set your timer to 1-10 milliseconds. i don't think anyone could type faster than that. ;p
December 4, 2007, 6:32 AM
Barabajagal
When you use GetAsyncKeyState, what return values are you checking for?
December 4, 2007, 6:32 AM
Myndfyr
[quote author=l2k-Shadow link=topic=17200.msg175218#msg175218 date=1196749935]
[quote author=iNsaNe link=topic=17200.msg175216#msg175216 date=1196748697]
hey thanks guys i got it working and i appreciate the help but is there any better way of recording keystrokes other than GetAsyncKeyState? Sometimes when i go to type the letters quickly it scrambles all the letters around..
[/quote]

set your timer to 1-10 milliseconds. i don't think anyone could type faster than that. ;p
[/quote]
Incidentally, it is well documented that Windows timers are only accurate to about 10ms unless using a high resolution timer.
December 4, 2007, 4:23 PM
BreW
[quote author=l2k-Shadow link=topic=17200.msg175218#msg175218 date=1196749935]
[quote author=iNsaNe link=topic=17200.msg175216#msg175216 date=1196748697]
hey thanks guys i got it working and i appreciate the help but is there any better way of recording keystrokes other than GetAsyncKeyState? Sometimes when i go to type the letters quickly it scrambles all the letters around..
[/quote]

set your timer to 1-10 milliseconds. i don't think anyone could type faster than that. ;p
[/quote]

It'd be an even better idea to set it to 150-175 ms. That's the delay that I would personally use for continuously checking key states.
December 4, 2007, 8:45 PM

Search