08-23-2005 06:01 AM
08-23-2005 06:14 AM
08-23-2005 06:26 AM
Thanks for your reply,
I like to find out how to generate keystrokes using this library.
I`ve added a 100ms time delay.
Ferry
08-23-2005 06:42 AM
08-23-2005 07:05 AM
@tst wrote:
- You should not use a DBL in the function prototype if the type is DWORD. At least in my computer it doesn't seem to like it.
- The function does not toggle the light, but the key. This means that you need to push and release the button twice. To push the button you should wire 0 into all the parameters and to release you should wire 2 into the dwFlags parameter. You can also search for a VI called Simulate Keyboard which will already have an enum with the list of all the keys.
Thanks, got it working. Where did you find to wire a 2 into the dwFlags parameter?
08-23-2005 07:54 AM
I looked inside the VI I mentioned, which I have on my computer. It comes from a collection of tools called LV Toolbox.
One of the problems with calling windows API functions is that they use string constants which have numeric values and in LV you can only use the numeric value. To find it, you have to look for the constant definition in the header file, but if you don't have the header file in your system you will have to search for it online, which can be a bit of a hassle.
08-23-2005 08:36 AM
Two problems I find when using the user32.dll or any other win32 type dll are matching complex data structures (like handles to object with pointers in them) and passing constants which are defined by bit-fields which are often defined in a header file with pre-processor directives. These constant aliases are not easily accessible and need to be looked up in the header file. Is there an automated method of dealing with these problems. Other than these issues, working with the user32.dll is not all so bad, just wish there was prototype information built into the dll and configures the dll node appropriately without the time consuming process of looking through the documentation. Tst's suggestion of using the event structures are a good one since they are simple and quick to use especially for capturing keystrokes. The event structure also should be more machine and OS independent than using the windows API directly.
Paul
08-23-2005 08:53 AM
Paul, the suggestion wasn't mine, and it only helps when capturing keystrokes, not when you want to simulate them.
I agree that it would be nice to have the CLFN automatically configure, but I don't think the DLL holds that data and without it I don't see how it can be done.