WM6.1: Remote Desktop Client disconnects after 10 minutes

Update 2. august 2010: There is a fixed RDM client for WM6.5 which is available to OEMs to include in there ROM images. Possibly you get it with an OS update of your device and will not see this issue any more. See also http://blogs.msdn.com/b/raffael/archive/2009/09/11/remote-desktop-mobile-rdp-client-disconnects-after-10-minutes-of-inactivity.aspx

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 in internet lead to this assumption. So regardless of your server or client settings, RDM will disconnect after 10 minutes of user idle.

RDM_IdleTimeout

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 "stdafx.h"
#include
#include 

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
    SHELLEXECUTEINFO sei = {0};
    sei.cbSize = sizeof(sei);
    sei.nShow = SW_SHOWNORMAL;
    sei.lpFile = TEXT("\\Windows\\wpctsc.exe");
    sei.lpParameters = TEXT(" ");
    if (!ShellExecuteEx(&sei))
    {
        MessageBox(NULL, TEXT("Couldn't launch RDP Client"), TEXT("Remote Desktop Launcher"), MB_OK | MB_TOPMOST | MB_SETFOREGROUND);
        goto Exit;
    }
	else
		Sleep(500);

    //Now every X minutes check if it's still running and if so "refresh" its window
    //if it's no longer running, exit
    do
    {
        //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();
            //Sleep(500);

            //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"));
            SetForegroundWindow(hWndRDM);

            //The timer is reset when the rdp window receives mouse or keyboard input
            //with no MOUSEEVENTF_ABSOLUTE the move is relative

			DEBUGMSG(1, (L"MOUSEEVENTF_MOVE 1\n"));
            mouse_event(MOUSEEVENTF_MOVE, 100, 0, 0, 0);
            Sleep(250);
			DEBUGMSG(1, (L"MOUSEEVENTF_MOVE 2\n"));
            mouse_event(MOUSEEVENTF_MOVE, -100, 0, 0, 0);

            ////Give focus back to previous foreground window
            //SetForegroundWindow(hWndForeground);

            //Sleep
			DEBUGMSG(1, (L"Sleep ...\n"));
            Sleep(FIVEMINUTES);
        }
        else
        {
			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

Exit:
	DEBUGMSG(1, (L"Exit!\n"));
    if (NULL != hWndRDM)
        CloseHandle(hWndRDM);

    return 0;
}

The downloads:

[Download not found] [Download not found]