|
-
Oct 19th, 2000, 10:29 AM
#1
Thread Starter
Hyperactive Member
Why does the API CopyMemory behave in a variant of ways?
Eg
If I want to move a type to a string then I have to use
Code:
sTemp = Space$(Len(ETU7CallType))
CopyMemory ByVal sTemp, SomeCallType, Len(sTemp)
but if I want to copy a string to a type then I have to use
Code:
CopyMemory guETU7Type, ByVal sTGB, Len(guETU7Type)
I know there are reasons and I would just like to know why - cos I'm fed up of having to reload the project after vb crashes!
-
Oct 19th, 2000, 11:08 AM
#2
transcendental analytic
IT's crashes because you don't know how a string is stored. Strings in vb are unicode by default, so the memory space needed for a string is 2*the length of the string. Therefore either convert the string first or feed a smaller string.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 20th, 2000, 02:45 AM
#3
Thread Starter
Hyperactive Member
Knowledge
I know that byval sends the value of the stated variable, but that still hasn't really explained *why* in the first example the source is sent byref and not byval.
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
|