[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

09/20/2005 at 06:59AM PDT, ID: 21567617
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

problem with delphi dll when called from another delphi app

Asked by nikolaosk in Delphi Programming

Tags: delphi, dll

hi there experts!!!

i have the following dll. (part 1-see code below).
it has an exported function that returns as a string the physical memory
available to the system


in  part 2)(see code below) i just call the exported function from a simple form with a button but i get an error back.
the dll and the project i call the dll are in the same folder.

 please advise


1)**************************************

library thenewdll;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }

uses
  Windows,
  Messages,
  SysUtils,
  Variants,
  Classes,
  Graphics,
  Controls,
  Forms,
  Dialogs,
  StdCtrls,
  shellapi,
  shlobj,
  CommCtrl,
  comobj;

{$R *.res}

function  gettotalmem():string;

var
GlobalMemoryInfo: TMemoryStatus; // holds the global memory status information
begin
   {set the size of the structure before the call}
  GlobalMemoryInfo.dwLength := SizeOf(GlobalMemoryInfo);

  {retrieve the global memory status...}
  GlobalMemoryStatus(GlobalMemoryInfo);

    {and display the information}

  gettotalmem := IntToStr(GlobalMemoryInfo.dwTotalPhys);

end;


  exports gettotalmem;
end.

****************************



2)*******

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

     procedure  gettotalmem; external 'thenewdll.dll'

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
x:string;
begin
    x:=gettotalmem;

    showmessage(x);
end;



end.
*********************




[+][-]09/20/05 07:39 AM, ID: 14920576

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Delphi Programming
Tags: delphi, dll
Sign Up Now!
Solution Provided By: ciuly
Participating Experts: 2
Solution Grade: A
 
 
[+][-]09/20/05 07:17 AM, ID: 14920343

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/20/05 07:47 AM, ID: 14920666

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/20/05 07:52 AM, ID: 14920708

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/20/05 08:05 AM, ID: 14920796

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/20/05 08:08 AM, ID: 14920827

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/20/05 08:29 AM, ID: 14920993

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/20/05 08:44 AM, ID: 14921128

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091028-EE-VQP-86