Page 1 of 1 1
Topic Options
#143854 - 2005-07-19 06:43 PM Windows API call functions from DLL files
DaveLipman Offline
Fresh Scripter

Registered: 2005-07-13
Posts: 33
Loc: NJ, USA
I would like to take adantage of the GetSystemMetrics WinAPI in USER32.DLL.

I understrand it takes a signed integer as a parameter (the index), and
returns a signed integer with the values I listed (0=normal boot,
1 & 2=safe mode) where SM_CLEANBOOT is defined as 67.

GetSystemMetrics(SM_CLEANBOOT);

0 Normal boot
1 Fail-safe boot
2 Fail-safe with network boot


Can I do this from within Kixtart ?

Top
#143855 - 2005-07-19 06:52 PM Re: Windows API call functions from DLL files
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Unfortunately, one cannot call DLL API's directly with KiXtart at this time.
Top
#143856 - 2005-07-20 04:48 AM Re: Windows API call functions from DLL files
DaveLipman Offline
Fresh Scripter

Registered: 2005-07-13
Posts: 33
Loc: NJ, USA
I figured as much but I was asked to ask... So I did.

Thanx !

Top
#143857 - 2005-07-20 02:10 PM Re: Windows API call functions from DLL files
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Stay tuned. There is the possibility that one of the brilliant minds here may come up with a solution.
Top
#143858 - 2005-07-20 02:55 PM Re: Windows API call functions from DLL files
Stevie Offline
Starting to like KiXtart
*****

Registered: 2002-01-09
Posts: 199
Is there a reason why you can't use WMI to get this information?
_________________________
Stevie

Top
#143859 - 2005-07-20 04:09 PM Re: Windows API call functions from DLL files
Stevie Offline
Starting to like KiXtart
*****

Registered: 2002-01-09
Posts: 199
In looking over some other posts, it seems you've already gone down that road. There actually is a way to call API functions from within scripts and it's achieved with an app called rundll32.exe. This exe is on all systems back to Win98. Here's the catch. You can only call API functions, I don't know of a way to get a return code back from the function you're calling. This is because the command is typically used to launch control panel applets and various system level wizards, i.e. the Add Printer Wizard. In your case, the command is as simple as:

Code:
shell "rundll32.exe user32.dll, GetSystemMetrics 67"


But the kicker is that if you check @ERROR I believe it will always return 0, since the command executed successfully, so even though you can run it you can't get the value that it is reporting.

If there is a way to get a return code back from run32dll.exe I'd love to know about it, which is why I post this at all so that somebody here smarter than me can figure out how to do it.


Edited by Stevie (2005-07-20 04:10 PM)
_________________________
Stevie

Top
#143860 - 2005-07-20 07:56 PM Re: Windows API call functions from DLL files
DaveLipman Offline
Fresh Scripter

Registered: 2005-07-13
Posts: 33
Loc: NJ, USA
Hi Stevie:

I would be interested if there would be a way to actually return information and not just run a function of a DLL.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.104 seconds in which 0.082 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