Solved

Delphi Programming question

Posted on 1997-07-09
1
156 Views
Last Modified: 2010-04-06
Hi,
I need source code for a dll and a program that would read that dll.
The Dll has to have a form on it. On that form there must be
a Tmemo component. in the memo, there must be an undefined amount of lines(it varies every time as this will be used for reading out multiple memos). When the "GetCoolScroll" procedure is called from a button on an application (not the dll) the dll takes the lines out of its own form and puts them into a TMemo component on the form of the main application. The source must be comented and complete. E-Mail me the zip to: maxcom@interserv.com.
Thanks and hope you can help.
MAXcom
0
Comment
Question by:maxcom
[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
1 Comment
 
LVL 5

Accepted Solution

by:
ronit051397 earned 220 total points
ID: 1338528
I sent you the following examples by Email.
These example were tested under win3.11 (Delphi1) and winNT4 (Delphi3).

1. Application Code:
----------------------------------------------------------------
program Calldll;

uses
  Forms,
  Main in 'MAIN.PAS' {Form1};

begin
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
----------------------------------------------------------------
unit Main;

interface

uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure GetCoolScroll(FMemo: THandle);
  far; external 'Memodll.dll';

procedure TForm1.Button1Click(Sender: TObject);
begin
  GetCoolScroll(Memo1.Handle);
end;

end.
----------------------------------------------------------------
2. Dll code
library Memodll;

uses Uform2 in 'UFORM2.PAS' {Form2};

{$R *.RES}

exports
  GetCoolScroll;
begin
end.
----------------------------------------------------------------
unit Uform2;

interface

uses
  WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, StdCtrls;

type
  TForm2 = class(TForm)
    Memo2: TMemo;
    bbUpdate: TButton;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure bbUpdateClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

procedure GetCoolScroll(FMemo: THandle); export;
implementation
var MemoHandle: THandle;
    DllForm: TForm2;
{$R *.DFM}

procedure GetCoolScroll(FMemo: THandle);
begin
  MemoHandle:=FMemo;
  DllForm := TForm2.Create(Application);
  DllForm.Show;
end;

procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Release;
end;

procedure TForm2.bbUpdateClick(Sender: TObject);
var
  FBuffer:PChar;
  FSize: Integer;
begin
  FSize:= DllForm.Memo2.GetTextLen+1;
  Getmem(FBuffer,FSize);
  DllForm.Memo2.GetTextBuf(FBuffer,FSize);
  sendmessage(MemoHandle,WM_SETTEXT,0,LongInt(FBuffer));
  Freemem(FBuffer,FSize);
end;

end.
0

Featured Post

Industry Leaders: 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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Suggested Courses
Course of the Month5 days, 1 hour left to enroll

636 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