WM6.1: Remote Desktop Client disconnects after 10 minutes

Print This Post Print This Post

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:RDMkeepBusy VS2005 Source - (Hits: 767, size: 7.64 KB) DOWNLOAD:RDMkeepBusy ArmV4i Exe - (Hits: 1227, size: 1.84 KB)

13 Comments

  1. Justin says:

    What if i am using a windows mobile 5 unit with rdc 6.0? is this not compatable?

  2. Josef says:

    I did not test it on WM5. If the resources windows title and class name match those of RDM in WM6, the tool should also work with WM5 remote desktop connection. Just give it a try, if it does not work, let me know.

  3. eDo says:

    Hi, I’m connecting with RDM with WM v6.1 using this application. When it pass 5 minutes, I can see the mouse moving but when it pass 10min. the session is log off, promting me the error that you speak in this page.

    Do you know what it`s happening?

    Thanks!

  4. hjgode says:

    Hello eDo

    I dont know exactly what is happening on your device. Possibly the window (TSSHELLWND)is not found. Possibly you have to change the timeout from FIVEMINUTES to 3 minutes.

    Are you a developer? If so, open the project file in EVC4 and then debug it remotely.

    regards

  5. eDo says:

    Hello, my problem it`s resolved. The problem is that Remote Desktop Mobile must be configured by checking and .

    Thanks!!!

  6. CM says:

    I have the same problem eDo had.
    He said “Hello, my problem it`s resolved. The problem is that Remote Desktop Mobile must be configured by checking and .”
    I would like to know what was the complete solution.

    Thanks.

  7. admin says:

    Hello CM

    I am sorry, but I dont know more than the reply of eDo says.

    Maybe he/she is talking about option []Save Password?

    sorry

    Josef

  8. Chris says:

    M3 Sky MC-7500S 1D Barcode scanner

    Current setup has Dolphin 9500 scanners working but I checked the RDP-TCP settings, client settings and group policy settings on both servers.
    I was still getting the error –

    “The remote session was ended because the idle timeout limit was reached. This limit is set by the server administrator or by network policies.”

    This message is a lie as it is actually that the scanner was running Windows Mobile 6.1.
    Further research states that WM 6.5 fixes the problem but when the M3 doesnt have 6.5 available yet .

    I stumbled upon this website and it solved my problem perfectly.

    Thanks

  9. eDo says:

    Maybe it’s too late but I wanted to say that I solved the problem configuring RDM checking on settings this two options: “Full screen” and “Fit remote desktop to sreen”.

    Now, one year later I’m searching how can I execute only one instance of the program. I search some information on this page (http://blogs.msdn.com/b/raffael/archive/2009/09/11/remote-desktop-mobile-rdp-client-disconnects-after-10-minutes-of-inactivity.aspx) but using the v2 solution, after compile I have many link errors that I dont know how to resolve.

    If someone knows any solution….

    Thanks!

  10. Robert says:

    @eDo To compile that source code for v2 solution, you have to define “TH32CS_SNAPNOHEAPS=0×40000000″ and include the library “toolhelp.lib” in your project. Hope that helps.

  11. [...] Mobile II – 8,075 viewsWindows mobile worker thread to post form data using a queue – 6,982 viewsWM6.1: Remote Desktop Client disconnects after 10 minutes – 6,186 [...]

  12. semi says:

    Hi, I don’t understand what i have to with this exe file.
    Thank you

  13. josef says:

    I am sorry, than I cannot help you

    ~josef

Leave a Reply