Solved

Use Windows DLL

Posted on 2001-06-17
5
142 Views
Last Modified: 2010-04-06
Anyone can tell me how to use MS Windows DLL (for example, i want to shutdown Windows using my Delphi program).
0
Comment
Question by:vfxyb
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6199644
Hello

  Delphi made a great job, you can use most of functions of DLL (API) without declare them, they Encapsulate  most of them in delphi units, like windows, messages, and more, but u still could to declare them and use any api function
if you want to shutdown the computer u can simply call the ExitWindowsEx, it found in the windows unit, if you press ctrl and move teh mouse above the ExitWindowsEx, when u see it in blue in underline click the on it by the mouse and it will take u to the windows unit for the declartion


ExitWindowsEx( EWX_FORCE or EWX_SHUTDOWN, 0 );


if you want to see the API reference from delphi help menu, choose windows SDK

Mohammed
0
 

Author Comment

by:vfxyb
ID: 6199651
I already read the windows sdk but i still confused is ExitWindowsEx a function in delphi's unit or in user32.dll. If i'm not wrong it's from user32.dll. so it's not a delphi unit. How can i use it?
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 50 total points
ID: 6199670
you are right, the ExitWindowsEx it's a function in user32.dll, and if you want to use an api or function you need to declare it in ur program
ExitWindowsEx need declaration to use if as the follow in
interface seciotn


function ExitWindowsEx(uFlags: UINT; dwReserved: DWORD): BOOL; stdcall;
and then in implementation section

function ExitWindowsEx; external user32 name 'ExitWindowsEx';

try to took a look at the windows unit, and you will find most of api declared in it

Mohammed
0
 

Expert Comment

by:Aum
ID: 6201810
MS's "Win32 Programmer's Reference" help file, which comes with Delphi, explains the meaning and use of all the API calls.
0
 

Author Comment

by:vfxyb
ID: 6204328
thank you for your comment, now i will try it at home. if you have a sample delphi program about using windows dll, please send it to vfxyb@yahoo.com
Thanks
Yopie
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
A short film showing how OnPage and Connectwise integration works.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now