|
Is, true, I don't have pardon.
That is the problem of write directly into CodeProject.
Hey Chris, You need to put a C++ compiler Here....
Cheers!!!!!
Carlos Antollini.
|
|
|
|
|
I have just started using exceptions, catching both built in types and defined objects. However, as I see it it would be very rare that I actually have a use for doing this. There is always a way around it, usually just error checking. I recall from using java that there are special types defined such as ArrayOutOfBoundsException which you can catch- these types also have relevant methods inluded for diagnosing and working with the exception. Is there no similar concept apart from std::exception...
Thanks in advance..
|
|
|
|
|
There is always a way around it
Not always. If you have a library that uses throw to report errors, your only solution is to use try and catch. And don't forget about operator new - it throws an exception when there's not enough memory to satisfy the request. Visual C++ is not up to standard in this area (yet) and will simply return NULL. Hopefully, they will fix this in VC 7 (any Beta2 user to comment on that?)
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
hello, i really need urgent help with this problem, i look about everywhere but i just can't seem to find an mfc based texteditor program. The problem is this: i have a textbox and i declare a member variable for it as a CString.
Now i have to write the text from this textbox to a file. just like that. i know this really can't be a problem for you guys so please post a quick response here. i can't use getwindowtext and all that because it works with HWND's and u know the mfc stuff is with CWnd.
Thanks
Kuniva
|
|
|
|
|
You have two samples in the MSDN, One is the SUPERPAD, and the other one is MULTIPAD.
If you have not the samples I can send you by e-mail.
Cheers!!!
Carlos Antollini.
|
|
|
|
|
try MyWindow.GetWindowText()
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
i can't use getwindowtext and all that because it works with HWND's and u know the mfc stuff is with CWnd.
Using MFC objects in no way prevents you from dropping down to the APIs. Call the GetSafeHwnd() method of any CWnd-derived object to get its window handle.
--Mike--
http://home.inreach.com/mdunn/
Push the button, Frank.
|
|
|
|
|
hehe, i didn't go to the msdn library yet because i think its a huge mess but i guess if i look a bit i'll find it
i'm a bit of a slacker u know :p
Thanks alot for all your help!
Kun
|
|
|
|
|
If you create a MFC App doc/view project with the App Wizard and select CRichEditView as the base class for the view in the final step, you will get a fairly functional text editor - might be all you need!
|
|
|
|
|
yeh i know, but its a dialog based app so...
|
|
|
|
|
You could use this code to pull your string from the text box and dump it to a file..
CFile fileEditText;
if (fileEditText.Open("text.txt",
CFile::modeCreate + CFile::modeWrite))
{
fileEditText.Write((LPCSTR)m_edit,m_edit.GetLength());
fileEditText.Close();
}
Hope this helps
Rob Jones
|
|
|
|
|
geezes, did you read my mind or something???? this was the exact kind of code i was looking for!!! it works great!
you really helped me out alot, thanks!
T.W.
|
|
|
|
|
I want to dock below the main frame, like so...
_______________________________
| |
| |
| Main Frame |
| |
|_______________________________|
| |
| Dialog |
|_______________________________|
so that its not a child window being docked, but its docked on the bottom side of the main frame border....
|
|
|
|
|
Something like Winamp windows snapped one to another? Make dialog modeless and handle WM_SIZE, WM_SIZING, WM_MOVING and WM_MOVE in frame and dialog. The messages are sent when user moves/sizes the window - in the handler call SetWindowPos to keep other window snapped.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
You should be able to you a model dialog also because it get these messages also.
|
|
|
|
|
It gets them for sure, but users can't access mainframe when modal dialog is displayed - the main window is disabled.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
|
Well? And if, should I? The alternative is to check the length of the list I need to process.
|
|
|
|
|
This compiles w/o error:
void main()
{
char* p = new char[0];
} As for whether you should do this, without knowing your code I would say no. If someone asks me to allocate 0, I'd treat it as an error or no-op, depending on the situation.
--Mike--
http://home.inreach.com/mdunn/
Push the button, Frank.
|
|
|
|
|
According to section 5.3.3 of the ARM - yes!
Dale Thompson
|
|
|
|
|
|
The Annotated C++ Reference Manual, it was considered the official definition of the C++ language before the ANSI/ISO standard was approved.
|
|
|
|
|
Yes, the standard says that you can allocate a 0 byte array, and that this will be at least 1 unit of storage (on PC's this is one byte) So that it's address may be taken. It's not recommended that you actually DO anything with it though.
|
|
|
|
|
Hello,
Please read the following code.This is for an MDI project in VC++5.
I use this particular method to make MDI documents and windows.
How can I name the frames that I create using this method?
//This is the iitialization.
pDiagramTemplate = new CMultiDocTemplate(
IDR_DIAGRAMTYPE,
RUNTIME_CLASS(CDiagramDoc),
RUNTIME_CLASS(CDiagramChildFrame),
RUNTIME_CLASS(CDiagramView));
//This is for displaying the new frame.
CDiagramChildFrame *pdiagramframe = new CDiagramChildFrame;
CDiagramDoc *pdiagramdoc = new CDiagramDoc;
CDocTemplate *pTemplate = pDiagramTemplate;
CFrameWnd *pframe = pTemplate->CreateNewFrame(pdiagramdoc,pdiagramframe);
pTemplate->InitialUpdateFrame(pframe,pdiagramdoc);
Everything works but I want to name the frames like 1,2,3 etc.as they are created
using THIS PARTICULAR METHOD.Please help me.I need it very very urgently.
Thanx.
Joey Tribbiani.
|
|
|
|
|
What's the relationship between new frame and existing docs? Is this a new window showing new document, or new window for document already associated with other frame windows?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|