|
|
To create a dialog control without using the Visual Studio dialog editor, I would declare a control object as a member of the dialog class:
...<br />
public:<br />
CButton btn;<br />
...
then, in the dialog's OnCreate or InitDialog method, I would create the button:
...<br />
btn.Create("Button Label",WS_CHILD|WS_VISIBLE,CRect(0,0,10,30),this,BTN_ID);<br />
...
Which works quite well, except... the font of the button text is different from the text font of a button created through VS's dialog editor. Other controls show various differences in appearence as well (a manually created Edit Control would not have that "sunken" appearence, for instance).
So, how do I manually create dialog controls that match the appearence of those created by the dialog editor? What have I forgotten to do?
I would appreciate it if someone could enlighten me.
SytS
|
|
|
|
|
SytS wrote:
the font of the button text is different from the text font of a button created through VS's dialog editor
If you create a font using the dialog editor, the dialog editor implicitly sets the font for the dialog, usually to something like 'MS Shell Dlg'. Windows or controls you create 'manually' by calling their Create(...) function by default are set to the system font, which is larger and bolder in appearance (depending upon the OS and its version).
You can set the font for the windows you create manually to the default user interface font by calling the control's SetFont(::GetStockObject(DEFAULT_GUI_FONT)) [^] function.
SytS wrote:
Other controls show various differences in appearence as well (a manually created Edit Control would not have that "sunken" appearence, for instance).
This problem has a slightly different source. The 'sunken' appearance is created by a window having the WS_SUNKEN style. You need to make sure that the style flags you specify in your Create(...) call include the options you want. Note that there are extended style flags that you can specify using the CreateEx(...) function that give you more options.
Software Zen: delete this;
|
|
|
|
|
Gary,
The control's SetFont() method requires a CFont * as input parameter; however, the GetStockObject() function returns something of type HGDIOBJ . Is there a way to convert from one type to another?
Update:
I was able to work around this with:
CFont font;<br />
font.CreateStockObject(DEFAULT_GUI_FONT);<br />
btn.SetFont(&font);
But it would nice if the GetStockObject() function can be used directly.
SytS
|
|
|
|
|
You can use this:
btn.SetFont(CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT))); The FromHandle static function in the CFont constructs a temporary object for you. The HFONT type cast converts the HGDIOBJ to an HFONT .
Software Zen: delete this;
|
|
|
|
|
Hello,
I want to know about cpu usage of a program.
For example wmplayer.exe I want to know when this
program have a 0% cpu usage?
Best Wishes.
Thanks.
|
|
|
|
|
this is really not a C++ question.
i have a small web-site, and need a web-site tracker or counter (free) to record count of users visited.
could u give me a link or comments about "best" one?
thanks
includeh10
|
|
|
|
|
These website provides free web counters
- gostats.com
- counter.bizhat.com
- jcount.com
many more.... search free webcounters in Google.by the way please ask these type of wuestion in Open Discussion or Lounge
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
How to detect what URL clicked user ?
I have IWebBrowser2
And can catch On_Navigate2,
but current URL is old,
how to get pressed URL ?
Thanks
|
|
|
|
|
|
Thanks, I will try.
Thanks also for links.
|
|
|
|
|
Instead of IWebBrowser2 , use standard COM methods and register for notifications from the DWebBrowserEvents interface. First query for IConnectionPointContainer interface. Then ask for IConnectionPoint interface for DWebBrowserEvents . Then register your class using IConnectionPoint::Advise .
The class you use must be derived from DWebBrowserEvents and must implement all of it's methods. Unused events should return S_OK. The event you're interested in is DWebBrowserEvents::NavigateComplete. This event will have the final URL where the client was directed to.
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
Thanks you I will try this way.
|
|
|
|
|
How can I get a thread status (wether it's suspended or not?) I looked at all Process and Thread functions and couldn't find a way on how to retrieve that information?
Any ideas would be appreciated!!!
Rob
|
|
|
|
|
Robert Buldoc wrote:
How can I get a thread status (wether it's suspended or not?) I looked at all Process and Thread functions and couldn't find a way on how to retrieve that information?
You could always call SuspendThread(), look at the previous suspend count, then call ResumeThread().
Or, you could lookup the thread structure (http://www.microsoft.com/mspress/books/sampchap/4354b.asp[^]) and try to query the SuspendCount value directly.
I decided to store the suspend state as a flag in my thread class.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Thanks for yoru reply!
I think I am gonna use the thread structure!
|
|
|
|
|
Robert Buldoc wrote:
I think I am gonna use the thread structure!
That way madness lies.
You have been warned.
(Let me know if you get it to work)
...cmk
Save the whales - collect the whole set
|
|
|
|
|
lol..you already scared me!!;P
I think I should use a flag also..
|
|
|
|
|
Hi,
I'm trying to save a local HTML file + images to a single MHT file. I found some C++ example code to do this here: http://www.codeguru.com/Cpp/I-N/ieprogram/comments.php/c4397/?thread=1029
However, when I ran it with a local file reference, such as "file://c:/documents.../index.html", it saves a MHT file. However, the MHT file is about 2KB. If I delete the html and png files, the MHT file shows up as empty. So the images are definetly not being pulled into the MHT files. Does the MHT Builder code only download images if they are not local?
Any comments would be appreciated.
Thanks,
Kevin
|
|
|
|
|
Hi,
I am pretty new to VC++. Can anyone please suggest some game proramming sources in the website which will be of help to me to build a project on Game programming. Hope it is feasible. Thanks for your help.
Regards
|
|
|
|
|
www.gamedev.net
You won't find anything better
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
|
i installed the Platform SDK downloaded from microsoft.com, set the directories of Visual C++. Then made an empty MFC Dialog-based Project, added
#include "basetsd.h"
#include "gdiplus.h"
in stdafx.h after all includes and before #endif and built the project. 6 errors were reported:
F:\PROGRAM FILES\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2501: 'MIDL_INTERFACE' :
F:\PROGRAM FILES\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2440: 'initializing' :
F:\PROGRAM FILES\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2146:
F:\PROGRAM FILES\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2501: 'IImageBytes' :
F:\PROGRAM FILES\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2239:
F:\PROGRAM FILES\MICROSOFT SDK\INCLUDE\GdiplusImaging.h(67) : error C2059:
(I removed the rest of error information of each line because i am using a Japanese version of Visual C++ and it was difficult to display those characters)
<font=sans-serif>|-|3llo Wo|2ld
|
|
|
|
|
By the way, i had added gdiplus.lib to the project
<font=sans-serif>|-|3llo Wo|2ld
|
|
|
|