04-30-2008, 12:34 PM
The following functions and macros worked under 2.16 with windows 2000, but not now under 2.2.1.5 and XP. Any help would be much appreciated.
This 1st macro creates a simple dialog, but the settings for screen position and list height have no effect.
mac "SetListHeight" "" "" 220
sel list("Kjør_Skanix_Network_Manager[]-------------------------------------[]Send_en_melding[]-------------------------------------[]Åpen_VNC_Viewers_Bare_Overvåke[]Åpen_VNC_Viewers[]Lukk_VNC_Viewers[]Andre vedlikeholds oppgaver[]Lukk Internet Explorer vinduer" "" " H v a v i l d u ? ?" 0 520 20 0 1) ;; position (x y), timeout, default, flag (1=activate window)
case 0 end
case 1 goto Kjør_Skanix_Network_Manager
case 2 goto Velg_oppgave
case 3 Oppgave = "Send_en_melding"
case 4 goto Velg_oppgave
case 5 Oppgave = "Åpen_VNC_Viewers_Bare_Overvåke"
case 6 Oppgave = "Åpen_VNC_Viewers"
case 7 goto Lukk_VNC_Viewers
case 8 Oppgave = "Andre_Vedlikeholds_Oppgaver"
case 9 Oppgave = "Lukk_Internet_Explorer_Vinduer"
----------------------------------------
; I am also including the "SetListHeight" function which may need modifying.
function height
;Sets list dialog box height.
;Run using mac before list.
;EXAMPLE
;str s = "Line1[]Line2[]Line3[]Line4[]Line5[]Line6[]Line7[]Line8[]Line9[]Line10[]Line11"
;mac "SetListHeight" "" 250
;sel list(s "Lines")
,;case 1 out "Line1"
,;case 2 out "Line2"
,;case 3 out "Line3"
,;case 4 out "Line4"
,;case 5 out "Line5"
,;case 6 out "Line6"
,;case 7 out "Line7"
,;case 8 out "Line8"
,;case 9 out "Line9"
,;case 10 out "Line10"
,;case 11 out "Line11"
,;case else out "Cancel"
;g1
int h=wait(1 WC win("" "#32770" "qm")); err ret
if(!id(1023 h)) 0.1; goto g1
RECT r rc
int hh=h
GetWindowRect(h &r)
int diff=height-(r.bottom-r.top)
siz 0 r.bottom-r.top+diff h 1
h=id(1023 hh)
GetWindowRect(h &r)
siz 0 r.bottom-r.top+diff h 1
h=id(2 hh)
GetWindowRect(h &r)
GetClientRect(hh &rc)
mov 0 rc.bottom-(r.bottom-r.top) h
-----------------------------------------
"BlockInput2" should block all mouse and keyboard input together with "BIKeyboardProc" and "BIMouseProc"
function block ;;block: 1 block keyboard, 2 block mouse, 3 block mouse and keyboard, 0 unblock, -1 unblock temporarily, -2 restore blocking
Blocks keyboard and/or mouse input.
Like BlockInput, input is automatically unblocked
when macro that called BlockInput2 ends, even if it
does not call BlockInput2 0.
Differences from BlockInput:
On Win98/Me:
Ctrl+Alt+Delete cannot unblock.
On other OS:
Ctrl+Alt+Delete cannot unblock.
You can block only keyboard or only mouse input.
Other threads still can use keyboard and mouse
commands. Blocked is only real user input.
Other threads can temporarily unblock input.
You can modify BIKeyboardProc to block or
allow certain keystrokes.
To unblock temporarily, call this function with block=-1.
Later, you can call it again with block=-2 to restore blocking.
Temporarily unblocking/blocking is more efficient, because
this does not cause hooks to be uninstalled/installed. Also,
this should be used when temporary unblocking is used in
other thread.
EXAMPLE
BlockInput2 3
run "notepad"
5
key iiii
BlockInput2 -1
mes "temporarily unblocked"
BlockInput2 -2
5
BlockInput2 0
dll user32 #SetWindowsHookEx idHook lpfn hmod dwThreadId
dll user32 #UnhookWindowsHookEx hHook
dll user32 #CallNextHookEx hHook ncode wParam !*lParam
type KBDLLHOOKSTRUCT vkCode scanCode flags time dwExtraInfo
type MSLLHOOKSTRUCT POINT'pt mouseData flags time dwExtraInfo
def WH_KEYBOARD_LL 13
def WH_MOUSE_LL 14
def SPI_SETSCREENSAVERRUNNING 0x0061
if(WINNT)
int+ __bikhook __bimhook __bitempunblock=0
if(block>0)
opt waitmsg 2
if(__bikhook) UnhookWindowsHookEx(__bikhook)
if(__bimhook) UnhookWindowsHookEx(__bimhook)
if(block&1) __bikhook=SetWindowsHookEx(WH_KEYBOARD_LL &BIKeyboardProc _hinst 0)
if(block&2) __bimhook=SetWindowsHookEx(WH_MOUSE_LL &BIMouseProc _hinst 0)
else if(!block)
UnhookWindowsHookEx(__bikhook); __bikhook=0
UnhookWindowsHookEx(__bimhook); __bimhook=0
else __bitempunblock=block=-1
else
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING block &_i 0)
BlockInput block
------------------------------------
;"BIKeyboardProc"
/
function nCode wParam KBDLLHOOKSTRUCT*lParam
if(nCode>=0)
if(lParam.flags&16=0 and !__bitempunblock) ret 1
ret CallNextHookEx(__bikhook nCode wParam lParam)
--------------------------------------
;"BIMouseProc"
/
function nCode wParam MSLLHOOKSTRUCT*lParam
if(nCode>=0)
if(lParam.flags&1=0 and !__bitempunblock) ret 1
ret CallNextHookEx(__bimhook nCode wParam lParam)
This 1st macro creates a simple dialog, but the settings for screen position and list height have no effect.
mac "SetListHeight" "" "" 220
sel list("Kjør_Skanix_Network_Manager[]-------------------------------------[]Send_en_melding[]-------------------------------------[]Åpen_VNC_Viewers_Bare_Overvåke[]Åpen_VNC_Viewers[]Lukk_VNC_Viewers[]Andre vedlikeholds oppgaver[]Lukk Internet Explorer vinduer" "" " H v a v i l d u ? ?" 0 520 20 0 1) ;; position (x y), timeout, default, flag (1=activate window)
case 0 end
case 1 goto Kjør_Skanix_Network_Manager
case 2 goto Velg_oppgave
case 3 Oppgave = "Send_en_melding"
case 4 goto Velg_oppgave
case 5 Oppgave = "Åpen_VNC_Viewers_Bare_Overvåke"
case 6 Oppgave = "Åpen_VNC_Viewers"
case 7 goto Lukk_VNC_Viewers
case 8 Oppgave = "Andre_Vedlikeholds_Oppgaver"
case 9 Oppgave = "Lukk_Internet_Explorer_Vinduer"
----------------------------------------
; I am also including the "SetListHeight" function which may need modifying.
function height
;Sets list dialog box height.
;Run using mac before list.
;EXAMPLE
;str s = "Line1[]Line2[]Line3[]Line4[]Line5[]Line6[]Line7[]Line8[]Line9[]Line10[]Line11"
;mac "SetListHeight" "" 250
;sel list(s "Lines")
,;case 1 out "Line1"
,;case 2 out "Line2"
,;case 3 out "Line3"
,;case 4 out "Line4"
,;case 5 out "Line5"
,;case 6 out "Line6"
,;case 7 out "Line7"
,;case 8 out "Line8"
,;case 9 out "Line9"
,;case 10 out "Line10"
,;case 11 out "Line11"
,;case else out "Cancel"
;g1
int h=wait(1 WC win("" "#32770" "qm")); err ret
if(!id(1023 h)) 0.1; goto g1
RECT r rc
int hh=h
GetWindowRect(h &r)
int diff=height-(r.bottom-r.top)
siz 0 r.bottom-r.top+diff h 1
h=id(1023 hh)
GetWindowRect(h &r)
siz 0 r.bottom-r.top+diff h 1
h=id(2 hh)
GetWindowRect(h &r)
GetClientRect(hh &rc)
mov 0 rc.bottom-(r.bottom-r.top) h
-----------------------------------------
"BlockInput2" should block all mouse and keyboard input together with "BIKeyboardProc" and "BIMouseProc"
function block ;;block: 1 block keyboard, 2 block mouse, 3 block mouse and keyboard, 0 unblock, -1 unblock temporarily, -2 restore blocking
Blocks keyboard and/or mouse input.
Like BlockInput, input is automatically unblocked
when macro that called BlockInput2 ends, even if it
does not call BlockInput2 0.
Differences from BlockInput:
On Win98/Me:
Ctrl+Alt+Delete cannot unblock.
On other OS:
Ctrl+Alt+Delete cannot unblock.
You can block only keyboard or only mouse input.
Other threads still can use keyboard and mouse
commands. Blocked is only real user input.
Other threads can temporarily unblock input.
You can modify BIKeyboardProc to block or
allow certain keystrokes.
To unblock temporarily, call this function with block=-1.
Later, you can call it again with block=-2 to restore blocking.
Temporarily unblocking/blocking is more efficient, because
this does not cause hooks to be uninstalled/installed. Also,
this should be used when temporary unblocking is used in
other thread.
EXAMPLE
BlockInput2 3
run "notepad"
5
key iiii
BlockInput2 -1
mes "temporarily unblocked"
BlockInput2 -2
5
BlockInput2 0
dll user32 #SetWindowsHookEx idHook lpfn hmod dwThreadId
dll user32 #UnhookWindowsHookEx hHook
dll user32 #CallNextHookEx hHook ncode wParam !*lParam
type KBDLLHOOKSTRUCT vkCode scanCode flags time dwExtraInfo
type MSLLHOOKSTRUCT POINT'pt mouseData flags time dwExtraInfo
def WH_KEYBOARD_LL 13
def WH_MOUSE_LL 14
def SPI_SETSCREENSAVERRUNNING 0x0061
if(WINNT)
int+ __bikhook __bimhook __bitempunblock=0
if(block>0)
opt waitmsg 2
if(__bikhook) UnhookWindowsHookEx(__bikhook)
if(__bimhook) UnhookWindowsHookEx(__bimhook)
if(block&1) __bikhook=SetWindowsHookEx(WH_KEYBOARD_LL &BIKeyboardProc _hinst 0)
if(block&2) __bimhook=SetWindowsHookEx(WH_MOUSE_LL &BIMouseProc _hinst 0)
else if(!block)
UnhookWindowsHookEx(__bikhook); __bikhook=0
UnhookWindowsHookEx(__bimhook); __bimhook=0
else __bitempunblock=block=-1
else
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING block &_i 0)
BlockInput block
------------------------------------
;"BIKeyboardProc"
/
function nCode wParam KBDLLHOOKSTRUCT*lParam
if(nCode>=0)
if(lParam.flags&16=0 and !__bitempunblock) ret 1
ret CallNextHookEx(__bikhook nCode wParam lParam)
--------------------------------------
;"BIMouseProc"
/
function nCode wParam MSLLHOOKSTRUCT*lParam
if(nCode>=0)
if(lParam.flags&1=0 and !__bitempunblock) ret 1
ret CallNextHookEx(__bimhook nCode wParam lParam)