|
Thanks mike. But ca you please give me some piece of code where you are using it..I think it is not working for me..what is document here I mean it is an object of what..
hope you can help..thanks for the time..
waiting...
Himanshu
|
|
|
|
|
|
:(thanks neville,
but can you help!!! do you know bit of code which gets the selected text from web page and can display in edit box of a dialog..also if you can tell me how to get the url rom address bar of ie.
thanks a lot..
Himanshu
|
|
|
|
|
There are certain occasions that our release builds crashes on our clients computers. As such a dialog box is displayed by operating system showing something like " The instruction at 0x1111 referenced memory at 0x0001, the memory could not be read"
Friends, what i want is that whenever program crash happens, this dialog box is not displayed. Instead my own dialog box appears in which i can get the crash information and my client simply email that information to me. How can i achieve this goal of getting crash information and preventing OS dialog?? Any sample example code??? I've seen many commercial MFC applications in which whenever such crash occurs, their own dialog box is displayed and i simply click a button to send this information to them.
|
|
|
|
|
a very high-level try{ } catch(...) block will catch many of these things. but, it's still better to prevent them from happening in the first place.
-c
ILockBytes
|
|
|
|
|
Chris Losinger wrote:
a very high-level try{ } catch(...) block will catch many of these things
If he wants to catch SEGV errors he has two choices. SEH or SetUnhandledExceptionFiler. No need to confuse him with C++ and C++ exceptions implemented-in-terms-of-SEH-but-still-not-catchable.
If you use SetUnhandledExceptionFiler, take note that the debugger will swollow this when debugging. But since you get tese SEGV's from running client installation I guess debugging isn't of importance, right?
|
|
|
|
|
|
I'm looking for a source code snippet for calculating the inverse hyperbolic sine of a number. I.e. an implementation of "double __cdecl asin(double);". It's not a member of <math.h>. Can anyone help?
|
|
|
|
|
found this on Google:
asinh(X) = Log(X + Sqr(X * X + 1))
acosh(X) = Log(X + Sqr(X * X - 1))
atanh(X) = Log((1 + X) / (1 - X)) / 2
-c
ILockBytes
|
|
|
|
|
|
hi,
I want to set the mouse cursor to "Hand" when it moves over a button ,placed in a dialog.I did'nt find any mouseover message for button in the class wizard.Can any one help me..please..
Mahesh
|
|
|
|
|
There is no OnMouseOver function in MFC like the wellknown one used in another language . Basically, you'll have to create it yourself. Let's go.
Create a class derived from CButton , for example CMyButton (use the class wizard).
Get a control asociated to your button( use again the class wizard - Add Value, do not forget to switch the combo to "Control"), f.e. m_MyButton.
Change the line CButton m_MyButton to CMyButton m_MyButton .
Now, right click on CMyButton in your class browser, and chose Windows Messages. DoubleClick on WM_SETCURSOR so as to create the OnSetCursor function.Then, in CMyButton::OnSetCursor([some stuff i can't rememeber]) , load your new cursor, and comment out the line where the base class function is called (i.e. do not return what is originally returned), otherwise your own cursor won'T appear.
To sum up, what you did is :
Create your own CButton derived class named CMyButton .
Create a control, replace the original CButton using your class CMyButton .
In this class, handle the WM_SETCURSOR message with the overriding CMyButton::OnSetCursor() function.
DO not forget to comment the last line out.
Hope this helps.
~RaGE();
|
|
|
|
|
Thanks Rage...Thanks a lot..
|
|
|
|
|
Hi :
I have a question on OnSetCursor for CRectTracker. During tracking, it shows the resize arrows when the mouse pointer is at the edges. Such as <->.
How do I overwrite this if I want it to display another icon, maybe a different color hand ?
The CRectTracker->OnSetCursor function returns only a BOOL, so I suppose the cursor is not set there.
Any pointers will be appreciated.
|
|
|
|
|
Quek Khoo Boon wrote:
The CRectTracker->OnSetCursor function returns only a BOOL, so I suppose the cursor is not set there.
It is. Override this function, comment out last line, and set your own cursor in it.
~RaGE();
|
|
|
|
|
Hi
A beginner here.We always use GetDocument() function of CView class to retrieve a pointer to the CDocument class. However this time, i need to get the pointer from a CObject derived class. But i've no idea how to do that at all. Can anyone help?
Anyway i always wondered whether i should always place my data in the CDocument class. Because OOD seems to dictate that data should be contained in its own relevant classes for encapsulation. However the Document-View architect seem to suggest placing all data in the CDocument class. Any comments to help me resolve this paradox?
thks
moo
|
|
|
|
|
raner wrote:
Any comments to help me resolve this paradox?
there's no paradox. the "document" in doc-view is the data. the doc itself can contain other classes to actually hold the data (like arrays or whatnot), but the CDocument class is (theoretically) supposed to be the embodiment of your data. the view is just a way to look at the data.
raner wrote:
i need to get the pointer from a CObject derived class
the easiest way is to just carry around a pointer to your CDocument. but, you can also get a pointer to the current doc via CFrameWnd::GetActiveDocument (and you can get the frame wnd from CWinApp).
-c
Zzzzz...
|
|
|
|
|
but my class is CObject derived, so how do i make use of CFrameWnd::GetActiveDocument to import the pointer? thks thks
To carry around the pointer, do you mean something like the below codes?
In CView class:
CPgmDoc* pDoc= (CPgmDoc*) GetDocument();
CMyObject *pMyObject= new CMyObject;
pMyObject->SetDocument(pDoc);
In CMyObject:
void CMyObject::SetDocument(CRainAttDoc *pDocument)
{
pDocument=pDoc;
}
thks for the help.Sorry if this seems painfully elementary;P
|
|
|
|
|
yeah something like that. (carrying it around).
raner wrote:
so how do i make use of CFrameWnd::GetActiveDocument to import the pointer?
something like this:
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CDocument *pDoc = pChild->GetActiveDocument();
this only gets the "active" document, so it might not do exactly what you want.
ILockBytes
|
|
|
|
|
Hi
I'm working on a SDI project.After looking through my program, i still dont know how to adapt it to SDI project, since there's no m_pMainWnd variable in the CWinApp class. And i'm not sure if GetActiveDocument(); is relevant for a SDI?
thks thks
|
|
|
|
|
raner wrote:
since there's no m_pMainWnd variable in the CWinApp class
here's it is, more generic :
CWnd *p = AfxGetMainWnd()->GetActiveWindow();
if (p->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
{
CFrameWnd *pfr = (CFrameWnd *)p;
CDocument *pdoc = pfr->GetActiveDocument();
}
-c
ILockBytes
|
|
|
|
|
Hi
i tried the easy method of carrying the pointer around as follows.But it is not working.
In CView class:
CRainAttDoc* pDoc= (CRainAttDoc*) GetDocument();<br />
CMyObject *pMyObject= new CMyObject;<br />
pMyObject->SetDocument(pDoc);<br />
pMyObject->ShowGraph()
In CMyObject.h
private:<br />
CRainAttDoc* pDoc;
In CMyObject.cpp:
void CMyObject::ShowGraph()<br />
{<br />
CSRawDataArray &dataArray = ((CRainAttDoc*)pDoc)->GetRawDataArray();<br />
}<br />
<br />
<br />
void CMyObject::SetDocument(CRainAttDoc *pDocument)<br />
{<br />
pDoc=(CRainAttDoc*) pDocument;<br />
}
where CSRawDataArray is a CArray template and GetRawDataArray() is a function of CRainAttDoc which returns a CSRawDataArray.
While debugging, the SetDocument function is found to record the pDoc pointer correctly.However when the pgm runs to the ShowGraph() function, the pDoc became incorrect.
know what's wrong?
thks alot!
|
|
|
|
|
i don't see anything wrong with that code.
??
-c
A | B - it's not a choice.
|
|
|
|
|
hi , ive been asked to make a movie file that will open a browser popup window during play to advertise to our media viewers.
i dont know if its really c++ 's area to do this, but i thought maybe someone would have a suggestion since this is the most technically resourceful group on the net I know of
any tips / suggestions appreciated,
thanks
josh
todo....
:: insert inpirational text here ::
|
|
|
|
|
jDawwg wrote:
hi , ive been asked to make a movie file that will open a browser popup window during play to advertise to our media viewers.
i dont know if its really c++ 's area to do this
It's not. It's a Microsoft-only thingie, using their proprietary WMF (or WMA or whatever the TLA is).
any tips / suggestions appreciated
If I were to watch a video strip, and was greated by some extra window popping up I'd be less than happy. My suggestion is: if you really need to do this, put this advertisement at the beginning of the video stream.
|
|
|
|