Service Returns NULL Windowstation and Desktop Handles

Last reviewed: December 23, 1996
Article ID: Q161337
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) for Windows NT, versions 3.51, 4.0

SUMMARY

On Windows NT 3.51, GetProcessWindowStation() and GetThreadDesktop() will return NULL handles from a service that has not called any USER or GDI APIs.

MORE INFORMATION

Initially, a service will not have a windowstation and desktop associated with it. In order to associate a windowstation and desktop to the service, the service must call a USER or GDI API that interacts with the service's desktop such as GetDesktopWindow() or CreateDC(). Once one of these APIs has been called, GetProcessWindowStation() and GetThreadDesktop() will return valid handles.

On Windows NT 4.0, a service will have a windowstation and desktop associated with it initially so there is no need to call a USER or GDI API to connect the service to the windowstation and desktop.

REFERENCES

For more information on windowstations and desktops, please refer to the Win32 SDK documentation.


KBCategory: kbprg
KBSubcategory: BseService
Additional reference words: 3.51 4.00 kbdss



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 23, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.