|
I have a MDI project that allows the user to open and close different views.
What I would like to do is have the menu change based on which views are
currently open. I have read that MFC keeps a common copy of the menu for
each template. Therefore changing the menu will causes all document menus
to also change.
So, do I have to update the menu each time a different view is active,
including being sensitive to the document, or is there a trick to modifying
the menus. If no trick exists, then where is the best place to do the
changing of each menu. Should this be done in MDIActivate or in MainFrame?
Any suggestions would be helpful.
Thanks in advance.
Eldon Zacek
Czech-Mate Enterprises, LLC
|
|
|
|
|
Check this:
http://www.njnet.edu.cn/info/ebook/c++/vc524h/ch23/ch23.htm
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Thanks for the response. This example is how I have been doing it. This works
OK but everytime you make a change to the menu structure, you have to
duplicate it for every menu resource. What I would like to do, is have the
core menu resource and add the each view's unique menu's resource as needed.
This desire appears to be the problem. You are no longer changing a unique
menu ID but one shared by more than one view/document.
If you have any other insite, please let me know.
Thanks.
Eldon Zacek
Czech-Mate Enterprises, LLC
|
|
|
|
|
Eldon Zacek wrote:
What I would like to do, is have the
core menu resource and add the each view's unique menu's resource as needed.
As I remember this example,it use tow different menu,I think you have to take a look at again.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Yes, the example uses two different menus. They both have an unique resource
for each menu. What I want to do is have a common resource ID for all menus
and add/delete from the menu as different views are opened and closed.
This is also a passage from the "C++ Users Guide" about menus and MDI
applications:
"Multiple MDI child windows of the same document type share menu resources. If several MDI child windows are created by the same document template, they can all use the same menu resource, saving on system resources in Windows."
As you can see this presents an interesting problem. If I change the menu
for one document. Those changes will be reflected in all the opened documents.
This is the other problem I am trying to solve.
Thanks.
Eldon Zacek
Czech-Mate Enterprises, LLC
|
|
|
|
|
I am trying to make a win32 PE program perform
a CRC check on itself when executed, and quit
if the check fails.
I know how to implement a CRC check, but how should
I make the program read the bytes of its own executable?
Is it possible to just open the exe using ReadFile or will this cause an error?
Also, the program is non-MFC, so I require a solution that
does not make use of MFC.
Any help appreciated!
Thanks.
|
|
|
|
|
You can open the file with shared read only access.
I use a separate program to open the exe, compute the crc and then write the value to the end of the file. When the exe runs it can compute a crc of itself, minus the last few bytes of the file where the crc is stored, to make sure the file hasn't been modified.
Todd Smith
CPUA 0x007 ... shaken not stirred
|
|
|
|
|
Thanks for the advice, v. helpful
|
|
|
|
|
I would suggest doing it another a seperate thread if the .exe is large. If you are doing it to check if your program has been hacked then using a separate thread also makes it more difficult to hack. Don't do it the second the app starts, but after a while. I'd also look at using something stronger than a CRC, such as MD5.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I have a SMTP mailer component with 8 worker threads sending mails. The problem is that I want to fire event when mail issent and I want to fire event when all mails are sent. The problem is that one of my worker threads has to fire event by asking main thread to fire event. But this doesnt work that way it gives error in kernel32. What seems to be the problem and how can i solve it. I can only fire event when I dont have any thread working.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Did you marshal the interface to the worker thread?
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Well here is the deal. I pass pointer to worker thread of Control Class so they can communicate. Everything works fine untill I call the COntrols public Function to call Private Event firing function and there I get Access violation and VS shows me assembler code. I am using MFC not ATL. I just want my each thread to be able to fire event telling the container that it just sent an email. SO in your opinion what should I do to make things go right. Thanks in advance
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
What are you using to fire an event? There are several ways to communicate between worker threads and your main thread.
Todd Smith
CPUA 0x007 ... shaken not stirred
|
|
|
|
|
I am simply giving each thread a pointer to my Control class. The point is it works fine every way except when I call Control's Public function to call its private function to fire event. The problem is there. ACCESS VIOLATION. I am using MFC. What do you suggest me to do. THis is the code in ThreadProc
pCtl->MailSent();
// and this is thee function MAilSent in Control class
void CSMTPControl::MailSent()
{
FireMailSent(); // This is where it gives access violation
}
//////////////////////
as it is an OCX so I cant use Timer in it otherwise I'll set a volatile global variable and will set timer in main thread to firevent when volatile vairblae asks. But I want something else to do to solve it. cuz it is an OCX i cant just send messages to it beacause it is invisible at run time.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Hi Todd,
Could you give any references to this kind of thing. I'm having touble as well, but from ATL.
Call a COM method, start a worker thread, and return. Worker thread fires a connection point event.
Thanks,
Giles
|
|
|
|
|
While I don't have an answer, let me know how you get on, as i had the same problem when looking at something similar last week.
Mine was with ATL though. I had implemented a connection point in an object, and wanted to be able to start a worker thread from the COM method, so it could return asyncronously. The worker thread would then fire the event before terminating.
Giles
|
|
|
|
|
What is threading model?
soptest
|
|
|
|
|
I used MFC app wizard so i dont know which one is it. But I guess its STA.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
You must marshal interface pointer of that control.
soptest
|
|
|
|
|
I dont know what you mean. But do you mean i should use CoMarshalInterface. But this is a headache isnt there any simple way.Thanx for your help anyway.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
How can i convrt my MFC activeX into MTA model instead of STA.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
A can not help you with MFC.
Just Create ATL project and copy your implementation to ATL control
soptest
|
|
|
|
|
Hi all,
how do I create a new text-based file with a longname like testdata_12099.<somemorenumbers>?
TIA.
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|
|
What's stopping you???
You can use any file creation mechanism MFC/SDK/.NET to do this.
Nish
Has anyone seen my sig?
|
|
|
|
|
very silly!!(I know) the thing was that I used CFile and CStdioFile at first and Open(mylongfilename) was not working. Have had better luck with CreateFile using UNC format, the way it's supposed to be....right?.
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|