المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : GetAsyncKeyState - help with dynamic link library



C++ Programming
04-01-2009, 06:50 PM
I want to use the function GetAsyncKeyState(VK_LBUTTON) to test the state of the left mouse button.
Internet info page at:
http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx
said that function uses user32.dll and import library User32.lib with the function declared in Winuser.h, include Windows.h

I haven't written code that uses dynamic link libraries. I am using Microsoft Visual C++ Version 6.0 and Windows XP

If I simply code

#include "Windows.h"

int state;

state = GetAsyncKeyState(VK_LBUTTON);

the code compiles but will always return zero as the value of state of the mouse button.
How do I use the dynamic link library in my simple program, so that the state of the mouse button can be read by my program?
Thanks!