Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

16 to 32bit call

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 16 to 32bit call


    I was able to call a 32bit dll from 16bit using the examples in pbdll 20
    Is this still a safe technique?

    On w95 it returns the correct value

    Can we use this in a professional application?


    ------------------
    [email protected]
    hellobasic

  • #2
    it should work fine... search the bbs for "call32" and you should find some discussions that will help you...

    for example, http://www.powerbasic.com/support/pb...ead.php?t=1694

    ------------------
    lance
    powerbasic support
    mailto:[email protected][email protected]</a>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Thanks Lance,

      I have trouble with NT but call32 is something i try next

      I really hope this functionality is working on win2000 for the next year until we rewrote our app to 32bit.




      ------------------
      [email protected]
      hellobasic

      Comment


      • #4
        Great, it works!

        But is it true that a result variable can only be a Word variable?
        Not really bad but something i would like to know.

        ------------------
        [email protected]
        hellobasic

        Comment


        • #5
          Edwin,
          I have used Call32 extensively and it works great. There are a few things you must
          do if you want to declare and call more than one procedure as PB has restrictions
          on declares. This is the way I do it.

          James


          Code:
          DECLARE _
            FUNCTION _
              Declare32 Lib "call32" ( _
                szFunc        AS ASCIIZ,_
                szLibrary     AS ASCIIZ,_
                szArgs        AS ASCIIZ _
              ) AS LONG
          
          
          GLOBAL gCall32Ids() AS LONG
          
          
            hCall32Lib = LoadLibrary("CALL32.DLL")
            IF ISFALSE hCall32Lib THEN
          	Msgbox "LoadLibrary of CALL32.DLL failed"
          	FUNCTION = 0
          	EXIT FUNCTION
            END IF
          
            gCall32Address = GetProcAddress(hCall32Lib,"Call32")
          
          
          REDIM gCall32Ids(32)
          
            gCall32Ids(2) = Declare32("NewDlgMsg","adp01","p")
            gCall32Ids(3) = Declare32("AdpTest2","adp01","i")
            gCall32Ids(4) = Declare32("FindUdt","adp01","ppp")
            gCall32Ids(5) = Declare32("FindEquate","adp01","ppp")
            gCall32Ids(6) = Declare32("FindDeclare","adp01","ppp")
            gCall32Ids(7) = Declare32("NewWmCommandMsg","adp01","p")
            gCall32Ids(8) = Declare32("NewDialogRc","dt","p")
          
          DECLARE _
            FUNCTION _
              NewDialogRc ( _
                    sztemp    AS ASCIIZ, _
              BYVAL Id        AS LONG _
          	 ) AS LONG
          
          
          CALL DWORD gCall32Address USING NewDialogRc(szTemp,gCall32Ids(8)) TO lRetVal

          ------------------

          Comment


          • #6
            JC.

            I blinked with my eyes for about 20 times before i understood your code

            I have great succes in VB3 using simple api declares and aliases on the callproc32.
            (Each call with diff. params is an alias to callproc32w)

            But this statement concerns me a bit:

            GlobalFix
            The GlobalFix function is obsolete. It is provided only for compatibility with 16-bit versions of Windows. Win32-based applications should use the VirtualLock and VirtualUnlock functions.

            2)
            Windows 95/98: The VirtualLock function is implemented as a stub that has no effect and always returns a nonzero value.

            Did you had any problems with this?



            ------------------
            [email protected]
            hellobasic

            Comment


            • #7
              Edwin, you *are* writing 16-bit code, right? GlobalFix() is a 16-bit API, and should be supported by all Win32 platforms that support Win16 applications..



              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                Ok, but my question is also if i should use it?

                It's not funny if i need to GlobalFix the parameters.
                I was thinking maybe VB keeps them locked anyway while jumping to an API.

                I use VB3 vars (fixed sizes like long or dynamic string prefilled up to nnnn chars)
                And place them as byref in the declare.
                In VB > ByVal Text As String
                In PB > Text As Asciiz

                I tried it on diff. windows versions.
                It all seems to work ok.
                MSDN states that globalfix on NT is not required.

                It might be i misunderstand things here.

                Just some experiances from different users would be nice...

                Thanks,



                ------------------
                [email protected]
                hellobasic

                Comment

                Working...
                X