Solved

Use Windows DLL

Posted on 2001-06-17
5
151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 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