Re: Multi VMR9 in VB6



From: "chris2000"

C --> void KEN_SetWindow(HWND m_hWnd , int set);
VB6 --> Public Declare Sub KEN_SetWindow Lib
"MultiVMR9Api.dll" (ByVal m_hWnd As Long, ByVal iSet As
Long)
and when i check
KEN_SetWindow me.hWnd,1
i take this message "Bad DLL calling convention"

C/C++ defaults to a __cdecl calling convention but VB6 only
supports __stdcall, which is the native Windows calling
convention.

If you can compile the DLL, either set the default calling
convention to __stdcall in the project's properties or
(better) explicitly declare each function as __stdcall. If
you can't, then you will need to write a proxy library that
uses __stdcall in a language that supports __cdecl (e.g.
C/C++ or any .NET language and many others) or give up VB6.
Notice that __stdcall does not support vararg calls.



--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


.



Relevant Pages

  • Re: Mixed stdcall and cdecl code
    ... >> convention. ... I link to a 3rd party static library that apparently uses the ... >> errors from the linker until I changed my project settings from stdcall ... The 3rd party did not explicitly declare a calling convention in ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: calling convention stdcalll and cdecl call
    ... According to my understanding of what a calling convention ... But the point is that stdcall could easily have used this ... could support variadic functions (but it does appear to me that a few ... It could be argued that any modification to existing calling ...
    (microsoft.public.vc.language)
  • Re: _BeginThread & the Ex variant
    ... BeginThreadEx DEMANDS a thread function to specify __stdcall calling ... Because a function that calls another function must know what calling ... convention the function it is calling uses. ...
    (comp.programming.threads)
  • Re: Threads on class,
    ... It does work on x86 due to the use of __stdcall which changes the calling ... convention from the default __thiscall. ...
    (microsoft.public.vc.language)
  • Re: Threads on class,
    ... It does work on x86 due to the use of __stdcall which changes the calling ... convention from the default __thiscall. ...
    (microsoft.public.windowsce.embedded.vc)

Loading