|
Something like this should work:
CFont f1;
LOGFONT lf1;
::ZeroMemory(&lf1, sizeof(lf1));
lf1.lfHeight = 14;
lf1.lfCharSet = ANSI_CHARSET;
lf1.lfWeight = FW_BOLD;
::lstrcpy(lf1.lfFaceName, "Arial");
f1.CreateFontIndirect(&lf1);
GetDlgItem(IDC_BUTTON)->SetFont(&f1);
f1.Detach();
Change lfHeight, lfCharSet and lfWeight to your liking.
|
|
|
|
|
Hi,
I would like to change the appearance of tabs in a multiline edit control, all tabs should have the same width of 8 pixels. MSDN[^] talks about dialog units, where I would like to specify pixels. The following line sets the distance to "something" depending on the font size of the edit control:
int nTabWidth = 8; m_edit.SetTabStops(nTabWidth);
::SendMessage(m_edit.m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&nTabWidth);
How to calculate the correct value? Thanks for any help.
|
|
|
|
|
Moak wrote: How to calculate the correct value?
Not sure about this, but it seems to work...
int nTabWidthInDialogUnits = ::MulDiv(nTabWidth, 4, LOWORD(::GetDialogBaseUnits()));
|
|
|
|
|
EM_SETTABSTOPS message gets tabswidth in dialog units, which equal to: 1 character = 4 dialog units width / 8 dialog units height (independent of the selected font).
As you can see in Remarks section from http://msdn.microsoft.com/en-us/library/bb761663%28VS.85%29.aspx[^], to convert measurements from dialog template units to screen units (pixels), use the MapDialogRect function.
Hope this helps.
|
|
|
|
|
There are many products publicied and which their authors proudly specify the langage/technology in which they are written.
In order to avoid to cite particular site : I can read things like :
"Written in .Net"
"Pure Managed"
"Full Web"
There are many labels and they are as if to serv the good image of the application.
Now, can I do that for a C++ program ?
Unmanaged high performance C++
Do you have other suggestions ?
What about the icon, what can I put ( C++)
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
what about
Pure 100% unmanaged high speed Potato++ software
?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Potato software wrote: Now, can I do that for a C++ program ?
Unmanaged high performance C++ Laugh
Advertise as following...
No Java/Flash/Ajax/.Net/Silverlight/PHP/Perl/Python required.
Optionally with:
Follow us on Youtube/Twitter/Facebook/Lolcats.
Webchat in Europe
No Java/Flash/Ajax/.Net/Silverlight/PHP/Perl/Python required.
Follow us on Youtube/Twitter/Facebook/Lolcats.
|
|
|
|
|
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
Potato Software
Performance-wise only one step short of hand-typed machine code
|
|
|
|
|
Hi
I am useing ODBC 5.1 Driver for connect to MySQL.It's working fine for XP OS.I am getting error on Window Server.on server OS i an able to connect but after connection i am getting error.
Can't create an instance of Command
code
CString por="Driver={MySQL ODBC 5.1 Driver};";
CString Database="Database="";";
CString User="User=";
CString Userp=root;
CString password=";Password=";
CString Passwords=root;
CString option=";Option=3;";
CString final=por;
final +=Database;
final +=User;
final +=Userp;
final +=password;
final +=Passwords;
final +=option;
CoInitialize (NULL);
_bstr_t strCon(final);
try
{
HRESULT hr = m_pConn.CreateInstance (__uuidof (Connection));
if (FAILED (hr))
{
}
if (FAILED (m_pConn->Open (strCon,bstrString,bstrString1,0)))
{
AfxMessageBox ("Can't open datasource");
}
GetDlgItemText(IDC_EDIT4,m_cbrow);
GetDlgItemText(IDC_EDIT1,m_host);
if(m_host=="localhost")
{
}
else
{
MessageBox("There is an error to connect with MySQL. Please check your input parameters or server configuration.","Message",MB_ICONEXCLAMATION);
return;
}
AfxMessageBox ("Connection successfully");
_CommandPtr pCommand;
hr = pCommand.CreateInstance (__uuidof (Command));
<code>"Erro showing here"</code>
if (FAILED (hr))
{
AfxMessageBox ("Can't create an instance of Command");
return;
}
::_RecordsetPtr pRecordset;
pCommand->ActiveConnection = m_pConn;
Plz help me.
|
|
|
|
|
|
I have no idea.Plz help me
|
|
|
|
|
Hi All
How can i ReversFind and count number of words?I have CString name="agsdfgggggg" how can count and cut these part "gggggg" from name.
I mean i want to show this CString name="agsdfgggggg" to CString name="agsdf".
Can any one help me.
|
|
|
|
|
Is "agsdfgggggg" a unique string? Is there some pattern? Does it always have the same number of characters?
If you give us a bit more information we may be able to give you better advice than CString::Left(6) for example.
|
|
|
|
|
|
1 2 3 4 5 6
Sorry, couldn't resist...
|
|
|
|
|
I don't blame you.
|
|
|
|
|
Wow, I have no clue what you are talking about but the answer is probably liquid nitrogen[^]
Ok, serriously now. What does ReverseFind have to do with your question ? Why are you talking about words (I only see letters in your string) ? Is your string always "agsdfgggggg" and you always need to remove "gggggg" ? In which case, I don't see why you are asking the question
|
|
|
|
|
Cedric Moonen wrote: Is your string always "agsdfgggggg" and you always need to remove "gggggg" ? In which case, I don't see why you are asking the question
Have you ever tried to use agsdf when it was next to gggggg? It's difficult at best.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
What about
CString name = "agsdfgggggg";
int l = name.GetLength();
int count=0;
while (l-- > 0)
{
if ( name[l] != 'g') break;
count++;
}
if ( count > 0 )
{
name = name.Left(name.GetLength() - count);
}
?
[added]
Sorry for the poor answer, I didn't realize that correct one is LIQUID NITROGEN.
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Let me restate your requirement.
You want the repeating character at the end to be removed.
If this requirement is correct, here is what you can do.
name = name.TrimRight(name[name.GetLength() - 1]);
Of course, you will need error checking, which I have omitted.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
If I have two HKEY handles how could I compare them?
How could I get the full registry tree path of an open HKEY?
I could not find between the Reg... functions any one
which could help me to solve above two problems.
|
|
|
|
|
I assume you want to read the registry keys and compare them. There's tons of articles on how to read values from the registry.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|