locked
IDispatch::Invoke fails in 2005 RRS feed

  • Question

  • I am dynamically linking to an activeX control with CWnd::CreateControl()

     

    In v2003 of Visual Studio, the following code succeeds...

     

    HRESULT hr = m_pDispatch->Invoke(nDispId, IID_NULL, LOCALE_USER_DEFAULT,

    wFlag,&m_DispParms,pResult,

    &m_ExceptionInfo,&m_nArgError);

     

    However,  in v2005 of Visual Studio, the return code is DISP_E_EXCEPTION

    and the OCX control has returned the error "Set not Supported"

     

    The ActiveX control licensed, but I pass the same license string to both CreateControl calls.

    Same machine, with v2003 and v2005 installed.

    My v2005 project is unicode, not sure how that matters.

     

    I have searched for differences in v2003 and v2005 implimentation w/o success.

    Any guess would be welcome.

    Tuesday, October 9, 2007 7:16 PM

Answers

  •  

    Aleksandr,

     

    Thanks for your time.  I have found the cause of the problem.  As usual, when the customer says that nothing has changed, he is lieing.  Of course, the change was not obvious, but I did accidentally stumble across it.

     

    As it turns out, ActiveX Controls have some properties that can be set by developers, and some that can be set by users.  I think these are managed with something like

     

    Code Block
    CWnd::OnAmbientProperty().

     

     

     

    Anyway, somewhere in our program we added a routine to overload this call, and in this case we forced a TRUE to return from OnAmbientProperty(), which apparently somehow told the ActiveX control I was loading that I was not able to modify the property I was attempting to modify.

     

    I guess the control was doing it's best to tell me that when it set the error of "set not permitted", but in my ignorance I didn't understand.

     

    Again, thanks for your time, and sorry to waste it.

    Wednesday, October 10, 2007 5:53 PM

All replies

  • Can you profile your application with depends.exe? May be some dll incompatiblity problems?

     

    depends.exe comes with Windows Support Tools or SDK or Visual studio of any version.

     

    There is F7 command, or profile menue item allows to run application and see some dependence or method call problem.

    Tuesday, October 9, 2007 8:44 PM
  •  

    I found depends.exe off the "Visual Studio 2005 Command Prompt".

    It showed only MSJava.DLL, and MPR.DLL on both the executable and the .ocx in question.

    I believe that both of those are false postives.

    Tuesday, October 9, 2007 9:05 PM
  • Can you open your .exe file then

     

    Profile command will appear in main manue.

    Then select Profile->Start profiling...

    Select all checks and watch for output may be you'll see somthing intresting there.

     

    Tuesday, October 9, 2007 9:12 PM
  • I really don't have any idea what I am looking at.... but here is the output...

     

    GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsAlloc") called from <snip>. Error: The specified procedure could not be found (127).

    GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsGetValue") called from <snip> and returned NULL by thread 1. Error: The specified procedure could not be found (127).

    GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsSetValue") called from <snip> Error: The specified procedure could not be found (127).

    GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsFree")

     

    I got the above a few times, plus

     

    GetProcAddress(0x77C10000 [c:\windows\system32\MSVCRT.DLL], "_get_terminate") called from "c:\windows\winsxs\x86_microsoft.vc80.debugcrt_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_5490cd9f\MSVCR80D.DLL" at address 0x10207A53 and returned NULL by thread 1. Error: The specified procedure could not be found (127).

     

    For Sanity Purposes I ran the same thing against the executable where I have no problems, it also came up with

    GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsAlloc") called from "c:\windows\system32\MSVCR71D.DLL" at address 0x10203372 and returned NULL by thread 1. Error: The specified procedure could not be found (127).

    GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsGetValue") called from "c:\windows\system32\MSVCR71D.DLL" at address 0x10203386 and returned NULL by thread 1. Error: The specified procedure could not be found (127).

    GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsSetValue") called from "c:\windows\system32\MSVCR71D.DLL" at address 0x1020339A and returned NULL by thread 1. Error: The specified procedure could not be found (127).

    GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsFree") called from "c:\windows\system32\MSVCR71D.DLL" at address 0x102033AE and returned NULL by thread 1. Error: The specified procedure could not be found (127).

    but not the _get_terminate call...

     

    Is any of this helpful?

     

     

    Tuesday, October 9, 2007 10:00 PM
  •  

    FlsAlloc - its normal.

     

    Can you say the location of MSVCRT.DLL in case when application works normal, and in case when application fails?

    Wednesday, October 10, 2007 7:43 AM
  •  

    Aleksandr,

     

    Thanks for your time.  I have found the cause of the problem.  As usual, when the customer says that nothing has changed, he is lieing.  Of course, the change was not obvious, but I did accidentally stumble across it.

     

    As it turns out, ActiveX Controls have some properties that can be set by developers, and some that can be set by users.  I think these are managed with something like

     

    Code Block
    CWnd::OnAmbientProperty().

     

     

     

    Anyway, somewhere in our program we added a routine to overload this call, and in this case we forced a TRUE to return from OnAmbientProperty(), which apparently somehow told the ActiveX control I was loading that I was not able to modify the property I was attempting to modify.

     

    I guess the control was doing it's best to tell me that when it set the error of "set not permitted", but in my ignorance I didn't understand.

     

    Again, thanks for your time, and sorry to waste it.

    Wednesday, October 10, 2007 5:53 PM
  • AOA all,

    I have also the same prblom. The dependancy walker show the following error.

    GetProcAddress(0x7C800000 [KERNEL32.DLL], "FlsAlloc") called from "MSVCR71D.DLL" at address 0x10203372 and returned NULL. Error: The specified procedure could not be found (127).

    GetProcAddress(0x7C800000 [KERNEL32.DLL], "FlsGetValue") called from "MSVCR71D.DLL" at address 0x10203386 and returned NULL. Error: The specified procedure could not be found (127).

    GetProcAddress(0x7C800000 [KERNEL32.DLL], "FlsSetValue") called from "MSVCR71D.DLL" at address 0x1020339A and returned NULL. Error: The specified procedure could not be found (127).

    GetProcAddress(0x7C800000 [KERNEL32.DLL], "FlsFree") called from "MSVCR71D.DLL" at address 0x102033AE and returned NULL. Error: The specified procedure could not be found (127).

    Please help me in this regards.
    Thanks
    Monday, August 30, 2010 10:12 AM