-
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
-
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.
-
I'm using VB6 Enterprise.
-
-
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?
-
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 :D
-
Even if you do run into problems (which you probably wont) you could always add the null character manually.
Code:
MyStr = MyStr & vbNullChar
-
Thanks for clearing it up for me Megatron...:D