Some days ago, I published my RDP_Autologin
code: RDP_Autologin
As there were some screen metrics hardcoded and more and more devices come with a VGA screen, the hardcoded QVGA values will not match. So I extended the first version and implemented some additional logic and settings.
First, the emulated screen tap has been adjusted to depend on the device screen width and height. For that, I included the HIRES_AWARE
resource to get the real screen size.
...
DWORD dX = (0xFFFF / iScreenWidth) * (80);
DWORD dY = (0xFFFF / iScreenHeight) * (iScreenHeight - 13);
...
BOOL getScreenSize(){
int iScreenX = GetSystemMetrics(SM_CXSCREEN);
int iScreenY = GetSystemMetrics(SM_CYSCREEN);
DEBUGMSG(1, (L"\ngetScreenSize: x=%i, y=%i\n", iScreenX, iScreenY));
if(iScreenX>0)
iScreenWidth=iScreenX;
if(iScreenY>0)
iScreenHeight=iScreenY;
if(iScreenX+iScreenY > 0){
_itow(iScreenWidth, sScreenWidth, 10);
_itow(iScreenHeight, sScreenHeight, 10);
return TRUE;
}
else
return FALSE;
}
...
The rdp file defaults for desktop width and height will also be calculated but you can set the default to use via the registry.
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\RDP_autologin]
"startOnExit"="\\rdp_keepbusy.exe"
"DesktopHeight"=dword:000001E0
"DesktopWidth"=dword:00000280
"Computer"="192.168.0.2"
"FitToScreen"="0"
"FullScreen"="0"
"Username"="rdesktop"
"Password"="xxxx"
"Domain"=""
"Save Password"="1"
"Status"="connecting..."
As you can see, I added a line where you can specify an application that will be started at the end of the autoconnect process: startOnExit
.