![]() |
Windows Terminal Server, Virtualization, Application Delivery, Windows Software Development, Market Analysis, Training Classes and more... |
|
|
Navigation |
|
|||||||||||||||||||
|
|||||||||||||||||||||
|
|
Awards |
|
||
|
||||
Posted by Benny Tritsch on July 4, 2007 – updated on November 30, 2007
[Introduction] [TS API] [Programming Basics] [More Sample Code]
A very simple program shows the good old sandwich programming style that is required if using the TS API. Those of you who did some Win32 API programming in the old days should be familiar with it. Sandwich programming means that you need a function to open a handle as one slice of toast and functions to close this handle and clean up the memory as another slice of toast. All the other functions between the two slices are the beef.
Most Terminal Services programming is done according to the following principles:
Here is some sample code that demonstrates these rather simple principles.
|
#include <stdio.h> |
In the next example, the beef is represented by the WTSEnumerateProcesses function call which returns the number of processes and a pointer to a process structure—PWTS_PROCESS_INFO.
pProcessName is an element (or member) of the process structure. It includes the pointer to a null-terminated string containing the executable name of the process. If you want to find out more about the details of the Terminal Server API, looking into Wtsapi32.h is very helpful.
|
#include <stdio.h> |