Making a copy of an object

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using an Adobe COM object and most of the classes aren't exposed - just the interfaces. This has made development with C# a pain in the ass since I can't just use the new keyword- I have to initialize the variables (of the interface type) to the value of a corresponding object existing within the COM object. I don't like this and I'm sure it will cause problems down the road. Is there a way to make a complete copy of the memory used by the object in the COM? Here's some example code of what I am having to do now. Thanks in advance for suggestions
Josh Usovsk

private void defineDocPresets(ref InDesign.ApplicationClass theApp, ref id.DocumentPreset size8, ref id.DocumentPreset size9

//Initialize variable to an object already in existence, since there is no constructo
InDesign.DocumentPreset size8 = (InDesign.DocumentPreset)theApp.DocumentPresets.FirstItem()
..
}
 
Hi Josh,

Thanks for your post. I am checking this issue and will update you with my
information.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hello Josh,

I reviewed your description carefully. As I understand, you want to copy
the content of a COM object to another. Please correct me if there is any
misunderstanding. Now I'd like to share the following information with you:

As you know, the internal of a COM object consists of member functions and
variables. So, we are not able to make a copy of an object by memory copy.
To work around the problem, I strongly recommend you create another COM
object, and then export all the variables/properties (public, protected and
proviate members) of the source COM object to the new one.

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top