Autor Beitrag
jackie05
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Mo 29.10.07 07:36 
Hallo,
wie kann ich das was in meinem Java Programm von Textarea ins RichEdit in Delphi übertragen?
Man könnte das ja machen, wenn man die Handle herausbekommen hat, aber wie könnte man das ambesten machen?

MfG

---

Ich habe das mal so gemacht:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
type
  PFindWindowStruct = ^TFindWindowStruct;
  TFindWindowStruct = record
    Caption: string;
    ClassName: String;
    WindowHandle: THandle;
end;

function EnumWindowsProc(hWindow: hWnd; lParam: LongInt): boolean; stdcall;
var lpBuffer: PChar;
    WindowCaptionFound: boolean;
    ClassNameFound: boolean;
begin
  GetMem(lpBuffer, 255);
  result:=true;
  WindowCaptionFound:=false;
  ClassNameFound:=false;
  try
    if GetWindowText(hWindow, lpBuffer,255)>0 then
      if Pos(PFindWindowStruct(lParam).Caption, StrPas(lpBuffer))>0
      then WindowCaptionFound:=true;
    if PFindWindowStruct(lParam).ClassName='' then
      ClassNameFound:=true
      else if GetClassName(hWindow, lpBuffer, 255)>0 then
        if Pos(PFindWindowStruct(lParam).ClassName, StrPas(lpBuffer))>0
        then ClassNameFound:=true;
    if (WindowCaptionFound and ClassNameFound) then begin
      PFindWindowStruct(lParam).WindowHandle:=hWindow;
      result:=false;
    end;
  finally
    FreeMem(lpBuffer, sizeof(lpBuffer^));
  end;
end;

function FindAWindow(WinCaption: string; WinClassName: string): THandle;
var WindowInfo: TFindWindowStruct;
begin
  with WindowInfo do begin
    caption := WinCaption;
    className := WinClassName;
    WindowHandle := 0;
    EnumWindows(@EnumWindowsProc, LongInt(@WindowInfo));
    result := WindowHandle;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var TheWindowHandle: THandle;
begin
  TheWindowHandle:=FindAWindow('Test', 'SunAwtFrame');
  if TheWindowHandle=0 then
  begin
    ShowMessage('Fenster wurde nicht gefunden!')
  end
  else begin
    BringWindowToTop(TheWindowHandle);
  end;
end;


Das Fenster kann schonmal gefunden werden, nur wie kann ich jetzt von diesem Java Programm das was im Textarea steht, ins RichEdit1 in Delphi übertragen?

MfG

Moderiert von user profile iconNarses: Beiträge zusammengefasst.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Do 01.11.07 19:35 
Ich glaube, ich habe irgendwo gelesen, dass zwar die Fenster Handles haben, aber die einzelnen Steuerkomponenten nicht. Wenn du nicht unbedingt so schön sauber über die Handles zugreifen willst, könntest du da den Inhalt in einer Datei speichern, und mit Delphi ständig auf dessen Existens warten.