Go to Sleep

Franlkin makes a note on how to go to
Franklin Sleep en VFP (Sleep in VFP)

It brings up a very important reminder of working with DLLs.

The code was this:
Declare integer Sleep in "kernel32" Long dwMilliseconds

Sleep(200)

The trick? VFP Developers get so used to being case-insensitive if you define it as

Declare integer sleep ...

It won't work. API calls are case-sensitive.

It was a handy post too - I was just getting ready to use

INKEY(5,"H")

What's that last "H" do? It hides the cursor.

A lot of older code coming from DOS days just used to say INKEY(2) - and you would see a cursor sitting there on the screen. UGLY!

With INKEY, you can set the second parameter to "S" - to show the cursor, H to hide it, M to wait for a mouseclick or E to expand a keyboard macro.

But with the Sleep call, you don't need to worry about it - and rely on the basic Windows API call.

Thanks Franklin!

Comments

Popular Posts