It depends... if you mean "is the calling process is running under a remote session, you could obtain the session id for the process and get info for the session to check if it is a remote session, with something like:
DWORD ProcessId; // filled by the calling program using GetCurrentProcessId()
DWORD SessionId, ByteCount;
LPTSTR Buffer;
if (ProcessIdToSessionId(ProcessId, &SessionId))
if (WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, SessionId,
WTSIsRemoteSession, &Buffer, &ByteCount))
if (WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, SessionId,
WTSUserName, &Buffer, &ByteCount))
{ // copy away the user name in Buffer
WTSFreeMemory(Buffer);
}