Link to home
Start Free TrialLog in
Avatar of sandhya sharma
sandhya sharma

asked on

Not able to launch Remote app

I had this question after viewing Remote App failed to launch using MSTSCLib API.
I have to launch an application remotely. with the below lines of code able to connect remote  desktop. but not able to launch remote application
m_RemoteAppobj = m_RDPClient.get_RemoteProgram2();
m_RemoteAppobj.put_RemoteProgramMode(true);
m_RemoteAppobj.put_RemoteApplicationName(L"Notepad");
m_RemoteAppobj.put_RemoteApplicationProgram(L"C:\\Windows\\System32\\notepad.exe");
void CTestRdpNECTIDlg::OnConnectedMstscax1()
{
      try
      {
            LPCTSTR lpExecutablePath = L"C:\\Windows\\System32\\notepad.exe";
            LPCTSTR lpworkingdirectory = L"c:\\";
            int n=m_RDPClient.get_Connected();
            m_RemoteAppobj.ServerStartProgram(lpExecutablePath,L"",lpworkingdirectory,false ,L"ARGS",false );
      }
      catch(...)
      {
            wchar_t buf[256];
            memset(buf,0,sizeof(buf)/sizeof(wchar_t));
            FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
                  NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                  buf, (sizeof(buf) / sizeof(wchar_t)), NULL);
            AfxMessageBox(buf);
      }
}
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.