public void Press(Keys key)
{
WindowsAPI.PostMessage(this.Handle, 260u, new UIntPtr((uint)key), UIntPtr.Zero);
}
public void Release(Keys key)
{
WindowsAPI.PostMessage(this.Handle, 261u, new UIntPtr((uint)key), UIntPtr.Zero);
}
public void gepardkey(Keys key)
{
this.Press(key);
Thread.Sleep(10);
this.Release(key);
}
private void ragnarokgepard_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
bool flag2 = this.currentHP / this.maxHP *100.0<Convert.ToDouble(this.numHPPercent);
if (flag2)
{
this._windowsAPI.gepardkey(Keys.F1);
}
bool flag3 = this.currentSP / this.maxSP *100.0<Convert.ToDouble(this.numSPPercent);
if (flag3)
{
this._windowsAPI.gepardkey(Keys.F2);
}
}
I got this error http://prntscr.com/lsel0z someone can help me? I already use timer and private void autopots()
but this error still popping
this trainer for ragnarok privateserver
i dont know how you have defined the PostMessage API but here my definition:
const UInt32 WM_KEYDOWN = 0x0100;//256
const UInt32 WM_KEYDUP = 0x0101;//257
[DllImport("user32.dll")]
static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam);
and the syntax for keydown for example:(key is virtual key)
WindowsAPI.PostMessage(this.Handle, WM_KEYDOWN, (int)key, 0);
you are using 260 for value of Keydown and 261 for Keyup.....!!??
this._windowsAPI
is null. Make sure that it's initialized in the constructor or when it's declared.
I assume that you've copied the gepardkey
method from the WindowsAPI class. If you didn't copy it and it's in the same class as the ragnarokgepard_ProgressChanged
method then you can replace the the ragnarokgepard_ProgressChanged
method with this one:
private void ragnarokgepard_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
bool flag2 = this.currentHP / this.maxHP *100.0<Convert.ToDouble(this.numHPPercent);
if (flag2)
{
gepardkey(Keys.F1);
}
bool flag3 = this.currentSP / this.maxSP *100.0<Convert.ToDouble(this.numSPPercent);
if (flag3)
{
gepardkey(Keys.F2);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.