|
-
Mar 31st, 2001, 02:04 PM
#1
Thread Starter
PowerPoster
Ok, I've got a question about the API. In a book that I am reading, it says that all strings that are passed to an API function need to have a null terminated character appened to the end of the string. Here's my dilemma, in all of his examples he does not do this? So when would I want to append the String with the null character? Just need some clarification
-
Mar 31st, 2001, 02:08 PM
#2
Addicted Member
in my experience, you can pass strings to the API without a trailing null string and it will work fine. What version of VB are you using? I use VB6 and i've never had to add null strings to make certain functions work.
-
Mar 31st, 2001, 02:11 PM
#3
Thread Starter
PowerPoster
I'm using VB6 Enterprise.
-
Mar 31st, 2001, 04:52 PM
#4
Thread Starter
PowerPoster
-
Mar 31st, 2001, 04:59 PM
#5
I've never had to do this in VB before. I usually pass it ByVal, and it works fine.
Code:
SendMessage hWnd, WM_MESSGAE, &H34, ByVal "MyString"
Is this book for VB? Or C?
-
Mar 31st, 2001, 05:01 PM
#6
Thread Starter
PowerPoster
It's a VB book, it says that if you do not use a null-terminating character at the end of the string, the program will possibly crash cause' it doesn't no when to stop reading the string. As much as you use it Megatron, if you haven't had any problems, I wont bother worrying about it then
-
Mar 31st, 2001, 05:10 PM
#7
Even if you do run into problems (which you probably wont) you could always add the null character manually.
Code:
MyStr = MyStr & vbNullChar
-
Mar 31st, 2001, 05:11 PM
#8
Thread Starter
PowerPoster
Thanks for clearing it up for me Megatron...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|