RSS Forums RSS
Please support our C advertiser: Programming Forums
Views: 4396 | Replies: 3 | Thread Tools  Display Modes
Join Date: Jun 2005
Posts: 11
Reputation: aaron_tan is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
aaron_tan aaron_tan is offline Offline
Newbie Poster

help on data type conversions

  #2  
Jun 7th, 2005
I desperately need help on data type conversions. I am working on converting a set of codes in Visual Basic to C but i'm faced with a lot of problems dealing with strings. Can anyone help me out here? Below is the code I have in Visual Basic.

Private Function RegGetStringValue(ByVal hKey As Long, _
                                   ByVal sValue As String, _
                                   dwDataSize As Long) As String

   Dim sDataRet As String
   Dim dwDataRet As Long
   Dim success As Long
   Dim pos As Long
   
  'returns number of spaces based on dwDataSize
   sDataRet = Space$(dwDataSize)

  'get the size of the null terminating char
   dwDataRet = Len(sDataRet)
   
   success = RegQueryValueEx(hKey, sValue, _
                             ByVal 0&, dwDataSize, _
                             ByVal sDataRet, dwDataRet)
                             
   If success = ERROR_SUCCESS Then
      If dwDataRet > 0 Then
      
         pos = InStr(sDataRet, Chr$(0))
         RegGetStringValue = Left$(sDataRet, pos - 1)
         
      End If
   End If
End Function
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the C Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:12 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC