From: Simon on
I thought IsGUIThread would be a useful function to try with a problem
I have at the moment. However, IsGUIThread always seems to return
true.

I tried it first as the first line in the winmain of a windows app:

DWORD res = ::IsGUIThread(FALSE);

and res was 1.


So I though, OK, I'll do a console app:

int main()
{
DWORD res = ::IsGUIThread(FALSE);
return 0;
}


and res was 1.


So I thought OK, I'll do a console app and even launch a nice fresh
thread (grasping at straws):



#include <windows.h>
#include <process.h>

void MyProc(void* data)
{
DWORD res = ::IsGUIThread(FALSE);
}
int main()
{
::_beginthread(MyProc, 0, 0);
Sleep(10000);
return 0;
}

and res was still 1.


Any idea what it is that I am not getting? OS is Windows XP SP3 32-
bit.

From: patrick on
On 29 sep, 11:04, Simon <renegade_master_12...(a)yahoo.co.uk> wrote:
> I thought IsGUIThread would be a useful function to try with a problem
> I have at the moment.  However, IsGUIThread always seems to return
> true.
>....
> Any idea what it is that I am not getting?  OS is Windows XP SP3 32-
> bit.

It's probably because the exe is always attached to a desktop (the
default desktop here as you're logged on the current window station)

From: Simon on
On 29 Sep, 14:34, patrick <patrick.beltra...(a)caramail.com> wrote:
> On 29 sep, 11:04, Simon <renegade_master_12...(a)yahoo.co.uk> wrote:
>
> > I thoughtIsGUIThreadwould be a useful function to try with a problem
> > I have at the moment.  However,IsGUIThreadalways seems to return
> > true.
> >....
> > Any idea what it is that I am not getting?  OS is Windows XP SP3 32-
> > bit.
>
> It's probably because the exe is always attached to a desktop (the
> default desktop here as you're logged on the current window station)

So, under what circumstances would IsGUIThread ever be false?
Perhaps running as a service?