[RESOLVED] VC++ 2010 OLE WinXP
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Thread: [RESOLVED] VC++ 2010 OLE WinXP

  1. #1
    Join Date
    May 2003
    Location
    Turku/Finland
    Posts
    77

    [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.

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,532

    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

  3. #3
    Join Date
    May 2003
    Location
    Turku/Finland
    Posts
    77

    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.

  4. #4
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,532

    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

  5. #5
    Join Date
    May 2003
    Location
    Turku/Finland
    Posts
    77

    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.

  6. #6
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,532

    Re: VC++ 2010 OLE WinXP

    What do you mean by "'OLEServer.exe' does not start in XP"?
    Victor Nijegorodov

  7. #7
    Join Date
    May 2003
    Location
    Turku/Finland
    Posts
    77

    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.

  8. #8
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,532

    Re: VC++ 2010 OLE WinXP

    Quote Originally Posted by Kivju View Post
    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

  9. #9
    Join Date
    May 2003
    Location
    Turku/Finland
    Posts
    77

    Re: VC++ 2010 OLE WinXP

    Quote Originally Posted by VictorN View Post
    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 ?

  10. #10
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,532

    Re: VC++ 2010 OLE WinXP

    Quote Originally Posted by Kivju View Post
    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

  11. #11
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,050

    Re: VC++ 2010 OLE WinXP

    Quote Originally Posted by Kivju View Post
    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 01:15 PM.
    Best regards,
    Igor

  12. #12
    Join Date
    May 2003
    Location
    Turku/Finland
    Posts
    77

    Re: VC++ 2010 OLE WinXP

    Quote Originally Posted by Igor Vartanov View Post
    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 ?

  13. #13
    Join Date
    May 2003
    Location
    Turku/Finland
    Posts
    77

    Re: VC++ 2010 OLE WinXP

    Debugging Win7 and COleDispatchDriver::GreateDispatch returned value = 1 but
    same return value in XP is 0

  14. #14
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,532

    Re: VC++ 2010 OLE WinXP

    And what does COleException* pError point to?
    http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx
    Victor Nijegorodov

  15. #15
    Join Date
    May 2003
    Location
    Turku/Finland
    Posts
    77

    Re: VC++ 2010 OLE WinXP

    CreateDispatch returning scode = CO_E_NOTINITIALIZED ($800401F0).

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center