Solved

Use Windows DLL

Posted on 2001-06-17
5
138 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:mnasman
Comment Utility
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
Comment Utility
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:
mnasman earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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

20 Experts available now in Live!

Get 1:1 Help Now