Click here to Skip to main content
15,918,211 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: fading text out Pin
bektek25-Oct-04 9:21
bektek25-Oct-04 9:21 
QuestionC++ debuggin question - detect change in variable? Pin
Indrawati24-Oct-04 19:16
Indrawati24-Oct-04 19:16 
AnswerRe: C++ debuggin question - detect change in variable? Pin
Lim Bio Liong24-Oct-04 21:21
Lim Bio Liong24-Oct-04 21:21 
GeneralRe: C++ debuggin question - detect change in variable? Pin
dharani26-Oct-04 22:04
dharani26-Oct-04 22:04 
GeneralActiveX and Japanese Pin
phuna24-Oct-04 19:02
phuna24-Oct-04 19:02 
GeneralP310 Encoder Pin
Anonymous24-Oct-04 17:56
Anonymous24-Oct-04 17:56 
GeneralRe: P310 Encoder Pin
newgirls24-Oct-04 19:16
newgirls24-Oct-04 19:16 
GeneralAccess violation error. Pin
pmahindrakar24-Oct-04 16:36
pmahindrakar24-Oct-04 16:36 
I am creating a COM component in VC++ using MFC and automation. The automation process is via the CCmdTarget class and IDispatch. The component is a wrapper for accessing a proprietary binary file which holds information pertaining to a scanning system we use. Specifically each binary file will hold information relating to a particular form setup, such as how many sheets the form has the fields which we are capturing off the form and so on (the package is called IST). A portion of the object model for the file structure is as follows:



Application (only one)

----Records (contains all the fields)

--------Fields

----Documents

--------Sheets

------------Grids (maybe OMR or OCR region on the form, and will link back to one a field)

etc..



The structure is stored on disk in the above manner, and read into structs. The way I have gone about exposing the structs is via nested objects and collections of objects (CTypedPtrArray). So as an example I have exposed the records as IRecord and IRecords, IRecords is a collection of IRecord objects. The annoying aspect of this is that each IRecord object must hold a pointer to the record structure that has been read off disk. This pointer is setup during construction of the collections after it has been read off disk, and will allow us to write back the information to disk if any changes are made.



This is all working fine (from what I can tell) however there appears to be a memory issue when the objects go into final release. It gives access violation error just before the application closes or the control passes the destructor and when using the component from VB it is giving an access violation.



So I’m just wondering whether anyone has any advice with relation to automation, and how to appropriately dispose of objects, as I’m a little confused about the difference between FinalRelease and the destructor. I am happy to send the project if required.



Thanks in advance.


GeneralRe: Access violation error. Pin
bryce24-Oct-04 19:20
bryce24-Oct-04 19:20 
GeneralRe: Access violation error. Pin
pmahindrakar25-Oct-04 20:52
pmahindrakar25-Oct-04 20:52 
GeneralFile Version Pin
picasso224-Oct-04 16:33
picasso224-Oct-04 16:33 
GeneralRe: File Version Pin
bryce24-Oct-04 16:40
bryce24-Oct-04 16:40 
GeneralMS Web Browser Control and activex control in dll Pin
bconline200224-Oct-04 15:43
bconline200224-Oct-04 15:43 
GeneralSplitter Windows OnDraw Pin
Michael Hendrickx24-Oct-04 15:39
Michael Hendrickx24-Oct-04 15:39 
QuestionCould I get the bitmaps stored at display memory Pin
Guoguor24-Oct-04 14:23
Guoguor24-Oct-04 14:23 
AnswerRe: Could I get the bitmaps stored at display memory Pin
Maximilien24-Oct-04 14:56
Maximilien24-Oct-04 14:56 
GeneralRe: Could I get the bitmaps stored at display memory Pin
Guoguor24-Oct-04 15:14
Guoguor24-Oct-04 15:14 
GeneralClass access from windows callback Pin
Member 67873924-Oct-04 13:18
Member 67873924-Oct-04 13:18 
GeneralPreprocessor output Pin
Member 67873924-Oct-04 13:15
Member 67873924-Oct-04 13:15 
GeneralRe: Preprocessor output Pin
Chris Richardson25-Oct-04 11:49
Chris Richardson25-Oct-04 11:49 
GeneralDerive a Queue class from a List class using private inheritance Pin
flowerkarma24-Oct-04 12:11
flowerkarma24-Oct-04 12:11 
GeneralQuestion about XP themes Pin
Marcus Spitzmiller24-Oct-04 9:21
Marcus Spitzmiller24-Oct-04 9:21 
GeneralRe: Question about XP themes Pin
Neville Franks24-Oct-04 10:29
Neville Franks24-Oct-04 10:29 
GeneralRe: Question about XP themes Pin
Marcus Spitzmiller1-Nov-04 16:43
Marcus Spitzmiller1-Nov-04 16:43 
GeneralSimple Assambly inside C code requested. Pin
Link260024-Oct-04 9:18
Link260024-Oct-04 9:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.