Einzelnen Beitrag anzeigen

ixtreme
(Gast)

n/a Beiträge
 
#7

Re: popupmenu item hinzufügen und onClick ereignis definiere

  Alt 15. Nov 2003, 16:52
Ok, ich habe jetzt folgenden Code in der Hauptanwendung:

Code:
unit Unit2;

interface

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

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    CheckListBox1: TCheckListBox;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    PopupMenu1: TPopupMenu;
    Beenden1: TMenuItem;
   

    procedure Beenden1Click(Sender: TObject);
   
    procedure xy1Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);



  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure klickmich(sender:tObject)stdcall; external 'project2.dll';







procedure TForm1.Beenden1Click(Sender: TObject);
begin
   Close;
end;






procedure TForm1.Button4Click(Sender: TObject);
var
menu : TMenuItem;
begin
                 menu := TMenuItem.Create(self);
            menu.Caption := '123';
             menu.OnClick := Klickmich;

            form1.popupmenu1.Items.Add(menu);
end;

end.

und diesen in der dll, funzt aber nicht, wieso? hab da noch nicht so viel ahnung von!


Code:
library Project2;

{ 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
  sharemem,
  SysUtils,
  Classes,
  idhttp,shellapi, windows;

{$R *.res}




procedure Klickmich(Sender: TObject);
begin
hallo123;
end;

exports
  klickmich;

begin
end.
  Mit Zitat antworten Zitat