Autor Beitrag
Dabster
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mo 12.04.04 12:38 
Hallo!

Ich habe folgende Frage: Wie kann man das Handle eines Prozesses ermitteln der mittels einer SendMessage oder PostMessage-Routine Daten an ein Programm schickt? Das Fenster das die Daten empfängt soll also herausbekommen von welchem Prozess diese stammen.

Danke im Vorraus
Tom
Dabster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mo 12.04.04 16:11 
Hat denn keiner einen Vorschlag oder funktioniert das nicht?
scrooge
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 200



BeitragVerfasst: Mo 12.04.04 17:50 
Ist der Prozess, der diese Message senden soll ein bestimmter (damit meine ich : Hast du ihn selbst programmiert ??),
oder geht es darum generell mal zu wissen woher die Messages, die man so im Laufe der Zeit als Prog empfängt, kommen ??
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mo 12.04.04 17:55 
hi,

Zitat:
oder geht es darum generell mal zu wissen woher die Messages, die man so im Laufe der Zeit als Prog empfängt, kommen ??

das ist imho relativ einfach: zu 99% entweder vom System oder vom User (Mausbewegung, -klick, Tastatur)...

Zitat:
Ist der Prozess, der diese Message senden soll ein bestimmter (damit meine ich : Hast du ihn selbst programmiert ??),

Da übergibt man halt einfach dann in lParam oder wParam das Handle...


raziel

_________________
JSXGraph
Dabster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mo 12.04.04 18:42 
OK dann setz ich das handle beim lParam ein und wie bekomm ich das raus welches das gesendet hat? Ich probiers mal mit dem handle im Fokus...

Danke soweit
Dabster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mo 12.04.04 18:46 
Sehr schön - hat geklappt. Wie bekomm ich jetz das Handle in den dazugehörigen Fenstertitel umgewandelt?! :)
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mo 12.04.04 19:21 
Da dürfte dir GetWindowText große Freude bereiten.
Einfach mal im Forum/bei Google suchen oder im M$-Win32-SDK nachschlagen.

[edit]
oder so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var szWinText: PChar;
    WinText: String;
{...}
    GetWindowText(hWnd, szWinText,255);
    WinText:= strpas(szWinText);

[/edit]


raziel

_________________
JSXGraph
Dabster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mo 12.04.04 19:28 
Ach nee mist. Ich hol ja mit GetFocus nur das handle von dem Control und nich von dem Fenster. Also wie bkommen ich das von dem aktiven Fenster?

Danke im Vorraus
Tom
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mo 12.04.04 19:42 
Also deiner eigenen aktiven Anwendung?
ausblenden Delphi-Quelltext
1:
hWnd := Application.Handle;					

_________________
JSXGraph
scrooge
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 200



BeitragVerfasst: Mo 12.04.04 19:48 
Das gerade aktive Fenster bekommst du mit "GetForegrundWindow".
Dabster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mo 12.04.04 19:57 
OK mit GetForgroundWindow hats funktioniert. Bin jetzt wunschlos glücklich ^^
Danke Danke