AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Windows API design

Ein Thema von frankly · begonnen am 5. Mai 2003 · letzter Beitrag vom 7. Mai 2003
Antwort Antwort
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#1
  Alt 6. Mai 2003, 10:36
Please don't send me any code. I wont have the time to do your work. Just post the relavent code. But I found some code for WM_COPYDATA. But again you will have to modify your c-programs:

First program, the sender:
Delphi-Quellcode:
function FindWindowByTitle(WindowTitle : string) : Hwnd;
var
  NextHandle : Hwnd;
  NextTitle : array[0..260] of char;
begin
  NextHandle := GetWindow(Application.Handle,GW_HWNDFIRST);
  while (NextHandle > 0) do
  begin
    GetWindowText(NextHandle,NextTitle,255);
    if (pos(WindowTitle,StrPas(NextTitle)) <> 0) then
    begin
      result := NextHandle;
      exit;
    end
    else
      NextHandle := GetWindow(NextHandle,GW_HWNDNEXT);
    end;
    result := 0;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
  struct: CopyDataStruct;
begin
  struct.cbData := Length(Edit1.Text);
  struct.lpData := PChar(Edit1.Text + #0);
  SendMessage(FindWindowByTitle('Form2'), WM_COPYDATA, handle, Integer(@struct));
end;
Second program, the receiver:
Delphi-Quellcode:
type
  TForm1 = class(TForm)
    Label1: TLabel;
    procedure GetData(var msg: TMessage); message WM_COPYDATA;
...
procedure TForm1.GetData(var msg: TMessage);
var
  struct: PCopyDataStruct;
begin
  struct := Ptr(msg.LParam);
  Form1.Label1.Caption := PChar(struct^.lpData);
end;
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:46 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz