|
blamond wrote: // Fill background
FillSolidRect(m_rect, pDC->GetBkColor());
replace this statement in CMemDC to
HBRUSH hbrBackGrnd = (HBRUSH)GetClassLong(pDC->GetWindow()->GetSafeHwnd(),
GCL_HBRBACKGROUND);
::FillRect(GetSafeHdc(), &m_rect, hbrBackGrnd);
|
|
|
|
|
Rajkumar gets large quantities of kudos...
Your fix did the trick, and saved me a few hours of head-bashing no doubt.
Thanks very much!
Bruce
|
|
|
|
|
In our application, we would like to update our view based on the user's selection in a combo box like office 2007 does to change font size. We notice that when you highlight a font size from the combo box, you can preview the size change without the need to hit "Enter" or any other "Apply" trigger. How can we do that? Does the combo box of new version of Visual Tools have the event trigger automatically? Thank you very much!
|
|
|
|
|
|
Is there a way to detect if a view is in print preview mode without using a Device Context or CPrintInfo?
I am using MFC Doc/View
modified on Monday, May 5, 2008 4:59 PM
|
|
|
|
|
void CViewDerivedClass::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
if(pInfo->m_bPreview)
{
}
}
CPrintInfo structure is passed as a parameter to all printing related functions of a CView derived class.
modified on Monday, May 5, 2008 4:58 PM
|
|
|
|
|
My bad. I forgot to indicate the "without DC" thing better.
Is there a flag or method outside of any particular view to allow one to determine if the the app is in print preview mode?
By the way, thanks for taking the time to help. Sorry I didn't state my problem clearer the first time.
|
|
|
|
|
You can keep track of it yourself via overriding following function.
virtual void CFrameWnd::OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState);
|
|
|
|
|
|
I'm trying to print the contents of a web browser control using the web browser's ExecWB method as follows:
m_ctrlWebBrowser.ExecWB(OLECMDID_PRINT, 1, NULL, NULL);
Everything works great in debug, but in release an exception is thrown.
I have no idea how to determine what the problem might be, and searching online I haven't been able to find anyone else who's had this problem, or any other info about what else I might need to do besides just calling ExecWB().
Any ideas greatly appreciated! I'm kind of a newbie, so please include as much detail as possible.
(I'm using Visual C++ 5.0 / MFC, by the way... and IE 6.0)
Thanks much
|
|
|
|
|
use ExecW's Quit method .. it will work fine
|
|
|
|
|
How canbe formatted a partition in VC++ 6?
I found a function, FormatPartition() but it doesn't work with what I'm using. Has anybody a solution?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Does it give you any error or something that we can look at?
|
|
|
|
|
I got an answer from Mukesh Kumar
Thanks
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
AFAIK FormatPartition() is used for Windows CE and for smart devices. VC++ 6 does not support smart device development. Use eVC++ or VS 2005 to use this function.
By the way, For which platform you are using this function?
Smart device or Desktop Development???
Mukesh Kumar
Software Engineer
|
|
|
|
|
For Desktop
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
|
My friend, this time I had to balance the troll's vote to your reply.
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
|
|
|
|
|
Thanks my friend but it seems my answer was important because I got 4 votes!?
|
|
|
|
|
I got an answer from Mukesh Kumar
Thanks anyway
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
I am having a dialog control with edit boxes in it and when I type in those boxes and hit 'Enter' key the dialog closes. I am not having any OK or Cancel buttons (I deleted them as soon as I created the dialog). I want to replicate tab behavior when I hit 'Enter' key and also for a couple of edit boxes in the same dialog I have declared handlers to do some processing as below-
ON_NOTIFY(EN_MSGFILTER, IDE_CONTROL, UpdateControl)<br />
CWnd* wnd;<br />
wnd = GetDlgItem(IDE_CONTROL);<br />
wnd->SendMessage(EM_SETEVENTMASK, 0, ENM_KEYEVENTS);<br />
void CControlDlg::UpdateControl(WPARAM wParam, LPARAM lParam) <br />
{<br />
}
How can I perform both of these functions at the same time (disabling enter key/escape key from closing the dialog, while processing the above function when you hit 'Enter' key in some single line edit boxes)??
thanks for any help.
PKNT
|
|
|
|
|
Set your edit box to 'want enter' key...
God bless,
Ernest Laurentin
|
|
|
|
|
Thanks or the reply, I did that too, but it still closes the dialog box . I would like to have them do some function if I want to and/or just go to next control in tab order.
PKNT
|
|
|
|
|
Usually when you press enter in a dialog the default button gets pressed... in order to avoid that you should:
A) Remove that button. (Not the best solution)
B) Handle that in the pretranslatemessage. (Not the best solution)
C) Handle the event of pressing that button.
D) Possibly other solutions that I don't remember now...
Hope this helps.
OOps! I've not read your message correctly... I would make a special class that would handle this kind of event, then it is very easy to make it work:
void CTAMEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)<br />
{<br />
switch (nChar)<br />
{<br />
case VK_UP:<br />
{<br />
GetParent()->;PostMessage(WM_NEXTDLGCTL,TRUE,0);<br />
return;<br />
}<br />
case VK_DOWN:<br />
{<br />
GetParent()->;PostMessage(WM_NEXTDLGCTL,FALSE,0);<br />
return;<br />
}<br />
case VK_RETURN:<br />
{<br />
FinishEditing();<br />
return;<br />
}<br />
}<br />
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);<br />
}
I've used that code to handle the up and down keys in order to go to the next control in the dialog...
Now I hope this helps you...
|
|
|
|
|
Thanks for the reply, I tried this by adding WM_KEYDOWN function to the dialog and editing it in the way you did, but it never went into that function and closes the dialog. Since you are saying that it worked for you, I think I may be doing something wrong .
PKNT
|
|
|
|