|
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
|
|
|
|
|
I handled the WM_KEYDOWN message yes, but not in the dialog, I made a special class derived from a CEdit and handled that message in that class (so it is handled before being handled in the dialog itself).
If you want to stop that or process that in the dialog (not recommended and much more easy and portable if you do that special class) you can use the PreTranslateMessage routine.
Hope this helps.
|
|
|
|
|
I tried by defining a new class derived from CEdit class and then defined WM_KEYDOWN message handle in it as you have shown above. Now I created a new edit control box in my dialog which is an object of newly derived class. Even now when I try to hit enter it closes the dialog box.
PKNT
|
|
|
|
|
I got that behaviour in the CEdit derived class, but I handled also the PreTranslateMessage... ( didn't remembered...).
If you do that in the dialog it will work for you.
BOOL CTAM_BODlg::PreTranslateMessage(MSG* pMsg)<br />
{<br />
if (pMsg->message == WM_KEYDOWN)<br />
{<br />
switch (pMsg->wParam)<br />
{<br />
case VK_RETURN:<br />
{<br />
CWnd *pWnd = GetFocus();<br />
if (pWnd == &m_cBtnPasteApplyNow)<br />
{<br />
OnBnClickedBtnPasteApplyNow();<br />
}<br />
else if (pWnd == &m_cBtnPasteCalibrate)<br />
{<br />
OnBnClickedBtnPasteCalibrate();<br />
}<br />
<big> return FALSE;</big><br />
}<br />
}<br />
}<br />
<br />
return CDialog::PreTranslateMessage(pMsg);<br />
}
return FALSE is the key...
|
|
|
|
|
I handled PreTranslateMessage and now it doesnt close the dialog, but it doesnt go to the next control. I think I am gonna try that now. Thanks for your prompt responses.
Update- I got the other issue too working... thanks again
PKNT
|
|
|
|
|
|
You can map the LBUTTONCLICK message of OK and Cancel buttons. and comment the code CDialog::OnOK() and CDialog::OnCancel(). Then when you hit the key 'Enter' and 'Escape' the dialog does not will be colsed.
|
|
|
|