Problem calling my ActiveX dll , parameter issue I

Results 1 to 2 of 2

Thread: Problem calling my ActiveX dll , parameter issue I

  1. #1
    Tibs Hull Guest

    Default Problem calling my ActiveX dll , parameter issue I

    Ok I have a VB activeX which is really just a wrapper for an existing C DLL. Ive used the C DLL in production and it works fine (in conjunction with a VBA client). Now I am supposed to provide the same functionality to my ASP developer. SO, I just wrapped a function call to the C DLL in the activeX dll. It Seems to work fine when I call it from an ASP page as such...<BR>PS: this is without Dim&#039ing test...<BR><BR>test=deersobj.test("111222333") &#039 Here the social is hardcoded<BR><BR>HOWEVER, if I say something like the following withou Dim&#039ing test I get...<BR><BR>Error Type:<BR>Microsoft VBScript runtime (0x800A000D)<BR>Type mismatch: &#039test&#039<BR><BR><BR>ssn="111222333" &#039Now the social is in a variable<BR>test=deersobj.test(ssn)<BR><BR>If I first Dim test and use the above code I get the same **** thing. Im pretty sure the dll is never called and it bails out before any real work is done.<BR><BR>Basically why will "111222333" work as a parameter and <BR>assigning a variable that value and using it as a parameter<BR>causes the type mismatch error???<BR><BR>Below is releveant code...<BR><BR>___________________________________ ________________________<BR>ASP code<BR>&#060;%<BR> buffer= String(0,5000)<BR> Dim deersobj<BR> Dim ssn<BR> ssn="018544462"<BR><BR> Set deersobj=Server.CreateObject ("project1.class1")<BR> test=deersobj.test(ssn)<BR> &#039buffer=deersobj.callDeers (ssn,buffer)<BR>%&#062;<BR><BR>___________________ ____________________________________<BR>VB Code (ActiveX DLL)<BR><BR>&#039Function code<BR>Public Function test(echo As String)<BR>Dim temp As String<BR>Dim x As Integer<BR>Dim rtval As Integer<BR>temp = String(5000, vbNullChar)<BR>x = fnDeersdll(echo, temp)<BR>test = x & temp<BR>End Function<BR><BR><BR>&#039Declaring the C dll function I export into the activeX dll<BR><BR>Declare Function fnDeersdll _<BR>Lib "D:vsMSDev98MyProjectsdeersdllDebugdeersdll.dl l" _<BR>(ByVal ssn As String, ByVal returned_record As String) As Long<BR>__________________________________________ _______________<BR><BR>// And finally the function declaration in the C DLL<BR>extern "C" DEERSDLL_API int __stdcall fnDeersdll(LPCSTR argv,LPCSTR returned_record) <BR>{<BR> ...bunch of code here<BR>}<BR><BR>

  2. #2
    Steve Cimino Guest

    Default RE: Problem calling my ActiveX dll , parameter iss

    ALWAYS pass in byval in your DLL functions...<BR><BR>Public Function test(ByVal echo As String) &#039Assume as variant? You don&#039t have anything here<BR><BR>This clears up type mismatches in nearly all cases.<BR><BR>Don&#039t name your variable the same as the function. That may be harder to debug later on.

Posting Permissions

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