-
October 8th, 2013, 07:16 AM
#1
[RESOLVED] VC++ 2010 OLE WinXP
Hi,
i made solution which make OLE call.
Call:
HTML Code:
oCredentials.CreateDispatch("LTSERVER.LTCREDENTIALS.1");
oCredentials.put_UserName( (LPCTSTR)str_GCUsername );
oCredentials.put_Password( (LPCTSTR)str_GCPassword );
SCODE nRet = oLabourTime.SetCredentials( oCredentials );
CLTCredentials.h:
HTML Code:
#import "C:\\Program Files\\OLEprogram\\OLEServer\\OLEServer.exe" no_namespace
// CLTCredentials wrapper class
class CLTCredentials : public COleDispatchDriver
{
public:
CLTCredentials(){} // Calls COleDispatchDriver default constructor
CLTCredentials(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CLTCredentials(const CLTCredentials& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
// ILTCredentials methods
public:
CString get_UserName()
{
CString result;
InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
void put_UserName(LPCTSTR newValue)
{
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
CString get_Password()
{
CString result;
InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
void put_Password(LPCTSTR newValue)
{
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x2, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
// ILTCredentials properties
public:
};
Problem is:
Works perfectly in Windows 7 but not in Windows XP.
This "C:\\Program Files\\OLEprogram\\OLEServer\\OLEServer.exe" does not start in XP.
XP SP3
Net Framework 3.5 SP1.
Thanks for any help.
-
October 8th, 2013, 07:30 AM
#2
Re: VC++ 2010 OLE WinXP
Why do you use double-backslashes in #import?
There should be single backslashes in the path name! See examples in MSDN.
Victor Nijegorodov
-
October 8th, 2013, 07:48 AM
#3
Re: VC++ 2010 OLE WinXP
Thanks Victor.
Double-backslashes changed to single backslashes but this does not help and like i write this works fine in Win 7.
-
October 8th, 2013, 07:57 AM
#4
Re: VC++ 2010 OLE WinXP
Well, does the file "C:\Program Files\OLEprogram\OLEServer\OLEServer.exe" exist on the XP machine?
Was it registered?
Victor Nijegorodov
-
October 8th, 2013, 08:00 AM
#5
Re: VC++ 2010 OLE WinXP
Yes, this file exist in XP machine but what you mean registered ?
I can start OLEServer.exe manually and this work like i want.
-
October 8th, 2013, 08:14 AM
#6
Re: VC++ 2010 OLE WinXP
What do you mean by "'OLEServer.exe' does not start in XP"?
Victor Nijegorodov
-
October 8th, 2013, 08:22 AM
#7
Re: VC++ 2010 OLE WinXP
I see in Task manager at OLEServer.exe does not start in XP but in Win 7 it starts.
Off course first i call it CreateDispatch.
-
October 8th, 2013, 08:26 AM
#8
Re: VC++ 2010 OLE WinXP
Originally Posted by Kivju
I see in Task manager at OLEServer.exe does not start in XP but in Win 7 it starts.
Off course first i call it CreateDispatch.
Did it not start or just failed to start? Is there some info in Windows event log?
Victor Nijegorodov
-
October 8th, 2013, 11:59 AM
#9
Re: VC++ 2010 OLE WinXP
Originally Posted by VictorN
Did it not start or just failed to start? Is there some info in Windows event log?
Not start and nothing in Windows event log.
I tried this in two platform (XP) without good result.
Is there some kind toolkit for VC 2010 or cause this error from wrong Framework ?
Probably i just try coding this with VC 2008 or what you think about that ?
-
October 8th, 2013, 12:10 PM
#10
Re: VC++ 2010 OLE WinXP
Originally Posted by Kivju
Is there some kind toolkit for VC 2010 or cause this error from wrong Framework ?
Probably i just try coding this with VC 2008 or what you think about that ?
I don't know.
What is OLEServer.exe? Where is it from and what is it for?
What is the value of _WIN32_WINNT? If it is 0x600 or higher try to set it to 0x502
Victor Nijegorodov
-
October 8th, 2013, 12:12 PM
#11
Re: VC++ 2010 OLE WinXP
Originally Posted by Kivju
Yes, this file exist in XP machine but what you mean registered ?
I can start OLEServer.exe manually and this work like i want.
It doesn't matter if you can start it. The question was: is it registered?
How much you know about OLE? About COM technology? Do you know that to be properly invoked any COM/OLE server has to be registered? In your particular case it shoul look like: OLEServer.exe /regserver
Last edited by Igor Vartanov; October 8th, 2013 at 12:15 PM.
Best regards,
Igor
-
October 9th, 2013, 01:44 AM
#12
Re: VC++ 2010 OLE WinXP
Originally Posted by Igor Vartanov
In your particular case it shoul look like: OLEServer.exe /regserver
Registering does not help.
I know something about OLE but normally was very easy to made new project with VC++ and after that add new class -> MFC Class From Typelib.
After choice current type librarie -> wizard generate automatically necessary header files eg. CLTCredentials.h
OLEServer.exe is installed program which get information to web.
I think at this install / register is ok because i see this in Availabe type libraries list ?
-
October 9th, 2013, 03:18 AM
#13
Re: VC++ 2010 OLE WinXP
Debugging Win7 and COleDispatchDriver::GreateDispatch returned value = 1 but
same return value in XP is 0
-
October 9th, 2013, 03:25 AM
#14
Re: VC++ 2010 OLE WinXP
Victor Nijegorodov
-
October 9th, 2013, 05:49 AM
#15
Re: VC++ 2010 OLE WinXP
CreateDispatch returning scode = CO_E_NOTINITIALIZED ($800401F0).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|