WD_CopyPSToString() returns nothing to buffer being allocated with specified bytes.

Verrouillé WD_CopyPSToString() returns nothing to buffer being allocated with specified bytes.

  • mercredi 18 juillet 2012 23:26
     
     

    WD_CopyPSToString(Byval intWinHdl As Integer, ByVal StartPos As Integer, ByVal strBuffer As String, ByVal intBufferLen As integer) returns an integer.  I need this function copy the string on Presentation Space at specific location and saves the string in parameter strBuffer. I allocated strFBuffer with 43 spaces by statement Dim strBuffer As String = Space(43).  This function returns a string to strFBuffer successfully in VB6.  But It failes in VB.NET.  In VB6, the strBuffer is allocated as follows.  Dim strBuffer As String * 43.  In VB.NET the strBuffer is allocated as follows.  Dim strBuffer As Stirng = Space(43).  This function was executed successfully in VB6 and VB.NET.  bUT srtBuffer got a correct string and strBuffer got nothing in VB.NET.  I appreciate all tips and helps in advance.  Sorry about typo error and incorrect grammar.  "Body" does not allow me to correct errors.

Toutes les réponses

  • jeudi 19 juillet 2012 00:31
     
     Traitée

    Hi,

    I suspect the first param is a window handle. Then the type should be IntPtr.

    Have a look here how to get a String back from an API function (the GetSystemDircectory example). It uses a Stringbuilder.


    Armin

  • mercredi 1 août 2012 21:32
     
     
    I failed to find a solution on this problem even though I spent a lot of time.  I skipped this prob. and will be back later.