#86224 - 2002-06-21 07:16 PM
ActiveX Component to use API calls in KiX
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
My gift to you, my KiXtarting Brothers, is the world of API. Download this ActiveX component, register it, and try out this script...
WSH API Toolkit
code:
$API=CreateObject("wshAPIToolkitObject.ucATO") ? "Input blocked for 10 seconds..." $rc=BlockInput(True) ?? "Go ahead and try to move your mouse..." sleep 5 ?? "Still can't? Wait 5 more seconds..." sleep 5 $rc=BlockInput(False) ?? "Input unblocked..." function BlockInput($bFlag) $BlockInput=$API.CALLAPI("User32.dll", "BlockInput", $bFlag) endfunction
|
|
Top
|
|
|
|
#86226 - 2002-06-21 10:21 PM
Re: ActiveX Component to use API calls in KiX
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I'm interested.. very much.. The only problem is that it has been EXTREMELY hectic here at work. I'm going home soon.. getting ready for a party of sorts.. I'll check into it more later on.
Brian
|
|
Top
|
|
|
|
#86227 - 2002-06-21 11:03 PM
Re: ActiveX Component to use API calls in KiX
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Here's another sample...
code:
$API=CreateObject("wshAPIToolkitObject.ucATO") ? "This is a test..." $rc=APISleep(2500) ? "Should have waited 2.5 seconds..." exit function APISleep($msecs) $APISleep=$API.CallAPI("Kernel32.dll", "Sleep", $msecs) endfunction
[ 21 June 2002, 23:06: Message edited by: Chris S. ]
|
|
Top
|
|
|
|
#86229 - 2002-06-22 05:35 PM
Re: ActiveX Component to use API calls in KiX
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Let me exude my ignorance here. How does one know what API's one could make useful? As you can see I'm not much of a API guy. I know that there are many things that the Exchange Admin GUI can do that I want to do in script can I just call the API that it does and how do I know which ones that is?
|
|
Top
|
|
|
|
#86231 - 2002-06-24 05:44 PM
Re: ActiveX Component to use API calls in KiX
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Here's a script to change the mouse cursor to the hourglass...
code:
$API=CreateObject("wshAPIToolkitObject.ucATO") HourglassCursor() sleep 5 HourglassCursor() exit function HourglassCursor() $Cursor=$API.CALLAPI("USER32.DLL", "LoadCursorA", 0, 32514) $HourglassCursor=$API.CALLAPI("USER32.DLL", "SetSystemCursor", $Cursor, 32512) endfunction
|
|
Top
|
|
|
|
#86232 - 2002-06-24 05:52 PM
Re: ActiveX Component to use API calls in KiX
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
That's great, Chris... someone was asking for that earlier..?
Brian
|
|
Top
|
|
|
|
#86234 - 2002-06-26 04:35 PM
Re: ActiveX Component to use API calls in KiX
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I like this!! Set Screen Saver Timeout!
You can set system parameters this way:
code:
$API = CreateObject("wshAPIToolKitObject.ucATO") $ScreenSaverTimeout=300 $rc = $API.CALLAPI("user32.dll","SystemParametersInfoA",15,$screenSaverTimeout,NULL,&1)
The only trick to this is to know what the parameter 15 points to... in this case it sets the screen saver with "SPI_SETSCREENSAVETIMEOUT"
See reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_4p67.asp
I found the number(15) somewhere else... so I'm not sure where, but the integers identifying the system property get/set attribute should be available somewhere.
Brian
|
|
Top
|
|
|
|
#86235 - 2002-06-26 08:28 PM
Re: ActiveX Component to use API calls in KiX
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Nice, Brian. Here's more info on the SystemParameterInfo property... SystemParameterInfo [ 26 June 2002, 20:29: Message edited by: Chris S. ]
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 1188 anonymous users online.
|
|
|