Herzlich Willkommen, lieber Gast!
  Sie befinden sich hier:

  Forum » C / C++ (WinAPI, Konsole) » GetWindowThreadProcessId

Forum | Hilfe | Team | Links | Impressum | > Suche < | Mitglieder | Registrieren | Einloggen
  Quicklinks: MSDN-Online || STL || clib Reference Grundlagen || Literatur || E-Books || Zubehör || > F.A.Q. < || Downloads   

Autor Thread - Seiten: > 1 <
000
24.05.2008, 00:29 Uhr
~Ron
Gast


Hi,

I have some problems using 'GetWindowThreadProcessId()'. I call this function from C#.
If I use it to determine a ThreadID of a foreign process (for example windows calculator) it works fine. But if I use it to get a ThreadID of a selfwriten C#-Application it always returns 0.

Why it the return value always 0?

Code:

Code:
            try
            {
                Process p = GlobalMethods.startProcessFromFile(this._testumgebung.TestObjektFileName);

                uint dummy;
                uint targetThreadID = ImportedMethods.GetWindowThreadProcessId(p.MainWindowHandle, out dummy);

            }
            catch (Exception e)
            {
...
            }




best regards,
Ron
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
001
29.05.2008, 15:11 Uhr
berniebutt



Sorry Ron, I can't help you with c#. Using c++ there will be no problems with WinApi.
Good luck!
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
002
29.05.2008, 15:37 Uhr
Guybrush Threepwood
Gefürchteter Pirat
(Operator)


hmm most Windows API Functions return 0 when there is an Error. Although the MSDN says nothing about it maybe a call to GetLastError will help to determine what specific Error occurs.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
Seiten: > 1 <     [ C / C++ (WinAPI, Konsole) ]  


ThWBoard 2.73 FloSoft-Edition
© by Paul Baecher & Felix Gonschorek (www.thwboard.de)

Anpassungen des Forums
© by Flo-Soft (www.flo-soft.de)

Sie sind Besucher: