|
|
Hello,
I have a CWnd-derived class that owns several standard MFC controls (CEdit, CTreeCtrl, etc.) When the user hits the ENTER key, I want the main window to handle the message, regardless of what child has the focus.
What's the best way to do this? My current solution is to sub-class each child control and send a message to the parent when the ENTER key is pressed.
I'm hoping there's a better solution.
Any ideas?
Thanks!
-Ian
|
|
|
|
|
You could use the PreTranslateMessage() function of the app's class.
SkyWalker
|
|
|
|
|
Thanks! I'll give that a shot!
-Ian
|
|
|
|
|
Hi,
I've got a C++ based app that I'm using GDI+ to render with. I'm creating an offscreen graphics object and drawing text into it. Then I later blit that to the screen. However, that text is thicker in the offscreen than normal text onscreen when clear type is on (WinXP). How do I detect if cleartype is turned on?
I found references to GetGraphicsCaps but can't find any documentation on this method and can't use it. I figure I must be missing some SDK.
I assume that if I find that ClearType is on, I should then use Graphics::SetTextRenderingHint with TextRenderingHintClearTypeGridFit to turn it on in my offscreen graphics object.
Can anyone tell me how to tell if ClearType is on?
Thanks,
-Mike
|
|
|
|
|
ClearType is a mechanism for drawing on the screen that takes advantage of the ability to address at the sub-pixel level on color LCD screens.
In the Display control panel applet, there is a general switch to enable ClearType for all applications using TrueType fonts. Applications can detect the state of this global bit using SystemParametersInfo() with the SPI_GETFONTSMOOTHING flag. If font smoothing is enabled, you can query the type of smoothing used with a call to SystemParamtersInfo() using the SPI_GETFONTSMOOTHINGTYPE parameter. The call will return FE_FONTSMOOTHINGSTANDARD if standard anti-aliasing is used and FE_FONTSMOOTHINGCLEARTYPE if ClearType smoothing is enabled.
These parameters can be programmatically changed with the complementary commands to SystemParametersInfo() , SPI_SETFONTSMOOTHING and SPI_SETFONTSMOOTHINGTYPE.
SkyWalker
-- modified at 3:47 Saturday 15th October, 2005
|
|
|
|
|
I have a dialog box full of static text and edit controls that I populate with CStrings. Works great when I call DoModal(), but if I try to make it modless and use Create(IDD_DIALOG_ID) and ShowWindow(SH_SHOW) the dialog box is displayed but none of the static text or controls appear. How do I get the "guts" of the dialog box to be displayed also?
Buck
|
|
|
|
|
What does the OnInitDialog() method look like?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
It was just the default OnInitDialog(). I moved the ShowWindow(SW_SHOW) function into the OnInitDialog() and the static text of the dialog box is now displayed, but the read only edit controls were not. I added the UpdateData() function to no avail but then realized to add the UpdateWindow() function and now it's working the way I want. Sorry, but I'm not a Windows programmer so everthing seems to be a little backwards, including were to put my code to execute the logic my brain is thinking of. Too many years of structured procedural programming. Thanks a lot that saved me an entire days worth of time.
Much appreciation,
Buck
|
|
|
|
|
for your modeless dialog, did you put the dialog variable as either global or as a class member ?
if you do something like
{
MyDialog dlg;
dlg.Create(...);
dlg.ShowWindow(...);
}<pre>
it will only show the dialog in the scope of the current function/method and will be destroyed as soon as you exit the current scope ( function /method ).
<hr><a href="http://www.thesorus.qc.ca">Maximilien Lincourt</a>
Your Head A Splode - Strong Bad
|
|
|
|
|
Very strange! You should not have experienced any of those problems. Simply creating the dialog and showing it should have been enough. If it works, go with it (no harm in this case), and when you have the spare time, try to find out whats realy going on.
INTP
Every thing is relative...
|
|
|
|
|
I need to be able to automatically adjust recording mixer properties from inside my app such as making sure that "Line In" is selected versus Microphone or other device, set record volume to 50% and make sure left/right balance is set to 50%. I have looked at the mixer functions but n ot sure how to proceed. Can someone give me some sample code please? Thank you very much.
Bill Dennis
Orlando, FL
|
|
|
|
|
I have tried trapping the WM_CHAR message within a CDHtmlDialog based dialog but couldn't. I used Spy++ and discovered that the messages WM_KEYDOWN,WM_KEYUP and WM_CHAR were actually sent to my dialog. But they don't get passed to my code in either OnChar,OnKeyDown or OnKeyUp.
I need to handle either of the three messages so that I can read from either my barcode scanner or the keyboard. Please help?
What would life be without programmers and salesmen?
|
|
|
|
|
How could I get the number of bytes a process has written to disk during its run-time on a Windows system?
The process could be any running process like explorer.exe.
I heard there are some ways to do this on other operating systems, like by getting the truss output of the process, but I can't figure out how to do this in Windows.
Could someone suggest any ideas?
|
|
|
|
|
|
Hi folks,
I'm new here and very new to c++ i have however programmed a lot in visual basic.
I have managed to make a window with some controls on it (simple ones) however i have a problem.
How do i read in a gif file and go through it pixel by pixel checking the color? (are there tutorials on this?) then after i have done some calculations how do i rotate the picture like 20 degrees and then save it so i can read the pixels again of the rotated object? (are there any tutorials on this?)
I'm very new to this all but i have to make it for school any help or tips/ideas are welcome
thanks in advance
|
|
|
|
|
u can use GDI+. The classes Graphics and Image let u manupulate images. see msdn help on GDI+ for more.
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
Hi thanks for the fast reply but i have searched and GDI+ seems to be only for .NET? i have the visual c++ 6 version. Do you have by any chance a tutorial for this subject (a link or so?) i'll try searching further hope you can provide me with some links.
greets
|
|
|
|
|
|
Hmmm but when i eventually make an executable of my program doesn't the users need to install GDI+ also on there computer?
|
|
|
|
|
|
Get the spec for a GIF file from http://www.wotsit.org/
To rotate, is just simple geometric calculations, a triangle, you know the angle and you know the length of 1 side, applied to each pixel, don't forget the resulting bit map will be larger than the one you started with.
If you search the net you will find better algorithms.
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
CString strExtra;
TBBUTTON tbb;
tbb.dwData = strExtra;
Of course ,I can't do it like this.
But how could I do so?
Thank you very much.
|
|
|
|
|
What exactly are you trying to accomplish?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
maybe like this :
CString * pStr = new CString;
tbb.dwData = (DWORD)pStr;
|
|
|
|