Solved

How to use the GetKeyState function.

Posted on 1997-11-21
1
635 Views
Last Modified: 2012-05-04
Hi,

I am in dispair. I have tried to use the GetKeyState function but it gives me the error 'Actual parameter not matching formal var parameter. Here an fragment of my code:


var
KeyStateBuf:TByteArray;
pKeyStateBuf:PByte;


begin

pKeyStateBuf:=addr(KeyStateBuf);
GetKeyStateBuf(pKeyStateBuf);

end.

This doesn't work and I don't know why. Could anybody give me a solution for that terrific problem, please !!

Thanks a lot.

Oli
0
Comment
Question by:novowi
1 Comment
 
LVL 3

Accepted Solution

by:
mirek071497 earned 100 total points
Comment Utility
This is definition :

function GetKeyState(nVirtKey: Integer): SHORT; stdcall;


so you need to use integer to retrive the virtual key code.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now