KrYpT0n's reply was good to explain it, but I just wanna be a bitch and explain it further because I actually understood the code.
PHP Code:
handle = FindWindow("FLYFF");
if( SetForegroundWindow(handle) )
{
SendKeys.Send("{ENTER}");
SendKeys.Send("{S}{T}{U}{F}{F}");
SendKeys.Send("{ENTER}");
// give focus back to your application
}
That's what I focused on, because that's doing the major work. The DLL import just makes it possible.
PHP Code:
handle = FindWindow("FLYFF");
Find the window "FLYFF", which "FLYFF" is, most of the time, the window name of the game.
PHP Code:
if( SetForegroundWindow(handle) )
{
SendKeys.Send("{ENTER}");
SendKeys.Send("{S}{T}{U}{F}{F}");
SendKeys.Send("{ENTER}");
// give focus back to your application
}
Pretty self explanatory.
If the window is found, as well as brings the window to the Foreground, meaning in the front, then send the key, {ENTER}, being the enter key, activating the chat window, {S}{T}{U}{F}{F}, being the things sent in the chat, and the last {ENTER} being it sending it to the server, being interpreted as either chat or command, and by your tool, being GM command.
/Like a boss