visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: Visual Basic :: GetSystemMetrics SM_REMOTECONTROL


By: viztopiaman Great Britain  Date: 13/06/2007 13:17:06  English  Points: 20 Status: Answered
Quality : Excellent
When running a Remote Desktop Session and making the call GetSystemMetrics(SM_REMOTESESSION) it correctly returns a value of 1. However, as I sometimes need to know whether a session is a Remote Desktop one as distinct from a general Terminal Services one I make the call GetSystemMetrics(SM_REMOTECONTROL) but it incorrectly returns a value of 0 even though it should return 1. I don't understand why I can't get this to work especially as I'm fairly sure I tried this a while back (maybe pre: XP SP2) and I think it used to work.
By: VGR Date: 13/06/2007 17:54:38 English  Type : Answer
well, sadly it seems that it is necessary to use 3 different methods to detect system login - one for Win 95/98/NT4, one for Win2000 and one for XP -

WTSRegisterSessionNotification/WM_WTSSESSION_CHANGE only works with XP (NT 5.1)
GetSystemMetrics(SM_REMOTESESSION) only works for Win 95/98/NT4
I don't remember right now the one for Win2K (NT 5.0)

You could also Check out this library: wtsapi32.dll
or search at msdn.microsoft.com for 'IsTerminalServicesEnabled'.

There you can get loads of information regarding
(1) Is TNS enabled on this computer
(2) Is this application running under TNS
(3) The terminal server session

Please note also that the OS may have its part in your problem :
GetSystemMetrics(SM_REMOTECONTROL) is not supported by citrix
By: viztopiaman Date: 13/06/2007 18:13:44 English  Type : Comment
Thanks for the reply. I appreciate what you're saying. My problem is when I make the call GetSystemMetrics(SM_REMOTESESSION) on a Remote Desktop session it correctly returns the value of 1. At this point I know that it can be either a Citrix, Terminal Services or Remote Desktop session but I need to know specifically if it is Remote Desktop, hence, the reason why I am making the GetSystemMetrics(SM_REMOTECONTROL) call which doesn't work. I can't see that any of the other methods provide Remote Desktop related information consequently I'm stuck. It's odd though that SM_REMOTESESSION works and SM_REMOTECONTROL doesn't.
By: VGR Date: 13/06/2007 20:37:31 English  Type : Comment
It's sad, but I think there is no universal solution to your prolem. It's windows ® ;-))

if you can narrow the list of OSes involved, you could perhaps help me think of a solution.
By: viztopiaman Date: 14/06/2007 09:14:28 English  Type : Comment
Don't know about w2k but it goes wrong on Vista too!
By: VGR Date: 14/06/2007 14:06:18 English  Type : Comment
not surprising...

moreover, if you encounter this problem on Vista and you use onyl Vista, then you're probably on your own. You're the pioneer of this problem on Vista ;-)

if you use winXP, there are probably solutions.

Sorry not to be able to solve the issue. I can think of possible ways to exploit, though ; if you could install an executable on each client machine, you could probably retrieve some environment variables telling you what the type of connection it is.
By: OpConsole Date: 04/07/2007 16:56:08 English  Type : Comment
do you have more error feedback ? you can also ask us to Close the Question.

or....

If you found some of the above comments to have proved helpful in solving your issue, you shall Accept the Answer or sPlit points between the various useful comments. Each one can receive a quality evaluation from + (somewhat helpful) to +++ (working solution).

By: OpConsole Date: 01/11/2007 16:15:16 English  Type : Comment
Dear,

If you found some of the above comments to have proved helpful in solving your issue, you shall Accept the Answer or sPlit points between the various useful comments. Each one can receive a quality evaluation from + (somewhat helpful) to +++ (working solution).

Given this Question has been Open for quite a while now, please accordingly "accept an Answer" ASAP

This Question will be randomely force-closed in one month from now.

Thanks and regards.

Admin.

Do register to be able to answer

EContact
browser fav
page generated in 350.415950 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page