|
-
Apr 27th, 2000, 09:37 PM
#1
Thread Starter
New Member
Hi,
I have a very simple question. How do you copy an object? And I'm not talking about creating another reference to an object, I'm talking about creating another copy of an object.
Please help...
Thanx in advance, Steve.
-
Apr 27th, 2000, 09:42 PM
#2
Fanatic Member
memcopy API ??
create a new object reference but don't set it. then use memcopy from the other object.
Don't ask me for code as I've never had to do it before 
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
Apr 27th, 2000, 09:43 PM
#3
Frenzied Member
For some reason you can't, I think it's beacuse of the way the interface and data are combined very closely, I usually incluse a function inside all my class modules that creates a copy of it, but other than that there's not a lot you can do, You could try something with the copymemory API but I don't think it'll work.
-
Apr 27th, 2000, 10:30 PM
#4
PowerPoster
I think memcpy should work... you just have to know the size of your object, as I remember you can get it using LenB(Var)...
-
Apr 27th, 2000, 10:43 PM
#5
Frenzied Member
LenB doesn't work for objects. Also the object variable is an interface to the object, the data is stored elsewhere, I'm prety sure you'll just create another reference.Try anyway.
-
Apr 28th, 2000, 01:16 AM
#6
Addicted Member
I tend to agree with Sam the only way I've been able to make a copy of an object it create a function that copies each property value to the new object. It's a brute force method but it works.
If anyone has a neater solution I would be all for it.
Glenn D
Development/Analyst
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
|