WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinBatch Function UDFs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 2002:09:16:09:50:46
Last Updated: 2002:09:16:09:50:46