Click here to Skip to main content
15,911,306 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: msvcrt version Pin
vikramlinux5-Nov-04 0:52
vikramlinux5-Nov-04 0:52 
GeneralRe: msvcrt version Pin
shiraztk5-Nov-04 1:39
shiraztk5-Nov-04 1:39 
GeneralRe: msvcrt version Pin
vikramlinux5-Nov-04 1:43
vikramlinux5-Nov-04 1:43 
GeneralAll child window background color in mdi application Pin
vc-programmer-4-Nov-04 17:05
vc-programmer-4-Nov-04 17:05 
GeneralRe: All child window background color in mdi application Pin
vikramlinux4-Nov-04 23:36
vikramlinux4-Nov-04 23:36 
GeneralWindow API Const/Marco Pin
ting6684-Nov-04 16:50
ting6684-Nov-04 16:50 
GeneralRe: Window API Const/Marco Pin
Aamir Butt4-Nov-04 20:46
Aamir Butt4-Nov-04 20:46 
QuestionVirtual Destructors in COM? Pin
pmahindrakar4-Nov-04 14:44
pmahindrakar4-Nov-04 14:44 
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/access violation issue when the objects go into final release.


So I’m just wondering whether anyone has any advice with relation to automation, and how to appropriately dispose of objects.All the destructors are virtual in the component. Is that causing any problem? Could anyone please clarify that whether the destructors should be made virtual in COM? I am happy to send the project if required.



Thanks in advance.





AnswerRe: Virtual Destructors in COM? Pin
ThatsAlok4-Nov-04 19:03
ThatsAlok4-Nov-04 19:03 
AnswerRe: Virtual Destructors in COM? Pin
User 2155974-Nov-04 20:21
User 2155974-Nov-04 20:21 
GeneralRe: Virtual Destructors in COM? Pin
ThatsAlok4-Nov-04 22:39
ThatsAlok4-Nov-04 22:39 
GeneralWave Sample Rate Pin
Anthony98874-Nov-04 14:30
Anthony98874-Nov-04 14:30 
QuestionShould I make namespace std global? Pin
Link26004-Nov-04 14:04
Link26004-Nov-04 14:04 
AnswerRe: Should I make namespace std global? Pin
Christian Graus4-Nov-04 14:14
protectorChristian Graus4-Nov-04 14:14 
AnswerRe: Should I make namespace std global? Pin
Ryan Binns4-Nov-04 18:15
Ryan Binns4-Nov-04 18:15 
AnswerRe: Should I make namespace std global? Pin
Link26004-Nov-04 19:26
Link26004-Nov-04 19:26 
GeneralRe: Should I make namespace std global? Pin
Ryan Binns4-Nov-04 20:38
Ryan Binns4-Nov-04 20:38 
GeneralRe: Should I make namespace std global? Pin
Link26004-Nov-04 21:29
Link26004-Nov-04 21:29 
GeneralRe: Should I make namespace std global? Pin
Mike Beckerleg4-Nov-04 22:39
Mike Beckerleg4-Nov-04 22:39 
GeneralRe: Should I make namespace std global? Pin
Antony M Kancidrowski4-Nov-04 23:33
Antony M Kancidrowski4-Nov-04 23:33 
GeneralRe: Should I make namespace std global? Pin
Ryan Binns5-Nov-04 1:36
Ryan Binns5-Nov-04 1:36 
GeneralAutomatically unlock workstation Pin
xueshunnai4-Nov-04 11:59
xueshunnai4-Nov-04 11:59 
GeneralRe: Automatically unlock workstation Pin
Ryan Binns4-Nov-04 18:19
Ryan Binns4-Nov-04 18:19 
GeneralProperty Window Pin
goacas4-Nov-04 9:34
goacas4-Nov-04 9:34 
Questionstarting an image project in VC++? Pin
ashsri4-Nov-04 9:33
ashsri4-Nov-04 9:33 

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.