Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Use Windows DLL

Posted on 2001-06-17
5
Medium Priority
?
161 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 150 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…
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

715 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