Page 1 of 1 1
Topic Options
#86224 - 2002-06-21 07:16 PM ActiveX Component to use API calls in KiX
Chris S. Offline
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
#86225 - 2002-06-21 10:11 PM Re: ActiveX Component to use API calls in KiX
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Hmmm. I really would have thought that this would generate some interest. Has anyone tried it yet? You could use this ActiveX component to make calls against any DLL/OSX.
Top
#86226 - 2002-06-21 10:21 PM Re: ActiveX Component to use API calls in KiX
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
I'm interested.. very much.. [Smile] The only problem is that it has been EXTREMELY hectic here at work. [Smile] 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. Offline
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
#86228 - 2002-06-22 05:26 PM Re: ActiveX Component to use API calls in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
bump - very cool - i've only seen one other these thingies, and this one way, way better than the other one ... i didn't see any Windows scripts in the samples, did I miss anything or has nobody tried ?
Top
#86229 - 2002-06-22 05:35 PM Re: ActiveX Component to use API calls in KiX
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Let me exude my ignorance here. [Embarrassed] 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?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#86230 - 2002-06-22 05:49 PM Re: ActiveX Component to use API calls in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Some of the more useful API functions - like the lanman calls - are almost impossible to model / map genericially using an ActiveX control ... they return arrays of complex structures. A good test of this control would be with the Windows API's - to see how far one could take it ...
Top
#86231 - 2002-06-24 05:44 PM Re: ActiveX Component to use API calls in KiX
Chris S. Offline
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 Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
That's great, Chris... someone was asking for that earlier..?

Brian

Top
#86233 - 2002-06-24 05:56 PM Re: ActiveX Component to use API calls in KiX
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I already posted in response to that.
Top
#86234 - 2002-06-26 04:35 PM Re: ActiveX Component to use API calls in KiX
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
I like this!! Set Screen Saver Timeout! [Smile]

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. Offline
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
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.064 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org