Jump to content
Excelsior Forums
Sign in to follow this  
ulises31

calling dll functions

Recommended Posts

First,THANKS  :-*.Well, i loaded dll module and get adress of a function whitin it.Now i don`t now how get the parameters that the function returns when i call it.

i.e.:I load user32.dll module and get adress of GetActiveWindow function.This function returns a window handle.How can i get it? :huh: . Tnx  ;D

Share this post


Link to post
Share on other sites

Do you have problems reading the User's Guide?  :'( It is all described in the chapters I mentioned. To access the User's Guide,  select Help/Contents in the XDS Environment.

As for your question, you do not have to load USER32.DLL. Definitions of Win32 core functions are provided in the module Windows. (DEF\WIN32\Windows.def in your XDS directory). You just have to import it:

IMPORT Windows;

VAR hwnd: Windows.HWND;

  .  .  .

  hwnd := Windows.GetActiveWindow();

Share this post


Link to post
Share on other sites

 ???Well,is posible that i not explain well.Problems? :-/ First of all,my native language is spanish,no english.I don`t want make my own dll.I know that don't need load user32.dll cuz there is a def called user32.def(only was an example).I only want call to a function of a dll from my program passing needed parameters an taken return values from that function.There is not a def file called psapi.def, and i want call EnumProcesses function

and take return values.If how do this is in any place in the guide,tell me where exactly.I did this:

VAR

     hmod: dllRTS.HMOD;

     init: PROC;

    .  .  .

     hmod := dllRTS.LoadModule("psapi.DLL");

     init := dllRTS.GetProcAdr(hmod, "EnumProcesses");

     init;

This function(EnumProcesses) returns a pointer to the processes runing in the pc, but i can get that pointer.

I read that guide again,again and over again and  find

nothing about how call to a function of the o.s. dll passing parameters and geting return values. :'(.

Resuming:I ONLY WANT MAKE A PROGRAM THAT CALL

THE FUNCTION EnumProcesses IN TO PSAPI.DLL AND USE THE VALUES THAT THE FUNCTION RETURNS. ;D

Share this post


Link to post
Share on other sites

Well, my native language is Russian and I do not know Spanish, so we would have to communicate in English. :(

Forget about dllRTS. ALL core Win32 API functions, including EnumProcesses, are defined in the module Windows, for your convenience. Just import that module as desribed in my post above. It works almost like [tt]#include <windows.h>[/tt] works in C/C++.

See the sample in XDS\samples\Generic, would you please? It uses a lot of Windows APIs.

The module Windows is in XDS\def\Win32.

Share this post


Link to post
Share on other sites

Well lets write english  B)

Forgotten  ;D

ALL[/b] core Win32 API functions, including EnumProcesses, are defined in the module Windows, for your convenience. Just import that module as desribed in my post above. It works almost like [tt]#include <windows.h>[/tt] works in C/C++.

O.K. I did this:

<* +M2EXTENSIONS *>

<* +USEDLL*>

<* +IMPLIB*>

MODULE test;

IMPORT  Windows;

VAR

     

BEGIN

     Windows.EnumProcesses();      

END test.            

Compiler Answer:

Error in test.mod[11:10]:undeclared identifier "EnumProcesses"

[quote See the sample in XDS\samples\Generic, would you please? It uses a lot of Windows APIs.

The module Windows is in XDS\def\Win32.

I saw that sample, and i found all windows api functions that uses in win32 def files.

I think that you are wrong,i not found neither of the functions that are in psapi.dll library in win32 def files in

\def\win32 folder. Tnx :huh::'(

Share this post


Link to post
Share on other sites

Hello. I DID IT!!!!!! :D :D :D :D

In the end it works.I followed the next steps:

1-make an import library whit all functions and structures

  that i need from dll library in a lib file whit xlib tool.

2-create a def file whit definition of all functions and  

   built sym file.

3-voila!!!!it works.Now i can import functions  B)  B)

I'm thinking make a lib and def file of all functions of psapi.dll,but later 'cose i have an exercise first week in september  and must study.

I have other problem now ;D.Any can explain me what means  OPEN ARRAY OF CHAR and how use it(little piece

code example if is posible please)I try use GetModuleFileName function.THANKS.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×