The MASM Forum

General => The Workshop => Topic started by: felipe on July 24, 2018, 08:08:17 AM

Title: Old? funny api function...
Post by: felipe on July 24, 2018, 08:08:17 AM
Here it is a totally useless program using this funny (and "old" from microsoft documentation perspective?) function. The program simulates the keystroke of the windows left key. And that's all... :biggrin:
Press the key and releases 5 times...The weird is that actually the loop is made for 10 times, but whatever i change to the loop the results to our eyes of the effects of the press-release sequence are always the same: if the loop is for 8 times, then we see 4 times, if the loop is 6 times, then we see 3 times. Always the half and no matter where i put the sleep function or how many times or to how many delay time... :idea:
So if you know why this is the behaviour, please tell me... :idea:  :bgrin:

Well the program was made also to show another way of doing screen captures. From microsoft documentation about the function  :idea::
QuoteAn application can simulate a press of the PRINTSCREEN key in order to obtain a screen snapshot and save it to the Windows clipboard. To do this, call keybd_event with the bVk parameter set to VK_SNAPSHOT, and the bScan parameter set to 0 for a snapshot of the full screen or set bScan to 1 for a snapshot of the active window.

So come on zedd what are you waiting... :idea: (Just kidding please do whatever you want...)  :lol:.

It works ok in my windows 8.1...Also i did a program to turn on and off (yes another useless program  :redface:) the caps lock key light and worked just fine. Actually this "old?" function has a good potential  :P.
Title: Re: Old? funny api function...
Post by: felipe on July 24, 2018, 08:51:33 AM
Please you have to admit this is funny... :biggrin:
Here it is (source and .exe as before too) a little more elaborated program that uses keystroke simulations to do this: winkey+r (execute) and then c,m,d and enter...All in some slow motion so you can watch the ghost program to write all this for you...So the cmd will open...pretty funny right?  :bgrin:

Works fine in my windows 8.1  :idea:.

Title: Re: Old? funny api function...
Post by: zedd151 on July 24, 2018, 09:34:50 AM
Quote from: felipe on July 24, 2018, 08:08:17 AM
So come on zedd what are you waiting... :idea: (Just kidding please do whatever you want...)  :lol:.

Seems like you have got too much time on your hands.   :lol:
Are you trying to get me to finish the Screen Capture program?  :bgrin:

I looked at both of them, short and sweet.

What do you call someone that has a twitch in one eyelid?
Quote from: felipe on July 24, 2018, 08:51:33 AMwinkey
:lol: :badgrin: :lol: :badgrin: :lol:

I couldn't resist.  :biggrin:
Title: Re: Old? funny api function...
Post by: felipe on July 24, 2018, 09:58:47 AM
That's not fair zedd, since english is not my native language i didn't understand your joke...:(
Please explain it to me  :greensml:
Title: Re: Old? funny api function...
Post by: zedd151 on July 24, 2018, 10:08:07 AM
Quote from: felipe on July 24, 2018, 09:58:47 AM
That's not fair zedd, since english is not my native language i didn't understand your joke...:(
I'm sorry, felipe.

Closing one eye lid means that a person is "winking" at someone.

Kind of like this:   ;)

So to make fun of someone who has a twitching eye lid, we can call him/her "winkey"
Now you make me look bad for making fun.

twitch: "involuntary movement"
Title: Re: Old? funny api function...
Post by: hutch-- on July 24, 2018, 10:47:11 AM
The API "keybd_event" is in fact a very useful one and it allows you to do a number of useful things. Some years ago I did a "SendKeys" app that I use to reconfigure Winfile (the old File manager) every time some crap heap resets its settings and the only way to do it was through sending key strokes to the app. If anyone is interested I will see if i can find it.
Title: Re: Old? funny api function...
Post by: felipe on July 24, 2018, 11:26:54 AM
zedd, don't you worry, that's a good joke  :biggrin:

Hutch  :t
Title: Re: Old? funny api function...
Post by: hutch-- on July 24, 2018, 02:55:07 PM
Here is a toy I use to fix Winfile when the settings get changed. Code is very simple and generally works OK.
Title: Re: Old? funny api function...
Post by: aw27 on July 24, 2018, 06:47:47 PM
There is also a technique to capture behind, hidden and invisible windows.
I had a program that did that. (http://www.snapfiles.com/screenshots/awwinscope.htm) I had issues with Microsoft lawyers for using the name Windows, I changed the name, but they continued to bug me, so I discontinued it. This was some 14 years ago, may be I will reissue it again.  :biggrin:
Title: Re: Old? funny api function...
Post by: hutch-- on July 24, 2018, 07:11:48 PM
AW,

Knock it up in 64 bit and think of a new name for it, sounds like an interesting toy.
Title: Re: Old? funny api function...
Post by: aw27 on July 24, 2018, 11:24:24 PM
Quote from: hutch-- on July 24, 2018, 07:11:48 PM
Knock it up in 64 bit and think of a new name for it, sounds like an interesting toy.

I will see if is worthwhile.  :t