Habe versucht die Daten in einem fremden Fenster zu lesen. Das funktioniert auch mit den "normalen Edit"s aber nicht bei "ComboBoxen" aus VB der Klasse ThunderRT6UserControlDC
Das sind momentan meine Ergebnisse:
ID: 4, ClassName: ThunderRT6Frame, Caption: Überschrift
ID: 0, ClassName: ThunderRT6UserControlDC, Caption:
ID: 0, ClassName: VBFocusRT6, Caption:
ID: 1, ClassName: ThunderRT6TextBox, Caption:
ID: 2, ClassName: ThunderRT6TextBox, Caption: Text1
wobei ich glaube, die "ComboBox" ist das ThunderRT6UserControlDC in Zeile 2
warscheinlich ist es aus VB.
So kommt es zu der Ausgabe:
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:
| 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;
function EnumProc(wnd: HWND; Lines: TStrings): BOOL; stdcall; var buf, Caption: array[0..255] of char; rc:integer; begin Result := True; GetClassName(wnd, buf, SizeOf(buf) - 1); SendMessage(wnd, WM_GETTEXT, 256, Integer(@Caption)); Lines.Add(Format('ID: %d, ClassName: %s, Caption: %s', [GetDlgCtrlID(wnd), buf, Caption])); end;
procedure TForm1.Button13Click(Sender: TObject); var h: hwnd; i:integer; begin i:=0; h := FindWindowByTitle('Dateneingabe'); if h <> 0 then begin Memo4.Clear; EnumChildWindows(h, @EnumProc, Integer(memo4.Lines)); end else ShowMessage('not found.'); end; |
Habe vermutet, das das Array zu klein ist oder WM_ eine andere Message enthalten muß.
Kann einer helfen ?
mfG