|
Could you tell me the way to change the font of menu as well as its items in a application.
Thanks.
|
|
|
|
|
Well, I did it in a Dialog, I suppose it's similar in a menu:
BOOL CDialogoCargos::OnInitDialog()
{
CDialog::OnInitDialog();
CFont m_Font;
m_Font.CreateFont(45,0,0,0,100,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_SWISS,"Arial");
CEdit * pEdit;
pEdit = (CEdit *)GetDlgItem(IDC_EDIT_CARGOS);
pEdit->SetFont(&m_Font,FALSE);
return TRUE;
}
This changes the font an edit box of my dialog.
Hope this helps.
|
|
|
|
|
I've been going round and round for a few hours now, and can't see what's wrong with my application. I have a doc/view application that uses multiple static splitter windows for the views. I created a menu and added handlers for both the command and update messages, in the view class. For some reason, the update message handler is not called prior to displaying the menu, and consequently, the menu is not set up properly (Checked items are not updated). I have verified with another application that works properly that the message maps are created properly.
I realize this is a fairly wide open description of a problem, but so far, I've received excellent suggestions (solutions) for problems I've had in the past with a simple description like this.
Any suggestions on where to look?
Thanks in advance.
|
|
|
|
|
At a guess, I would say that the ON_COMMAND_UI handler come through to the first view added and not those supported in the splitter windows. If you undate handlers are in the spliiter window added views then they would not be called. You have to implement some kind of mechanism which would route these checks through from the first view to these sub-views to allow them to update/act on the commands.
Roger Allen
Sonork 100.10016
I have a terminal disease. Its called life!
|
|
|
|
|
|
Jonathan, Even though I see some behavior that indicates the messages are routed at some level, I'll give your suggestion a try. The behavior I'm talking about is the fact that the ON_UPDATA_COMMAND_UI handler is called after the menu is dismissed, not before. Of course it'll all probably make perfect sense once I get to the bottom of it.
Thanks.
|
|
|
|
|
Tried overriding OnCmdMsg in CChildFrame, and my splitter window. Still no luck. Then I thought I'd try placing the menu items on the main menu bar instead of in the popup menu I was using (an important piece of information I omitted from the original problem statement). The menu bar implementation worked perfectly.
It got me thinking it must have something to do with the way I implemented the popup menu. The only thing I saw was the use of the this pointer as the owner of the popup menu (my view). I changed the owner from this to GetParentFrame(), and everything started working! I suppose the mechanism that implements the ON_UPDATE_COMMAND_UI message is above the View class in this MDI multi splitter window application.
Oh well, live and learn.
Here's the simple change that solved the problem.
was...
subMenu->TrackPopupMenu(0, point.x, point.y,this, NULL);
is... (works)
subMenu->TrackPopupMenu(0, point.x, point.y,GetParentFrame(), NULL);
Thanks anyway for taking the time to respond. Maybe this will help someone else.
|
|
|
|
|
Hello everyone, I first started learning C++ a few years back but I only bothered learning the basics because much like every beginning developer I wanted to create some windows! With this I have created myself a problem, I've started to learn MFC with only the basic knowlege of C++ which makes it incredibly difficult... So this is where I would like to ask help from all of you! Could anyone give me an idea of a console project I could do in C++ that would require atleast intermediate skill in C++ so that I can push myself to learn better C++? I would greatly appreciate any ideas!
|
|
|
|
|
First of all, good for you for being willing to recognise the need to go back to C++ without the MFC trimmings, etc.
You should own 'The C++ Programming Language' by Bjarne Stroustrup if you program C++. If you don't, go out and buy it. As well as being a great reference, it is full of suggested projects so you can choose tasks that relate to the areas you want to learn.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Alright, thanks! I will pick it up this weekend.
|
|
|
|
|
Hey I'm in a big need for a async sockect class that is pretty much a clone of the MFC version, with all it's features.. But importantly Is thread safe! . or doesn't have to be used in a single thread
Any ideas ? I'm looking for any library out there that you guys can recommend , free is good but $$$ is fine if it does the job and is solid.
Thanks heaps!
Jared Allen.
www.chironexsoftware.com
|
|
|
|
|
why do you want to use an async sockect class in more than one thread?
|
|
|
|
|
do you know where can i get a simplest crc32 algorithm written without mfc?
|
|
|
|
|
|
zLib has a pure C implementation
http://www.gzip.org/zlib/
-c
"[it was..] one of those evenings when you feel that not only will there definitely be a revolution, but that the Association of Manufacturers will foot the bill."
-- Umberto Eco, Foucault's Pendulum
|
|
|
|
|
|
Im wondering how to set a "StayOnTop" for some window.
Could anyone help me?
No mfc.
|
|
|
|
|
::SetWindowPos(myHWND, &hwndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
&hwndTopMost might be wrong, but it's something like that, the rest is correct. Check MSDN for the right parameter if I blew it.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
true, it should be:
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
big thx.
|
|
|
|
|
No worries - I think I may have given you the MFC paramters, but so long as it got you on the right path.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
|
You may be trying to make your window always stay on top, if that is the case then you will want to use:
<br />
LONG exstyle = ::GetWindowLong(hwnd, GWL_EXSTYLE);<br />
::SetWindowLong(hwnd, GWL_EXSTYLE, exstyle | WS_EX_TOPMOST);<br />
[edit]If you use the SetWindowPos function, and set the window in the topmost slot, it only temporarily moves your window to the top of the Z-Order for all non-topmost windows. As soon as application focus shifts somewhere else your window will shift away from the top.[edit]
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Paul Watt (kilowatt) wrote:
If you use the SetWindowPos function, and set the window in the topmost slot, it only temporarily moves your window to the top of the Z-Order for all non-topmost windows. As soon as application focus shifts somewhere else your window will shift away from the top.
Sorry, wrong. if you set it to top, it will drop again, but if you set it to topmost, it will stay there.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I know, this is a really novice type of question, but, I'm trying to understand the subject in detail, before I start generating vast numbers of incomprehensible error messages.
In allocating memory dynamically in an application either globally or in a class-specific scope, how does a person know what is actually happening in the "pool called the free store"? Are there ways to monitor this without writing a "custom exception-handling routine" (which in my case, would undoubtedly generate many more error messages)?
...And, (ha ha) I have absolutely NO IDEA what a custom exception-handling routine is, much less, how to approach the problem.
I have been doing some preliminary reading over at the MSDN site, where they have an overwhelming amount of technical information. In the C++ Language Reference, they tell us that: "when new is used to allocate memory for a C++ class object, the object's constructor is called after the memory is allocated". They also tell us that "the new keyword allocates memory for an object or array of objects of type-name from the free store and returns a suitably typed, nonzero pointer to the object". They then show a couple of code examples, but, I don't see how the pointer can be used to demonstrate either the amount of memory used in that particular expression, or if this feature can be utilized to detect that evil scourge 'memory leakage'.
Any enlightenment is appreciated. ...And, humor, even malicious humor (if necessary) will be thoroughly enjoyed.
Trash me,...
|
|
|
|
|
Wow - you're trying to understand some heavy stuff here. FWIW I have no idea what the answer is, excepting that you can use sizeof to get the size of an object, which I presume is what you want to know. However, it doesn't really matter to know how much memory you are in risk of leaking, just make sure you delete everything you new, and you won't leak at all.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|