News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

16 bit source

Started by Magnum, February 15, 2013, 08:14:27 AM

Previous topic - Next topic

Magnum

When I saw the post about scan codes, I started looking for my 16 bit source code.

It had code showing the key press codes and some other code had a ctrl break handler.

I recall one source code that Joseph Powers wrote and I think it was in 1985.

I have looked on pen drives and cds.

The source code also had tasm and tlink.

I'll start at the old forum and start getting some of the pieces.

Andy

Getting old is ....
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

it was fairly simple in DOS days
you could re-vector interrupt 1Bh and take over the "Break Interrupt"
unfortunately, that doesn't fly under win32   :P

Magnum

I believe it still works under cmd.

I know TSR's work.

Bummer that flashing keyboard lights doesn't work in cmd anymore.

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

that may be for a different reason
that is, if it worked with an XT, it probably won't work with an AT class machine
the keyboard interfaces are quite different
so - it may be do-able with some different code
i seem to recall it can be done - i just don't remember how   ::)

Magnum

save as .vbs.

I am looking for the 16 bit code for this.

Set wshShell =wscript.CreateObject("WScript.Shell")
do
wscript.sleep 100
wshshell.sendkeys "{CAPSLOCK}"
wshshell.sendkeys "{SCROLLLOCK}"
wshshell.sendkeys "{NUMLOCK}"
loop
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave


Magnum

I will take a look at it.

Found this in an old post.  :t

Kinda like some freeware authors who later changed their minds.
Course that's like trying to put black mamba snakes back in the bag. :-)
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

give this a try
i can't test it, as my keyboard has no lights - lol
        .NOLIST
        .XCREF
        INCLUDE \masm32\include\masm32rt.inc
        .586
        .LIST

;---------------------------------

;MOUSEINPUT    STRUCT    ;24 bytes
;  _dx         dd ?
;  _dy         dd ?
;  mouseData   dd ?
;  dwFlags     dd ?
;  time        dd ?
;  dwExtraInfo dd ?
;MOUSEINPUT    ENDS
;
;KEYBDINPUT    STRUCT    ;16 bytes
;  wVk         dw ?
;  wScan       dw ?
;  dwFlags     dd ?
;  time        dd ?
;  dwExtraInfo dd ?
;KEYBDINPUT    ENDS
;
;HARDWAREINPUT STRUCT    ;8 bytes
;  uMsg        dd ?
;  wParamL     dw ?
;  wParamH     dw ?
;HARDWAREINPUT ENDS

INPUT         STRUCT    ;28 bytes
  dwType      dd ?
  UNION
    mi MOUSEINPUT    <>
    ki KEYBDINPUT    <>
    hi HARDWAREINPUT <>
  ENDS
INPUT         ENDS

;---------------------------------

        .DATA

kia LABEL INPUT
dd INPUT_KEYBOARD                         ;dwType, control key down
dw VK_CAPITAL                             ;wVk = VK_CAPITAL (caps lock)
dw 0                                      ;wScan
dd 0                                      ;dwFlags = key down
dd 0                                      ;time
dd 0                                      ;dwExtraInfo
dd 0,0                                    ;pad

dd INPUT_KEYBOARD                         ;dwType, control key up
dw VK_CAPITAL                             ;wVk = VK_CAPITAL (caps lock)
dw 0                                      ;wScan
dd KEYEVENTF_KEYUP                        ;dwFlags = key up
dd 0                                      ;time
dd 0                                      ;dwExtraInfo
dd 0,0                                    ;pad

dd INPUT_KEYBOARD                         ;dwType, control key down
dw VK_NUMLOCK                             ;wVk = VK_NUMLOCK (num lock key)
dw 0                                      ;wScan
dd 0                                      ;dwFlags = key down
dd 0                                      ;time
dd 0                                      ;dwExtraInfo
dd 0,0                                    ;pad

dd INPUT_KEYBOARD                         ;dwType, control key up
dw VK_NUMLOCK                             ;wVk = VK_NUMLOCK (num lock key)
dw 0                                      ;wScan
dd KEYEVENTF_KEYUP                        ;dwFlags = key up
dd 0                                      ;time
dd 0                                      ;dwExtraInfo
dd 0,0                                    ;pad

dd INPUT_KEYBOARD                         ;dwType, control key down
dw VK_SCROLL                              ;wVk = VK_SCROLL (scroll lock key)
dw 0                                      ;wScan
dd 0                                      ;dwFlags = key down
dd 0                                      ;time
dd 0                                      ;dwExtraInfo
dd 0,0                                    ;pad

dd INPUT_KEYBOARD                         ;dwType, control key up
dw VK_SCROLL                              ;wVk = VK_SCROLL (scroll lock key)
dw 0                                      ;wScan
dd KEYEVENTF_KEYUP                        ;dwFlags = key up
dd 0                                      ;time
dd 0                                      ;dwExtraInfo
dd 0,0                                    ;pad





; dd INPUT_KEYBOARD                         ;dwType, "g" key down
; dw 0                                      ;wVk
; dw 47h                                    ;wScan = "g"
; dd KEYEVENTF_SCANCODE                     ;dwFlags = key down
; dd 0                                      ;time
; dd 0                                      ;dwExtraInfo
; dd 0,0                                    ;pad
;
; dd INPUT_KEYBOARD                         ;dwType, "g" key up
; dw 0                                      ;wVk
; dw 47h                                    ;wScan = "g"
; dd KEYEVENTF_SCANCODE or KEYEVENTF_KEYUP  ;dwFlags = key up
; dd 0                                      ;time
; dd 0                                      ;dwExtraInfo
; dd 0,0                                    ;pad


        .CODE

_main   PROC

    mov     ecx,20
    .repeat
        push    ecx
        INVOKE  Sleep,100
        INVOKE  SendInput,6,offset kia,sizeof INPUT
        pop     ecx
        dec     ecx
    .until ecx==0
    INVOKE  ExitProcess,0

_main   ENDP

        END     _main

Magnum

I will have to do it later.

I got a blue screen and will post a crash dump analysis in the orphanage.

Andy
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

MichaelW

At least under Windows 2000 the older keybd_event function will work, and it's a simple two-liner, no structure required:

    invoke keybd_event, VK_CAPITAL, NULL, NULL, NULL
    invoke keybd_event, VK_CAPITAL, NULL, KEYEVENTF_KEYUP, NULL

Well Microsoft, here's another nice mess you've gotten us into.

dedndave

that IS easier Michael   :t

the code i posted above was thrown together
it could be cleaned up a lot and the struct could be a re-used local

Magnum

Thanks Michael.

keybd_event is pretty handy.

invoke keybd_event, VK_SNAPSHOT, NULL, NULL, NULL
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org