Click here to Skip to main content
12,404,478 members (73,240 online)
   

COM

 
GeneralRe: COM and structures Pin
rwestgraham5-May-05 19:05
memberrwestgraham5-May-05 19:05 
GeneralRe: COM and structures Pin
Jörgen Sigvardsson5-May-05 20:51
memberJörgen Sigvardsson5-May-05 20:51 
GeneralRe: COM and structures Pin
Santosh M. P.5-May-05 4:53
memberSantosh M. P.5-May-05 4:53 
GeneralRe: COM and structures Pin
vishalmore11-May-05 20:57
membervishalmore11-May-05 20:57 
GeneralRe: COM and structures Pin
Imtiaz Murtaza11-May-05 21:57
memberImtiaz Murtaza11-May-05 21:57 
GeneralRe: COM and structures Pin
vishalmore11-May-05 23:08
membervishalmore11-May-05 23:08 
GeneralThe problem while transfer C to MASM. really need your help. Pin
Anonymous29-Apr-05 20:06
sussAnonymous29-Apr-05 20:06 
Generalusing MSRdp control in windows application Pin
Behlool29-Apr-05 1:44
memberBehlool29-Apr-05 1:44 
Hi
I want to use the MSRdp (Microsoft Remote Desktop control) control from VC windows application but i dont want the control to be visible i want to create it programmatically. i used CoCreateInstance all things goes right and all the functions return S_OK but it doesnot get the session created on server however when i put the MSRdp control on the dialog box and use the same code from there it get connected .... and session is also created on server... Plz reply ASAP

this is the code i used for it

IID IID_RDP =
{0x9059f30f,0x4eb1,0x4bd2,{0x9F ,0xDC,0x36, 0xF4,0x3a, 0x21,0x8F, 0x4A}};


void Connect()
{
::CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
DISPID dispid =0;

IDispatch* pDisp = NULL;

CString text;
GetDlgItemText(IDC_SERVER,text);
HRESULT hr;


hr = ::CoCreateInstance(IID_RDP,NULL,CLSCTX_SERVER ,IID_IDispatch,(void **)&pDisp);
pDisp->AddRef();

//Setting Username and server
SetProperty(pDisp,OLESTR("Server"),(OLECHAR *)text.AllocSysString());
GetDlgItemText(IDC_USER,text);
SetProperty(pDisp,OLESTR("UserName"),(OLECHAR *)text.AllocSysString());
SetProperty(pDisp,OLESTR("Domain"),(OLECHAR *)"");

//setting password
DISPPARAMS dispparams;
EXCEPINFO escep;
UINT uArgErr =0;

VARIANT Result;
::VariantInit(&Result);
Result.vt =VT_DISPATCH;
dispparams.cArgs = 0;
dispparams.rgvarg = NULL;
dispparams.cNamedArgs = 0;
dispparams.rgdispidNamedArgs = NULL;

OLECHAR *szMem=OLESTR("AdvancedSettings2");
hr = pDisp->GetIDsOfNames(IID_NULL,&szMem,1,::GetUserDefaultLCID(),&dispid);

hr =pDisp->Invoke(dispid,IID_NULL,::GetUserDefaultLCID(),
DISPATCH_PROPERTYGET,&dispparams,&Result,&escep,&uArgErr);

IDispatch *pAdvanced = 0;
pAdvanced = Result.pdispVal;
pAdvanced->AddRef();
GetDlgItemText(IDC_PASSWORD,text);
SetProperty(pAdvanced,OLESTR("ClearTextPassword"),(OLECHAR*)text.AllocSysString());

hr =pAdvanced->Invoke(0x68,IID_NULL,::GetUserDefaultLCID(),
DISPATCH_PROPERTYGET,&dispparams,&Result,&escep,&uArgErr);
BOOL value = Result.boolVal;
//setting startup app
szMem=OLESTR("SecuredSettings");
pDisp->GetIDsOfNames(IID_NULL,&szMem,1,::GetUserDefaultLCID(),&dispid);

hr =pDisp->Invoke(dispid,IID_NULL,::GetUserDefaultLCID(),
DISPATCH_PROPERTYGET,&dispparams,&Result,&escep,&uArgErr);

IDispatch *pSecured = Result.pdispVal;
pSecured->AddRef();
SetProperty(pSecured,OLESTR("StartProgram"),OLESTR("explorer.exe"));

//connecting to server
szMem=OLESTR("Connect");
pDisp->GetIDsOfNames(IID_NULL,&szMem,1,::GetUserDefaultLCID(),&dispid);

hr = pDisp->Invoke(dispid,IID_NULL,::GetUserDefaultLCID(),
DISPATCH_METHOD,&dispparams,&Result,&escep,&uArgErr);
pSecured->Release();
pAdvanced->Release();
pDisp->Release();
return;
}


HRESULT SetProperty(IDispatch* pDispatch, OLECHAR* name , OLECHAR* value)
{
HRESULT hr;
VARIANTARG varg;
::VariantInit(&varg);
OLECHAR* szMem = name;
varg.vt = VT_BSTR;
varg.bstrVal = value;
DISPID dispidNamed = DISPID_PROPERTYPUT;
DISPID dispid;

DISPPARAMS dispparams;

dispparams.cArgs = 1;
dispparams.rgvarg = &varg;
dispparams.cNamedArgs = 1;
dispparams.rgdispidNamedArgs = &dispidNamed;

EXCEPINFO escep;
UINT uArgErr =0;

hr = pDispatch->GetIDsOfNames(IID_NULL,&szMem,1,::GetUserDefaultLCID(),&dispid);
if(SUCCEEDED(hr))
hr =pDispatch->Invoke(dispid,IID_NULL,::GetUserDefaultLCID(),
DISPATCH_PROPERTYPUT,&dispparams,NULL,&escep,&uArgErr);

return hr;
}

GeneralPort Blocking for Windows 98! Pin
URagavSouth28-Apr-05 20:10
memberURagavSouth28-Apr-05 20:10 
GeneralOutlook CreateDispatch error - "No such interface supported" Pin
Nickmatic28-Apr-05 15:39
memberNickmatic28-Apr-05 15:39 
GeneralPeculiar Exception Pin
Nirav Doshi28-Apr-05 6:32
memberNirav Doshi28-Apr-05 6:32 
GeneralRe: Peculiar Exception Pin
Sohail Kadiwala28-Apr-05 23:32
memberSohail Kadiwala28-Apr-05 23:32 
QuestionOLE VB Function equilivent for C++? Pin
BrianBoru28-Apr-05 4:42
memberBrianBoru28-Apr-05 4:42 
AnswerRe: OLE VB Function equilivent for C++? Pin
Vi212-May-05 1:42
memberVi212-May-05 1:42 
GeneralThrowing an event with a nested UDT Pin
GizzoF28-Apr-05 0:18
memberGizzoF28-Apr-05 0:18 
GeneralProperties in COM Pin
ckapil27-Apr-05 23:12
memberckapil27-Apr-05 23:12 
GeneralRe: Properties in COM Pin
ThatsAlok28-Apr-05 0:37
memberThatsAlok28-Apr-05 0:37 
GeneralRe: Properties in COM Pin
ThatsAlok28-Apr-05 1:03
memberThatsAlok28-Apr-05 1:03 
GeneralRe: Properties in COM Pin
ckapil28-Apr-05 1:24
memberckapil28-Apr-05 1:24 
GeneralIStream object string length error Pin
Matt Harvey27-Apr-05 14:09
sussMatt Harvey27-Apr-05 14:09 
GeneralRe: IStream object string length error Pin
Matt Harvey27-Apr-05 16:45
sussMatt Harvey27-Apr-05 16:45 
GeneralMaking DLL from Matlab Pin
marcelgilvega1327-Apr-05 3:39
membermarcelgilvega1327-Apr-05 3:39 
GeneralComponent Accessibility Pin
Robert Findlay27-Apr-05 2:52
memberRobert Findlay27-Apr-05 2:52 
GeneralRe: Component Accessibility Pin
Robert Findlay9-May-05 1:07
memberRobert Findlay9-May-05 1:07 
GeneralNeed help about Office Automation Pin
figer25-Apr-05 21:47
sussfiger25-Apr-05 21:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 21 Jul 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid