Click here to Skip to main content
11,715,491 members (74,665 online)
Click here to Skip to main content

Tagged as

WM6.1: Remote Desktop Client disconnects after 10 minutes

, 4 Jan 2010 CPOL 8.1K
Rate this:
Please Sign up or sign in to vote.
Unfortunately Remote Desktop Mobile (RDM) Client, if part of your Windows Mobile 6.1 device, will disconnect after 10 minutes of user idle time...

Unfortunately Remote Desktop Mobile (RDM) Client, if part of your Windows Mobile 6.1 device, will disconnect after 10 minutes of user idle time. This value seems to be hardcoded into the application. Various searches on the internet lead to this assumption. So regardless of your server or client settings, RDM will disconnect after 10 minutes of user idle.


The following code is from this blog. For those of you not being able to compile the code, I have attached an ArmV4i executable you can use directly on your device.

Here is the code:

// RDMkeepBusy.cpp : Defines the entry point for the console application.
#include <span class="code-string">"stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
    int const FIVEMINUTES = 1000*60*5; //1000 ms
    HWND hWndRDM = NULL;
	//First check if TSC is already running???
    //Firstly launch RDP Client
    sei.cbSize = sizeof(sei);
    sei.nShow = SW_SHOWNORMAL;
    sei.lpFile = TEXT("\\Windows\\wpctsc.exe");
    sei.lpParameters = TEXT(" ");
    if (!ShellExecuteEx(&amp;sei))
        MessageBox(NULL, TEXT("Couldn't launch RDP Client"), 
	TEXT("Remote Desktop Launcher"), MB_OK | MB_TOPMOST | MB_SETFOREGROUND);
        goto Exit;
    //Now every X minutes check if it's still running and if so "refresh" its window
    //if it's no longer running, exit
        //check if RDP Client is running, otherwise exit
		DEBUGMSG(1, (L"FindWindow 'TSSHELLWND'...\n"));
        hWndRDM = FindWindow(_T("TSSHELLWND"), NULL);
        if (NULL != hWndRDM)
            ////Get foreground window -- this is not needed 
	   ///if RDM is launched Full-Screen as it was in this case
            //hWndForeground = GetForegroundWindow();
            //Give focus to the RDP Client window (even if the logon screen, 
            //in case user logged out in the meantime)
			DEBUGMSG(1, (L"SetForGroundWindow\n"));
            //The timer is reset when the rdp window receives mouse or keyboard input
            //with no MOUSEEVENTF_ABSOLUTE the move is relative
            mouse_event(MOUSEEVENTF_MOVE, 100, 0, 0, 0);
            mouse_event(MOUSEEVENTF_MOVE, -100, 0, 0, 0);
            ////Give focus back to previous foreground window
			DEBUGMSG(1, (L"Sleep ...\n"));
			DEBUGMSG(1, (L"FindWindow failed for 'TSSHELLWND'\n"));
            //RDP Client is not running - let's exit
            goto Exit;
    while (TRUE); //The check (NULL != hWndRDM) is already done inside the loop
	DEBUGMSG(1, (L"Exit!\n"));
    if (NULL != hWndRDM)
    return 0;

<!-- Social Bookmarks BEGIN -->

<!-- Social Bookmarks END -->


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Germany Germany
No Biography provided

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150901.1 | Last Updated 4 Jan 2010
Article Copyright 2010 by hjgode
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid