GetGUIThreadInfo()

This is a discussion on GetGUIThreadInfo() within the Windows Programming forums, part of the Platform Specific Boards category; Hello, In my application I am making a call to GetGUIThreadInfo() but it returns 0. After making a call to ...

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    104

    GetGUIThreadInfo()

    Hello,

    In my application I am making a call to GetGUIThreadInfo() but it returns 0. After making a call to GetLastError() I see that it's returning 87; which hints to the fact that I am passing an incorrect parameter. Here is how I invoke it:
    Code:
        GUITHREADINFO info;
        char buff[256];
        info.cbSize = sizeof(GUITHREADINFO);
    
        GetGUIThreadInfo(GetCurrentThreadId(), &info);
        GetWindowText(info.hwndActive, buff, 256);
        printf("Current Window: %s\n", buff);
    The MSDN documentation indicates that the only thing required in order to let a call to GetGUIThreadInfo() function properly is setting the GUITHREADINFO's cbSize member to sizeof(GUITHREADINFO), which I am doing.

    What can be wrong?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    >> What can be wrong?

    It worked fine on my system.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    104
    On mine it doesn't

    I am running Windows XP
    Last edited by abraham2119; 07-31-2009 at 01:25 AM.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    >>On mine it doesn't

    Well, MSDN does say to use GetWindowThreadProcessId or NULL (to get the current process info), although I can't imagine why GetCurrentThreadId wouldn't work.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using GetGUIThreadInfo
    By meb4u in forum Windows Programming
    Replies: 6
    Last Post: 11-13-2002, 01:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21