Solved

Use Windows DLL

Posted on 2001-06-17
5
148 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

685 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