Question

Dick Stone on Tue, 25 Oct 2016 15:15:19


This is part of a solution to another problem I posted. However, I'd like to separate it out it make it less confusing.

I need to change one line in a Microsoft routine called CRecentFileList::Add in a Microsoft file called filelist.cpp. that is part of the Microsoft Foundation Classes.

1) Can I copy over filelist.cpp into my program as a new file?  If so, how?

2) Or should I change filelist.cpp and recompile the MFC?

Sponsored



Replies

Wyck on Tue, 25 Oct 2016 15:27:29


The function is virtual, so you can try creating a new class CMyRecentFileList, that inherits from CRecentFileList and override the Add method.

RLWA32 on Tue, 25 Oct 2016 15:47:20


I suggest you find an appropriate location within your own code to initialize and uninitialize COM instead of changing MFC source.

And don't forget that the shell requires the STA.

Wyck on Tue, 25 Oct 2016 17:15:16


I strongly agree with RLWA32.  If you are trying to find a place to CoInitialize, then you should do it as part of your application (or thread) init.

Perhaps your question is less confusing without the context of your original question, but more context is better because it seems that you're probably headed down a bad path in a "how do I stick a fork into a toaster" kind of way.

Dick Stone on Tue, 25 Oct 2016 18:15:51


OK -- I got it working with to CoInitialize.

Thanks.

RLWA32 on Tue, 25 Oct 2016 18:19:51


OK -- I got it working with to CoInitialize.

Where did you put the code?

Did you remember to insert an appropriately placed call to CoUninitialize()?