How to access LPTSTR data in VB

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2008
Posts: 7
Reputation: bubbleT is an unknown quantity at this point 
Solved Threads: 0
bubbleT bubbleT is offline Offline
Newbie Poster

How to access LPTSTR data in VB

 
0
  #1
Jan 23rd, 2008
Hi
currently working on a vb program to access a LPTSTR data in a VC coded function.
My vb program cannot get the string data
my sample code
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Declare Function GetMainWork Lib "LibDWM.dll" (ByVal lpszWNo As String) As Long
  2.  
  3. 'I've tried
  4. 'Declare Function GetMainWork Lib "LibDWM.dll" (ByRef lpszWNo As String) As Long ->doesn't work
  5.  
  6. Private Sub cmdClick()
  7. Dim lret As Long
  8. Dim sdat As String
  9. Dim ss As String
  10. sdat = ""
  11. ss = StrPtr(sdat)
  12.  
  13. 'lret = GetMainWork(StrPtr(ss))->doesn't work
  14.  
  15. lret = GetMainWork(sdat)
  16. ...
  17. End Sub

Some information on the VC function
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. int GetMainWork(LPTSTR lpszWNo);
  2. int GetMainWork(LPTSTR lpszWNo)
  3. {
  4. int retval = 0;
  5. ...
  6. sprintf(lpszWNo, "%s",lpMemDat->wnam) ;
  7. ...
  8.  
  9. return retval;
  10. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC