|
Actually, you were right the first time. I was just farting making up things, only because I said it. Probably you knew it too. And yes, I could have avoided a function call. You caught me there.
But ya know? I typed an answer on reading the query immediately. No opening of visual studio, no cheating. It couldn't be the most optimized answer and optimization can be left to the OP, right? You can understand, can't you?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: Actually, you were right the first time. I was just farting making up things, only because I said it. Probably you knew it too. And yes, I could have avoided a function call. You caught me there
I was actually kidding + tried to provoke you
Rajesh R Subramanian wrote: But ya know? I typed an answer on reading the query immediately. No opening of visual studio, no cheating. It couldn't be the most optimized answer and optimization can be left to the OP, right? You can understand, can't you?
lol . Now I'm free to agre that you know more MFC than me. That's true.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Rajesh R Subramanian wrote: It couldn't be the most optimized answer and optimization can be left to the OP, right?
I think it's not just about optimization here. GetFocus and GetDlgItem can potentially return temporary CWnd objects - so comparing them won't always be the right thing to do. So Vunic's code seems to be the right way here.
|
|
|
|
|
Indeed, look at my previous reply (and vote) to him.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hey man!
I hope that you don't take this too seriously. Actually, I knew Vivek was right right at his first message, but it was the eight year kid within me that was arguing for fun. But however, when I look at it all again, I feel bad because my contributions are recognized here and I've been awarded, which means people would expect a lot more from me than having funny chats. I realised it and felt bad. I am also feeling that I am a lot matured than what I was earlier, but then I know it that I still need to work even more on this. There's a very long way for me. I hope you'd wish me good luck. Because if I didn't know it, that was a different thing. But knowing it and doing funny things on a public forum is unacceptable. I'm sorry about it (to everyone). I'll try to keep my message standards higher.
I feel a lot relieved after posting this message. See ya.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hey Rajesh
I respect your contributions here and I am truly glad there are guys like you who prove repeatedly that not all Indian devs are like the low-lives who post their work assignments here using sms-slang and expect people to write the entire code for them for free.
I did think your sub-thread with Vunic may have been distracting to the O.P. since he's a newbie, so perhaps it's best to avoid such humorous off-shoots in the technical forums.
Have a great weekend. Maybe you could go see Dashavatharam.
|
|
|
|
|
We have made enough noise to wake up the gaint! See who has replied
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
You mean he was sleeping?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Yes - w.r.t this forum. But I think for most of the question posted here, he would definitely find em boring
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
I myself find most questions boring. There's no doubt it should be boring for him.
BTW, please read this[^].
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
Use Richedit instead of smple Editbox. There you can add function on message EN_MSGFILTER. This permits filtering of mouse and keyboard message in the control.
TODO: The control will not send this notification unless you override the
CDialog::OnInitDialog() function to send the EM_SETEVENTMASK message
to the control with either the ENM_KEYEVENTS or ENM_MOUSEEVENTS flag
ORed into the lParam mask.
inside OnInitDialog mask the key events
m_rich.SetEventMask(m_rich.GetEventMask()|ENM_KEYEVENTS);
void CExampleDlg::OnMsgfilter(NMHDR* pNMHDR, LRESULT* pResult)
{
MSGFILTER *pMsgFilter = reinterpret_cast(pNMHDR);
CString buf;
if(pMsgFilter->msg==WM_CHAR )
{
buf+=pMsgFilter->wParam;
}
*pResult = 0;
}
buntyrolln
|
|
|
|
|
If you derive a class from CEdit , you can override OnChar() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi Masters!
I've an icon (with 3 dif. sizes, that's 16x16, 32x32, 48x48) in a DLL and I'm using it in an exe using DuplicateIcon() function.
The problem is that when exe runs, I expect to have 16x16 one on the taskbar button, but I'm just enjoying the 32x32 !
What can I do?
|
|
|
|
|
???????????????????????
-@SuDhIrKuMaR@-
|
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
Hi,
How can i add OnEraseBackgrnd for dialog. I cannot find in Add Message option in class wizard and also in Add Message Handler.
How can i override this function in my dialog??Pls..
Anu
|
|
|
|
|
Anu_Bala wrote: How can i add OnEraseBackgrnd for dialog.
Add a message map entry...
ON_WM_ERASEBKGND()
Function declaration...
BOOL OnEraseBkgnd( CDC *pDC );
Anu_Bala wrote: I cannot find in Add Message option in class wizard and also in Add Message Handler.
I would suggest to you, as a learning exercise to write a simple MFC application, may be just a hello world sample with some menu and some buttons "without using application wizard and class wizard".
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
in header file add:
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
In CPP file add:
BEGIN_MESSAGE_MAP(<yourdialog>, CDialog)
//{{AFX_MSG_MAP(<yourdialog>)
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL <yourdialog> ::OnEraseBkgnd(CDC *pDC)
{
CDialog::OnEraseBkgnd(pDC);
return FALSE;
}
-@SuDhIrKuMaR@-
|
|
|
|
|
Anu_Bala wrote: I cannot find in Add Message option in class wizard...
Change the message filter from Dialog to Window.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi All,
I have a dll A which contains functions f1, f2, f3, and i use these functions in my application, say function f4 in my application uses them for some purpose, now the problem is dll A is from third party, and it can have multiple versions in the future?, how can i take care of this issue in my design of Application such that new version of this dll(new version may have more functions or changed function names) doesn't impact function f4, say if new version dll is just extension to previous dll, would it be automatically called by my app, or do i need to take some measure to support new version, please help by considering other similiar scenarios, if i have missed any?, Thanks in Advance!
_____________
princenrj23
|
|
|
|
|
If newer DLL is just an extension of old DLL then you dont have to worry about it. By extension I mean no existing functions were deleted, or changed - name or functionality. If newer DLL do makes some changes to existing function then it will break your code. Either way you can't do anything, except fixing you code when new new DLL comes. So stop worrying about it
-Saurabh
|
|
|
|
|
Is there any way to set the paper size, say A4, and orientation in OnPreparePrinting() function which is called before the print dialog is displayed?
The problem is that I am not able to use CWinApp::OnFilePrintSetup function since the code is inside a dll and there's no class derived from CWinApp. So, in my own code for OnFilePrintSetup, I display a page setup dialog box and takes various inputs from user. Now, I want these changes to appear in print dialog also(which I get by using CVIew::OnFilePrint) and not the default settings that are displayed by print dialog box. So, the only way that I could find is to make changes to pInfo member in OnPreparePrinting but I could not get any way to set paper size. m_pPD member does not provide any way to set paper size?
Please help.
Thanks.
|
|
|
|
|
DEVMODE *pDevMode=NULL;
CPrintDialog dlg(TRUE, PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_NOSELECTION | PD_RETURNDC, this);
if(dlg.DoModal()== IDOK)
{
pDevMode = dlg.GetDevMode();
pDevMode->dmPaperWidth = 8.27;
pDevMode->dmPanningHeight = 11.69;
}
Nigah M Manzoor
|
|
|
|
|
My problem is because of the fact that I am using my own dialog box for print setup but using the mfc provided dialog box for print. When I use my own dialog box, I dont update the internal m_hDevMode structure which has the information for all settings like page size, orientation, dpi etc etc.
I did not update because I did not know how to update and precisely speaking, i did not know about GetPrinterDeviceDefaults API.
This is what I needed to do to set the default settings before the print dialog is displayed. No matter what you do, you will always get a print dialog box with a4 & landscape set. It's sufficient for my purpose.
[code]
OnPreparePrinting(CPrintInfo* pInfo)
{
if(GetPrinterDeviceDefaults(&pInfo->m_pPD->m_pd))
{
LPDEVMODE dev = pInfo->m_pPD->GetDevMode();
GlobalUnlock(dev);
dev->dmOrientation = DMORIENT_LANDSCAPE;
dev->dmPaperSize = DMPAPER_A4;
}
return CView::DoPreparePrinting(pInfo);
}
[/code]
Thanks!
|
|
|
|