Run-Time Linking to Wtsapi32.dll Home
Run-Time Linking to Wtsapi32.dll

If your application is designed to run in a non-Remote Desktop Services environment, but you would like the application to provide additional functionality when it does run in a Remote Desktop Services environment, the application can use the Remote Desktop Services API to implement the additional functionality, and dynamically link to the Wtsapi32.dll at run time. To do this, your application should call the LoadLibrary function to load Wtsapi32.dll. If the LoadLibrary call fails, your application can run using its basic functionality. If LoadLibrary succeeds, your application can call the GetProcAddress function to retrieve pointers to the Remote Desktop Services functions that you want to call.

If your application is intended only for a Remote Desktop Services environment, dynamic linking is not necessary. In this case, you can include Wtsapi32.h and link with Wtsapi32.lib. Then, if your application starts up in a non-Remote Desktop Services environment, it will exit because Wtsapi32.dll is not present.

For information about determining whether your application is running in a Remote Desktop Services environment, see Detecting the Remote Desktop Services Environment.

Send comments about this topic to Microsoft

Build date: 10/19/2009

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View