Game uses Dinput8 for keyboard input for everything other than textboxs *and pressing enter to show /send chat*
You can code a Dinput hook that lets you simulate keys, it also has an array of bytes that it reads the state of keyboard into. Prehaps set them to 0x80 and the key is pressed maybe.
Or you can use PostMessage i think with some weird settings I can't remember what they were.
If using on anti hacks they will prevent this method so go with injected dll and dinput fun times...
Here is one I prepared eariler...
D3DSendKeys.h
Code:
#ifndef __D3DSENDKEYS_H__
#define __D3DSENDKEYS_H__
// for a full list of keys see
// http://msdn.microsoft.com/en-us/library/ee418641.aspx
// or dinput.h
#include <dinput.h>
#pragma comment(lib, "dinput.lib")
void ClickLeftMouse();
void PressKey(WORD scan);
#endif
D3DSendKeys.cpp
Code:
#include "D3DSendKeys.h"
void ClickLeftMouse()
{
INPUT inp;
inp.type = INPUT_MOUSE;
inp.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
SendInput(1, &inp, sizeof(INPUT));
Sleep(20);
memset((void*)&inp, 0, sizeof(INPUT));
inp.type = INPUT_MOUSE;
inp.mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(1, &inp, sizeof(INPUT));
}
void PressKey(WORD scan)
{
INPUT inp[2];
memset(inp,0,sizeof(INPUT));
inp[0].type = INPUT_KEYBOARD;
inp[0].ki.dwFlags = KEYEVENTF_SCANCODE;
inp[0].ki.time = 1;
inp[1] = inp[0];
inp[1].ki.dwFlags |= KEYEVENTF_KEYUP;
inp[0].ki.wScan = inp[1].ki.wScan = scan;
SendInput(2, inp, sizeof(INPUT));
}
But of course thats C++ not C#
As for learning API's check out pinvoke and msdn maybe
good luck :P
Edit:
Back before I switched to C++ for game hacks, I had made Map Fun in C#.
Check out frmMain.cs here,

I may have had some basic sendkey functionality working to use skills or pickup items.
But I can't remember 100%..