Announcement

Collapse
No announcement yet.

PowerBasic & VB's AddressOf - Data Corruption?

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

  • PowerBasic & VB's AddressOf - Data Corruption?

    Hey there.. here's the skinny..

    Alright I've basically passed a Pointer to a Visual Basic Function to a PowerBasic app. (Using Address Of) The Function is simple, MyString(This as String), I use PowerBasics Call Dword feature to call the Visual Basic routine. Now... the VB routine is successfully executed from PowerBasic, but the data in the String is corrupted, intead of saying "Hello blah blah" it says "???????5???5???5??5 ??? 5" when I recieved by VB. I'm using the String data type in VB and PB. Any suggestions? Does this have something to do with unicode, and being converted to ascii... ? Help!

    Thanks in advance,
    Matty G

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

  • #2
    Matt;

    At first glance I would say this is a Unicode problem !

    When VB calls an external DLL function it will convert the internal
    unicode strings to AsciiZ. Now when VB calls other VB functions,
    likely it never does any conversion of unicode, but simply passes
    a unicode string.

    Now if you try to call a VB function from PB using an address, then
    likely the VB function expects the string to be a unicode string.

    Have you tried converting the PB string to a Unicode string before passing
    it ?



    ------------------
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      Now the question is, how do I convert ANSI to unicode, and do I convert it when i receive the string in Visual Basic, or before I send the string in.. in PB. ? Thanks again.

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

      Comment


      • #4
        Solved the problem, convert to unicode before calling the vbroutine. Thanks for th einput everyone.

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

        Comment

        Working...
        X