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



BeitragVerfasst: Di 09.12.08 02:11 
Hallo,
ich möchte in einem externen Programm etwas ins Edit eintragen, das funktioniert soweit, das Problem ist nur, das er nicht Returned.

Hier mal der Code:
ausblenden Delphi-Quelltext
1:
2:
SendMessage(wndChild, WM_SETTEXT, 0, Integer(PChar(Edit3.Text)));
SendMessage(wndChild, VK_RETURN, 00);


Habe ich vieleicht etwas falsch gemacht?

Danke euch schonmal im Voraus.

MfG
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Di 09.12.08 08:20 
Du kannst nicht einfach ein VK_RETURN schicken. Du musst eine Message mit WM_KEYDOWN (msdn.microsoft.com/e...s646280(VS.85).aspx) mit dem entsprechenden Keycode schicken. Nicht vergessen, die Taste dann mit WM_KEYUP wieder "loszulassen".

Gruß,
Jens
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Di 09.12.08 21:26 
Danke.

Aber wie mache ich das ambesten?

MfG
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Mi 10.12.08 01:38 
Ich hab das mal so versucht:
ausblenden Delphi-Quelltext
1:
2:
SendMessage(wndChild, WM_SETTEXT, 0, Integer(PChar('Test!')));
PostMessage(wndChild, WM_KEYDOWN, VK_RETURN, 0);


Er sendet zwar den Text, aber er führt kein Return aus.

Woran liegt der fehler?

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 10.12.08 01:50 
Du lässt die Returntaste ja nicht mehr los, also kommt zwar OnKeyDown praktisch an, aber weder OnKeyUp noch OnKeyPress um es mit Delphi zu sagen.
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Mi 10.12.08 15:42 
Habe ich auch schon versucht und KeyUp wieder rausgenommen, da es nicht ging.
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Mi 10.12.08 16:03 
Versuch es mal mit SendMessage, statt PostMessage.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 10.12.08 16:08 
Sollte es der OnKeyPress Handler sein, der dein Event auslöst, dann ist das bei einem Delphiprogramm die Reaktion auf WM_CHAR, vielleicht ist das bei dir auch das Richtige:
ausblenden Delphi-Quelltext
1:
SendMessage(wndChild, WM_CHAR, VK_RETURN, 0);					
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Mi 10.12.08 20:17 
Ich habe wirklich schon alles versucht, es geht einfach nicht.

So wie es aussieht, kann ich das wohl vergessen.

Aber trotzdem Danke.

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 10.12.08 20:26 
Es gibt hier noch einige Möglichkeiten:
www.swissdelphicente.../showcode.php?id=220

Ansonsten könntest du höchstens mal sagen welches Programm es ist, dann könnte man es mal selbst ausprobieren.