|
You'll need to post some code or give a better description of your problem. However, it sounds like you have no message loop (or implemented it incorrectly).
Jeremy Falcon
|
|
|
|
|
deniz79s wrote:
I used direct windowsXP messageBoxes via p/invoke methot.
What is a "p/invoke methot?"
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
i have a program done using the doc/view architecture. i want to change the font of whatever text i display in the view but am unable to figure out how to do so and in which member function of CView such as OnDraw, OnUpdate, etc?
|
|
|
|
|
Hi,
In the OnDraw function you can select a new font into the DC and do all your drawing(text) and it will be in that font.
CTestView::OnDraw(CDC *pDC)
{
CFont NewFont;
NewFont.Create(Specify Parameters);
CFont *pOldFont = pDC->SelectObject(&NewFont);
// Draw your text
// Select old font back
pDC->SelectObject(pOldFont);
}
Hope it helps
Vikash Parida
|
|
|
|
|
or are you on about controls in your view, e.g. CEdit's and CStatics ???
If so, then create a CFont object member in your view
e.g. in OnInitialUpdate
m_fntStyle1.CreateFont(42, 0, 0, 0, FW_BOLD, TRUE, FALSE,0,0,0,0,0,0, "Times New Roman");
m_staticField1.SetFont(&m_fntStyle1);
m_staticField2.SetFont(&m_fntStyle1);
m_staticField3.SetFont(&m_fntStyle1);
The link to MSDN for CreateFont
Hope this helps,
Andy
|
|
|
|
|
|
hi,
i tried to do as u told but the font does not change.
CFont Font;
CFont* pOldFont;
LOGFONT lgFont;
CTextFormatterDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
lgFont.lfHeight = -19;
lgFont.lfWidth = 0;
lgFont.lfWeight = FW_BOLD;
lgFont.lfItalic = TRUE;
lgFont.lfStrikeOut = TRUE;
lgFont.lfUnderline = TRUE;
lgFont.lfCharSet = ANSI_CHARSET;
lgFont.lfOutPrecision = OUT_CHARACTER_PRECIS;
lgFont.lfQuality = DEFAULT_QUALITY;
strcpy(lgFont.lfFaceName, "");
Font.CreateFontIndirect(&lgFont);
pOldFont = pDC->SelectObject(&Font);
pDC->TextOut(0, 0, pDoc->GetText());
pDC->SelectObject(pOldFont);
Font.DeleteObject();
|
|
|
|
|
maxsteel wrote:
strcpy(lgFont.lfFaceName, "");
You need to give the name of the font ("Tahoma", "Times New Roman" etc...)
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have a keyboard hook installed that is working, and it will catch the Alt key for me, but not the ALT + TAB. How can I determine fromt he wParam and lParam if the Alt key is down when they press TAB?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
|
|
Hi I'm looking for an explanation of the REINSTALLMODE_PACKAGE flag of MsiReinstallProduct. MSDN says you can use it to reinstall from another package, for instance to update an installed product. Does anybody know how to set the new source package?
|
|
|
|
|
I tried using memcpy to copy values from an array of unsigned char to another array of the same type.
But when tried to see it using cout , nothing is displayed.
This what I did.
#include "iostream.h"
#include"memory.h"
typedef unsigned char BYTE;
void main()
{
BYTE a[3]="\xff\x00";
//BYTE *p;
BYTE s[10],r[10],q[10];
memcpy (s,a, 3);
cout<
|
|
|
|
|
What are you expecting to be displayed? The first cout statement will print the 0xff character but you'll not be able to see it as it's whitespace. The other two cout statements should print nothing.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
#include "iostream.h"
#include"memory.h"
typedef unsigned char BYTE;
void main()
{
BYTE a[3]="\x42\x41";
cout<
|
|
|
|
|
I am trying to use PC-Lint with an MFC app and am getting way too many messages where it is searching for some keywords. I would like to know if someone has got a quick start to this .
I added some additional options for a template from Scott Myers . I advised me to make some function parameters const . additionally , most of my functions do not modify data , so should i make them const ? What is the advantage of making a function const ? Apart from the fact that no one could use the function to modify existing data !
|
|
|
|
|
I stopped using PC-Lint about six months ago when it flagged perfectly good code and ignore a glaring errors, sometimes in the same file. It's a shame; it used to be a good program.
Incidentally, making a paramater or function const is an additional error check. It also reminds the developer that the class or parameter won't change; if it did, in some cases you would have to double buffer and item or ensure a string had sufficent memory allocated to it, etc.
The compiler can also use const to do some optimizations.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I have a edit box which when I set the focus will allow the user to enter text. But when the
Enter or Return key is pressed the program terminates.
I have set the property to Want Return.
I am using the event OnEnChangeEdit1 to move the text and clear down the edit box when
the data entry cycle is complete.
How do you stop the Enter/Return key terminating the program?
|
|
|
|
|
Hi,
Sounds like you have a dialog with the OK button as BS_DEFPUSHBUTTON style.
You can use the PreTranslateMessage virtual function to do whatever it is you want to do, e.g.
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
BOOL bEatMsg = FALSE;
if (pMsg && pMsg->message == WM_KEYDOWN)
{
if (pMsg->hwnd == m_ctrlEditBox.GetSafeHwnd())
{
switch (pMsg->wParam)
{
case 13:
bEatMsg = TRUE;
break;
}
}
}
return bEatMsg?TRUE:CDialog::PreTranslateMessage(pMsg);
}
Hope this helps,
Andy
|
|
|
|
|
Thanks Andy that worked a treat.
|
|
|
|
|
sweep123 wrote:
I have a edit box which when I set the focus will allow the user to enter text. But when the
Enter or Return key is pressed the program terminates.
I have set the property to Want Return.
Is the ES_MULTILINE style also being used?
sweep123 wrote:
How do you stop the Enter/Return key terminating the program?
Read here.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
The Multi-line was set to false.
If set that to true would that have sorted out the problem?
|
|
|
|
|
sweep123 wrote:
If set that to true would that have sorted out the problem?
That's ultimately up to you to determine. All I can do is suggest what the docs indicate, namely that when a multiline edit control is in a dialog box, the default response to pressing the ENTER key is to activate the default button. To use the ENTER key as a carriage return, use the ES_WANTRETURN style.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks for the info.
One effect I have with the use of the Edit Box is that if the user presses the Tab key when the Edit Box has focus then that is taken as an Enter key press.
This is with the Tabstop set to both true or false.
Note I set the Edit Box to read only until data input is expected, then its set to false and back again to true following the data entry.
|
|
|
|
|
sweep123 wrote:
One effect I have with the use of the Edit Box is that if the user presses the Tab key when the Edit Box has focus then that is taken as an Enter key press.
This is with the Tabstop set to both true or false.
This is not normal (i.e., default) behavior, unless you are doing something special with the VK_TAB key.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|