|
1) Create Bold Font.
2) Use SetFont to set it.
|
|
|
|
|
yes i know
i used a LOGFONT for my new font but i want it to be set on initdialog when the dialog shows, and you don't have a CDC pointer available in that function.
I have it like this:
LOGFONT logFont;
logFont.lfHeight = 8;
logFont.lfWidth = 0;
logFont.lfEscapement = 0;
logFont.lfOrientation = 0;
logFont.lfWeight = FW_BOLD;
logFont.lfItalic = 0;
logFont.lfUnderline = 0;
logFont.lfStrikeOut = 0;
logFont.lfCharSet = ANSI_CHARSET;
logFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
logFont.lfQuality = PROOF_QUALITY;
logFont.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;
strcpy(logFont.lfFaceName, 'Times New Roman');
CFont font;
font.CreateFontIndirect(&logFont);
CFont* oldFont = pDC->SelectObject(&font);
m_FuncNedCtrl.SetWindowText("Example");
pDC->SelectObject(oldFont);
|
|
|
|
|
You want CWnd::SetFont / WM_SETFONT, rather than CDC::SetFont...
Iain,
|
|
|
|
|
Instead of:
CFont font;
font.CreateFontIndirect(&logFont);
CFont* oldFont = pDC->SelectObject(&font);
m_FuncNedCtrl.SetWindowText("Example");
pDC->SelectObject(oldFont);
Do this:
static CFont font;
font.CreateFontIndirect(&logFont);
m_FuncNedCtrl.SetFont(&font);
Regards,
Alvaro
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
Another newbie question
I've got a pointer to a custom CWnd derived class, called CMyWnd. This class is created using the vc resource editor, the resourceID is IDC_MY_WND.
CMyWnd* pMyWnd=new CMyWnd(&parent);
How can I attach this CWnd to the parent CDialog, in such a way that the create method uses the data I've declared inside the resource editor?
CWnd::Create(...) asks for a CRect, windowtype and a windowtitle, but I've already declared them in the resource editor. I want to use them here.
How do I do this?
tnx.
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
I don't think MFC lets you attach a dialog resource to a CWnd derived class, there must be some problem in the code there. If the 'data inside the resource editor' refers to the dialog item you have created, you should derive your class from CDialog instead of CWnd. So that you can call Create() to create a non-modal dialog box (and attach it to a parent CDialog maybe)
|
|
|
|
|
I want to get the the path where the EXE is running. Then, I'm using the GetCurrentDirectory function, but when I running the app EXE from a shortcut, it returns another directory, different of the correct directory.
Any idea or another function ??
Thanks,
Cris.
|
|
|
|
|
The GetCurrentDirectory function returns the directory which was supplied to the CreateProcess call as a parameter and it seems like the windows shell supplies different arguments depending on conditions (which is for example the case if you've auto-run your application through the registry key with windows/currentversion/run as well as the shortcuts). So, my solution is to call GetModuleFileName and parse the directory in it, that is: look for the last backslash character, pretty straightforward.
|
|
|
|
|
Ok, it works well !!
Thanks for your help.
|
|
|
|
|
Yes, as i know, GetCurrentDirectory function have this problem.
maybe you can save its path in registry.
|
|
|
|
|
suppose i define this c function as follow:
//my_c_func.h
extern "C" int a_c_func(void);
//my_c_func.c
#include "my_c_func.h"
int a_c_func(void)
{
//do sth...
return 0;
}
then i add this two file to a C++ program, call this c function, but the
C++ Builder 6 complains "Declaration terminate incorrectly". Why?
Can anyone give me a hint?
Thanks for your time!
|
|
|
|
|
What is 'extern' achieving here ? If it where me, I'd be whacking this in an anonymous namespace at the top of the cpp file where it's getting called.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
In fact, i just have to use some functions from a lib written in C,so that why
i do it this way. i use extern "C", so i can use those functions' names directly(C++ do name-mangling, you know).
|
|
|
|
|
Ah - I see. But if they're in a lib, how do you have the c code, instead of just the header ? Or was the example flawed ?
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Yes, you are right. i just have its header files. I want to call the functions directly. how can i achive this target?
thank you,Christian!
kirk
|
|
|
|
|
Have you tried this way, it compiles fine under VC++6.0, if not it could be a c++ builder specific problem.
in my_c_func.h:
int a_c_func(void);
and in your cpp file:
extern "C" {
#include "my_c_func.h"
}
|
|
|
|
|
Yes, it works!
Baris, thank you, you are my hero of today.
and Christian, thanks for your immediate responses.
kirk
|
|
|
|
|
kirk he wrote:
Baris, thank you, you are my hero of today.
That reminds me of a MCSP advertisement in my ex-company saying "How does it feel to save the world everyday?"
Glad to help.
|
|
|
|
|
The background: I have some ascii files in my project for use with custom build.
They all have the same file tag (*.PMC)
These files have specific formatting, so I want have VC++ (6) recognise them, and
use keyword colouring, auto indent etc. MSDN implies that you can do this (they give
a custom html (*.hlx) example) but it doesn't work.
Has anyone succeeded in this? What steps did you follow that I may have missed?
I can work without it, but I'm lazy and like to get my IDE to do the work for me!
Iain.
|
|
|
|
|
I have seen a few of Tree/list Ctrl combinations, but all of them are showing tree in the first column of the list, and the parameters of nodes in the rest columns.
I need to write <b>Ctrl that would show tree nodes in columns of the list</b>( nodes of the same level in the same column).
Has anybody solution or some guidlines how to do that?
Please, don't forget that parent nodes has to make column span if the grid is shown
I think that somthing similar I have seen on some web pages but i can't find if now ;(
<b><big>Any help would be appreciated !!!!!! thx!</big></b>
Preky
|
|
|
|
|
write your own control ! much work but full satisfaction !
//be cool
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
Yes I'm going to do that
Any suggestion where to start from? What kind of base class to use, or just do I have to start from CWnd ?
Anyone?!??!
Every suggestion is welcome!
Preky
|
|
|
|
|
hi,
Is it possible to clear the contents of the debug window programatically?.
thanx
viraj
|
|
|
|
|
Does anyone know how to use IAMVideoAccelerator or where to find a sample ?
Thanks a lot
Olivier
|
|
|
|
|
dear all,
i'm facing a very wierd problem in the following code (only SDK, No MFC)
int i= GetPrivateProfileString("Paths", "InputFile", " " ,inp,MAXCHARS, IniPath);
i get the following error ->
C:\Documents and Settings\rishabhs\Desktop\Source\source\window_click\window_click.c(123) : error C2143: syntax error : missing ';' before 'type'
now when i use following code, every thoing is fine ->
int i;
i = GetPrivateProfileString("Paths", "InputFile", " " ,inp,MAXCHARS, IniPath);
i've no clue whatsoever regarding this problem
any ideas!!!!!!!!
regards
|
|
|
|