|
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.
|
|
|
|
|
In MFC App Wizard EXE Project
Simply say------
I am drawing circles and rectangles on screen and then storing these figures as bmp file.
I want to exe be invisible when it is activated and perform also the above mentioned work.
I am drawing figures on screen of my application window in OnDraw(CDC *pDC)
method.
Note:
I have tried
ShowWindow(SW_HIDE)
it hides exe but the required work is not done.
I want my window hidden and perform the work required.
Give me suggestions how to do it. And whether any changes are required in application wizard generated code.
|
|
|
|
|
mkashifkkj wrote:
I want to exe be invisible when it is activated and perform also the above mentioned work.
Huh? Define "invisible". You want to mess up the users screen with "circles and rectangles" without the user ever seeing your application window? If so, it's easy: Just create your window (fullscreen), read up on SetLayeredWindowAttributes to be able to use the color key, and do your stuff.
If you're to use this on
|
|
|
|
|
Please do not answer this kind of question before knowing what the guy really wants, or once after downloading some stuff, you'll get your screen full of circles without knowing what happens.
~RaGE();
|
|
|
|
|
Rage wrote:
Please do not answer this kind of question before knowing what the guy really wants, or once after downloading some stuff
I don't "download" anything but source code anymore. If I can't compile it myself, I don't run it. I must in part thank Microsoft for having helped to display this way to me (with their "patches").
you'll get your screen full of circles without knowing what happens.
Hey, I remember the speed the Amiga could draw rectangles all over the screen. I bet it could draw circles almost as fast! (and we didn't even need 1.5 GB of disk and 128 MB of RAM just to log in back then).
|
|
|
|