Quick Search for:  in language:    
API,Windows,function,used,find,things,system,
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Delphi Stats

 Code: 209,911. lines
 Jobs: 14. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for Delphi.
Nevolnik
By Johny Vlak on 1/3


Click here to see a screenshot of this code!Balls
By Alexander Izmukhambetov on 1/2

(Screen Shot)

Recycle Bin name changer
By ShoBaiR ShaIkhY on 12/30


Ninth backdoor 2003
By k0nsl on 12/27


Tank game 0.02
By Peter Williams on 12/25


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

The SystemParametersInfo function

Print
Email
 

Submitted on: 7/9/2000 5:43:18 PM
By: Emiel Hollander  
Level: Advanced
User Rating: By 2 Users
Compatibility:Delphi 5, Delphi 4, Pre Delphi 4

Users have accessed this article 4982 times.
 
 
     The Windows API function SystemParametersInfo can be used to find out things about the system. The parameters that should be passed to this function depend on the action that should be taken. I will only discuss the actions that get information from the system here. You can also set certain settings using the SystemParametersInfo function. For more info, see the Win32 Programmer's Reference.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.

The first parameter determines the action that this function should take. In the actions I discuss here, the second and fourth parameters aren't used. You can enter 0 (zero) for these parameters. The third parameter, however, is a pointer to the variable that the result of this function should be stored in.

If e.g. you want to know if the system beep is set, then you can use the following:

  SystemParametersInfo(SPI_GETBEEP, 0, @BeepSet, 0);

Make sure that BeepSet is defined as a boolean. There are some other actions which also require a boolean as the third parameter.

SPI_GETDRAGFULLWINDOWS - Determines whether dragging of full windows is set or not. This function is only supported on Windows 95 when Windows Plus has been installed.

SPI_GETFONTSMOOTHING - When the font smoothing is enabled, then this action returns truw. Font smoothing is only available on Windows 95 when Windows PLus has been installed.

SPI_GETSCREENSAVEACTIVE - Tells you whether the screensaver is active or not.

There are also actions that require the third parameter to be a pointer to an integer. Like these:

SPI_GETBORDER - This gets the width of a window's sizing border.

SPI_GETSCREENSAVETIMEOUT - Indicates the screensaver time-out value, in seconds.

You could then create the following function to get to know the screensaver time-out:

  function GetScreenSaveTimeOut: integer;
  begin
    SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, @Result, 0);
  end;

Same for a boolean, just change "integer" in the function to "boolean".

You can also find out whether Windows Plus has been installed using the SystemParametersInfo function, but it works a little bit different.

  PlusInstalled := SystemParametersInfo(SPI_GETWINDOWSEXTENSION, 1, 0, 0);

Make sure you have defined PlusInstalled as a boolean.

This tip is partially based on Lennie De Villiers tip of February 8th, 2000, about finding out whether the screen saver is active.


Other 14 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
7/25/2000 10:54:46 PM:Setraline HCI
Hi I was wondering if you had any Delphi32 api references/documentation? Or is there a simple way of translating VB api to Delphi?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Delphi Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.