Current location - Recipe Complete Network - Catering franchise - Find a complete VB source code that can be compiled.
Find a complete VB source code that can be compiled.
Establish a Form 1 form and a Module 1 module.

Put a Timer 1 control in the Form 1.

Form code:

private

statement

function

Setkusops

liberation movement

"User 32"

(ByVal

x

be like

Long,

ByVal

y

be like

Dragon)

be like

long

private

submarine

Form_Load()

Me. visible

=

wrong

App。 The task is visible

=

wrong

Timer 1. space

=

10000

Add hook

end

submarine

private

submarine

Form _ Uninstall (Cancel

be like

Integer)

Delhook

end

submarine

private

submarine

Timer 1 _ Timer ()

Setkusops

50,

50

end

submarine

Module code

public

statement

function

SetWindowsHookEx

liberation movement

"User 32"

another name

" SetWindowsHookExA "

(ByVal

idHook

be like

Long,

ByVal

lpfn

be like

Long,

ByVal

hmod

be like

Long,

ByVal

dwThreadId

be like

Dragon)

be like

long

public

statement

function

Decoupling WindowsHookEx

liberation movement

"User 32"

(ByVal

hHook

be like

Dragon)

be like

long

public

statement

function

GetKeyState

liberation movement

"User 32"

(ByVal

nVirtKey

be like

Dragon)

be like

integer

public

statement

function

CallNextHookEx

liberation movement

"User 32"

(ByVal

hHook

be like

Long,

ByVal

ncode

be like

Long,

ByVal

wParam

be like

Long,

lParam

be like

Any)

be like

long

public

statement

submarine

Copy memory

liberation movement

"Kernel 32"

another name

" RtlMoveMemory "

(lpv test

be like

Any,

ByVal

lpvSource

be like

Long,

ByVal

cbCopy

be like

Dragon)

public

type

Keyboard message

vKey

be like

long

Virtual code

(and

& ampHFF)

Ski

be like

long

Scan code

a kind of ancient banner

be like

long

Key: 128

Elevator: 0

time

be like

long

Window running time

end

type

public

constant

WH _ keyboard _LL

=

13

public

constant

Alt_Down

=

& ampH20

-

news

public

constant

HC_ACTION

=

public

constant

HC_SYSMODALOFF

=

five

public

constant

HC_SYSMODALON

=

four

Keyboard message

public

constant

WM_KEYDOWN

=

& ampH 100

public

constant

WM_KEYUP

=

& ampH 10 1

public

constant

WM_SYSKEYDOWN

=

& ampH 104

public

constant

WM_SYSKEYUP

=

& ampH 105

public

keyMsg

be like

Keyboard message

public

lHook( 1)

be like

long

Keyboard hook

private

function

CallKeyHookProc(ByVal

password

be like

Long,

ByVal

wParam

be like

Long,

ByVal

lParam

be like

Dragon)

be like

long

dimmed

lKey

be like

long

dimmed

strKeyName

be like

line

*

255

dimmed

Character length (stringlength)

be like

long

if

password

=

HC_ACTION

then

Copy memory

keyMsg,

lParam,

LenB (key message)

choose

situation

wParam

situation

WM_SYSKEYDOWN,

WM_KEYDOWN,

WM_SYSKEYUP,

WM_KEYUP:

if

keyMsg.sKey

=

32

then

CallKeyHookProc

=

1

Shielding d key

end

choose

end

if

if

password

& lt& gt

then

CallKeyHookProc

=

CallNextHookEx(0,

Code,

wParam,

lParam)

end

if

end

function

Mounting hook

public

submarine

AddHook()

Keyboard hook

lHook(0)

=

SetWindowsHookEx(WH _ keyboard _LL

address

CallKeyHookProc,

App.hInstance,

0)

end

submarine

Remove the hook

public

submarine

Delhook ()

Decoupling WindowsHookEx

lHook(0)

end

submarine