|
vikas is right. To add more, u wud allocating some memory on the heap but not deallocating the memory. Make sure to use delete for every new. I hope u get the point !
|
|
|
|
|
When I click close button of CPrintPreview the application crashes. Before explaining what I have done, I find it noteworthy to mention that when application was launched from VC 6.0, no crash of application watsoever occured. But after migrating to VC.NET, I am encoutering this problem.
and let me focus what I have done:
I have derived a class from CPreviewPrint and call OnPreviewClose to close the print preview.
Since the class is derived from CPrintPreview it has a pointer names m_pPreviousView. Now plz just focus on the coming line. The problem starts after this. At this stage this->m_pPreviousView->m_pPreviewState is not NULL. But when I cast it CPreviousView and say store in pPrevView, I get pPrevView->m_pPreviewState NULL.
void MyPrintPreview::OnPreviewClose()
{
SetFocus();
/*
some code ... this->m_pPreviousView->m_pPreviewState is NOT NULL
*/
CPreviewView* pPreviewView = STATIC_DOWNCAST(CPreviewView, this);
/*
pPreviewView->m_pPreviousView->m_pPreviewState is NULL
some code and call OnEndPrintPreview
*/
}
Any help on it will be highly appreciated.
Best Regards,
|
|
|
|
|
hi
i want call OnTimer(UINT nIDEvent) in same class by using
SetTimer(4444,5000,NULL);
but i am unable to call ,it didn't go in OnTimer() body
can anyone help me.
thanks in advance
sachin
|
|
|
|
|
cancerion wrote: but i am unable to call
There is no need to call OnTimer. It's called everytime a WM_TIMER event is fired.
Did you add a message map entry for OnTimer. That is
ON_WM_TIMER()
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
hi ,
i have tried this there is no change in situation , while i have one application uaing this function , i have followed that ,still i m unable to do that
|
|
|
|
|
How is OnTimer declared
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
afx_msg void OnTimer(UINT nIDEvent);
|
|
|
|
|
This how I do...
BEGIN_MESSAGE_MAP(.......)
ON_WM_TIMER()
END_MESSAGE_MAP()
afx_msg void OnTimer(UINT nIDEvent);
SetTimer(timerID, delay, callback);
//rest of the code
void MyClassName::OnTimer(UINT nIDEvent)
{
.....
}
well it will work if it done like this...
Change the delay to 1000... So that you can check faster
Try again
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
thanks,
i think ,i have made a mistake in my main program . in which it's not working .i also made a program separately and it was working .so now i will make changes again in my main program
thanks once again
|
|
|
|
|
cancerion wrote: .i also made a program separately and it was working .so now i will make changes again in my main program
Is your timer program have his own window!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Some one plz help i m not been able to call Dll made in VB through VC++ MFC
Mind it not by using OleView
Achin Jain
|
|
|
|
|
Hi
Does anyone know how to use the UnRegisterClass function in a dll .I create a window in a dll. But when i try to unregister the class in WM_Destroy, the function is giving error code 1412.But when i try to unregister the class before return of winmain it is giving error that class does not exists.
Thanks
|
|
|
|
|
If you search the "UnregisterClass" in VS, you can find the following in the Remark.
<---
Before calling this function, an application must destroy all windows created with the specified class.
All window classes that an application registers are unregistered when it terminates.
-->
If you have tried to unregister the class within the WM_DESTROY msg handler of the window instance, it should be failed.
|
|
|
|
|
Thanks I got your point . So where can i call this function . I tried calling in DLL_PROCESS_DETACH it is giving error code 1411. can you please help me in this regard
|
|
|
|
|
Hello ,
I am new to VC++,MFC.
Please suggest to me , Which design patterns are used in
MFC .
Plz , Give Urgent reply
Bye
Praveen.C
Praveen Kumar
|
|
|
|
|
Can you elaborate..............
VamsiDhar.MBC
SoftwareEngineer
|
|
|
|
|
I am Vc++ Professional , (c++,vc++,MFC)
In Interviews they are asking about Design Patterns.
I am not knowledge about design patterns about vc++.
But In Java,J2EE I know about MVC architecture.
Plz Send Urgent reply.
Bye
Praveen,
Praveen.
|
|
|
|
|
The Document-View functionality is a variation of MVC (Model-View-Controller).
--
The Blog: Bits and Pieces
|
|
|
|
|
If its MFC they mean
Doc-View architecture .
There are two classification
SDI and MDI
u need to make a study on it first .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Require some help for solving the following:
consider a function f1(f2(),f3())
f1 takes 2 params,return type of func f2 and return type of f3.
f2,f3 are both library functions so no code available.
assuming R2L execution,f3 is executed first.If it throws up an error,i want to return immediately without executing f2 or f1.Hw do i do this type of dynamic checking ?
|
|
|
|
|
is f3 throwing an error or an exception?
Well, IMHO, this is not the right way of using the function that could fail.
-Prakash
|
|
|
|
|
i knw tht..But it's a question i was asked at an intw
|
|
|
|
|
where did you give the interview?
-Prakash
|
|
|
|
|
Well, since you use the term "throw", then I assume f3 will throw an exception on error, not return an error code. If so, then neither f2 or f1 will be executed. If you mean that f3 returns an error code, then you must check the values before passing them to f1.
This is really elementary C++, so I wonder: 1) Do they really ask such questions at interviews? 2) have you not done your homework?
--
The Blog: Bits and Pieces
|
|
|
|
|
I dont think that so simple if it was
asked to a experienced person . Have u
ever experimented the real result?
http://www.parashift.com/c++-faq-lite/
go throught this link its good for interview
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|