Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


UDF to IgnoreInput

Keywords: 	 ignoreinput

This UDF can be used with NT 4.0 SP6 to use the BlockInput function on that OS.

In Windows 98/ME/200o/XP and newer, the WinBatch IgnoreInput function should work better. IngoreInput was added in WinBatch 2002B.

;To Set flags:
;@TRUE  = Disable input
;@FALSE = Enable input

#definefunction BlockInput(flag)
	dllfile=strcat(dirwindows(1),"user32.dll")
	if flag==-1  ;find and return current state
		 ret=dllcall(dllfile,long:"BlockInput",long:@TRUE)
		 if !ret  ;already blocked
		 	return @TRUE
		 else
		 	 dllcall(dllfile,long:"BlockInput",long:@FALSE) ;turn it back off
			 return @FALSE
		 endif
	endif

	;otherwise...
	if flag>0 then flag=@TRUE ;just in case
	return dllcall(dllfile,long:"BlockInput",long:flag)
#endfunction


;test it out

;get current state
display(5,"Current State",strcat("Should be unblocked",@TAB,blockinput(-1)))

;turn it on
x=blockinput(@TRUE)
display(5,"Current State",strcat("Should be blocked",@TAB,blockinput(-1)))

;unblock
x=blockinput(@FALSE)

;turn it off
display(5,"Current State",strcat("Should be unblocked",@TAB,blockinput(-1)))

exit



Article ID:   W15323