A problem with getasynckeystate
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts
Page 1 of 1
Hello fellow Codenstuff members, i made this topic today to possibly get some help from you.
Here is the error i keep getting:
GetAsyncKeyState' has unbalanced the stack.
Here is the error ed code:
If (GetAsyncKeyState(113)) Then
sorry for wasting your time but i just don't get what i'm doing wrong, it used to work before.
Edit:
sorry here's the full error
PInvokeStackImbalance was detected
Message: A call to PInvoke function 'MouseRecord!MouseRecord.Form1::GetAsyncKeyState' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Edit:
What i'm thinking is that 2010 doesn't support it and i need 2008.
OS: Vista
Here is the error i keep getting:
GetAsyncKeyState' has unbalanced the stack.
Here is the error ed code:
If (GetAsyncKeyState(113)) Then
sorry for wasting your time but i just don't get what i'm doing wrong, it used to work before.
Edit:
sorry here's the full error
PInvokeStackImbalance was detected
Message: A call to PInvoke function 'MouseRecord!MouseRecord.Form1::GetAsyncKeyState' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Edit:
What i'm thinking is that 2010 doesn't support it and i need 2008.
OS: Vista
Should be:
Code: Select all
Or you can just use the key name:GetAsyncKeyState((113))
Code: Select all
GetAsyncKeyState(Keys.F2)
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Its nothing to do with version of VB or your OS. Neither will Cody's code help. You should declare it like this:
Code: Select all
<DllImport("user32.dll")> _
Public Shared Function GetAsyncKeyState(ByVal vKey As System.Windows.Forms.Keys) As Short
End Function
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023