|
Nyarlatotep wrote: Do I have to use exception handling ?
yes
use
try...catch
nave
|
|
|
|
|
Hello,
I'm using a print preview view to present the preview of a report in my program.
Things seem to be ok, but I don't like the default behavior that the view
will turn to empty when user press an Esc key and want to disable it.
How can I get this?
Thanks
Max
|
|
|
|
|
hi all,
as we can insert the text in an rich edit control with
SetWindowText(string) API
but is it possible to insert some character in between the existing string??
i mean if i know the caret position to insert that character and the actual character to insert then can i insert the characterwith this information??
e.g.
if current text in rich edit control is
love is in the air.
and if i want to insert the character after "in" as "in/" so how i can do that??
please let me know if someone know's how to do this!!
Thanks and Regards
Harshal shete
|
|
|
|
|
harsha_1234 wrote: love is in the air.
and if i want to insert the character after "in" as "in/" so how i can do that??
Like this:
You can use CString::Replace() to replace the text.
CString m_str;
m_richedit.GetWindowText(m_str);
m_str.Replace ("in","in/");
m_richedit.SetWindowText (m_str);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
yes this is one way but in this way we need to call GetWindowText
and then after changing the text we will say SetWindowText
what i want to do is that
if i have a character and the caret position that is going to tell me where
to insert that character then i will do
SetCaretPos(point)
and now programmatically i want to insert that character ata that position
so how i can achieve that??
and thank's for replying
harshal shete
|
|
|
|
|
harsha_1234 wrote: what i want to do is that if i have a character and the caret position that is going to tell me where to insert that character then i will do
CPoint pt=m_richedit.GetCaretPos ();
int i=m_richedit.CharFromPos (pt);
CHARRANGE chRange;
chRange.cpMin =i;
chRange.cpMax =i;
m_richedit.SetSel (chRange);
m_richedit.ReplaceSel ("/");
I hope this helps and fits your requirement.
-- modified at 5:01 Thursday 14th September, 2006
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
yes thank's anshuman
actually i am doing multilevel undo redo
thanks and regards
Harshal
|
|
|
|
|
Another option is to use CRichEditCtrl::SetSel[^] to set the 'carret' position (in fact, the text which is selecetd in the control, if nStartChar is equal to nEndChar, then, you specify a carret position). You can then use CRichEditCtrl::ReplaceSel[^] to replace the text which is selected (ans thus, insert text also).
|
|
|
|
|
yes this is a good approach
actually i am doing multilevel undo/redo for richedit ctrl(CRichEditCtrl)
and when i searched on codeproject i didn't got any undo redo code for CRichEditCtrl.
so currently i am making dynamic stack in which i am storing the caret position and the character.in OnChar handler.
and i am thinking that when user will say undo i will pop one frame and will insert that character in the rich edit control at that position.
Is it a good approach??
and is there no other API that will just take the character and caret position o insert the character??
Thanks and regards
Harshal shete
|
|
|
|
|
CString m_str;
m_richedit.GetWindowText(m_str);
m_str.Insert( Index, "string to be inserted" );
m_richedit.SetWindowText (m_str);
akt
|
|
|
|
|
ooh sorry pls ignore the above reply
thanks
akt
|
|
|
|
|
Hi all,
I want to make a server with the use of turbo c 64 bit. I tried to search turbo c compiler but i did not. If you have any idea about it plz plz plz rply me as soon as possible its urgent.
Thank you in advance.
|
|
|
|
|
|
Hi Friends,
In my application I want to convert BMP image to PNG and JPEG Image format, I never worked on converting one image format to another, can any one guide me how can I achive this.
Or if there is any sample code available for this.
Thanks in advance,
Dinesh
|
|
|
|
|
You can read your pictrue(bmp) with CImage class and use from save
|
|
|
|
|
see :
http://www.codeproject.com/script/comments/forums.asp?msg=1664120&forumid=1647#xx1664120xx
|
|
|
|
|
I have to launch from my code some third party program that may result in system restart. In case that the system restart is not performed immediately (for example with <shutdown t="" 30="" s="">), I need my program to terminate and prevent the user from cotinue running my program in the time remaining till shutdown.
Question: How can I detect that <system shutdown=""> was issued?
(I tried to start some process from my code an get the error code informing that the system shutdown is pending, but this solution is buggy, since I do not know which process can i start on user's machine and in case that there is no system shutdown pending it looks ugly - console opens, etc.)
|
|
|
|
|
All top-level windows receive a WM_QUERYENDSESSION message when a logoff/shutdown/restart is initiated. If no app cancels the action, windows get WM_ENDSESSION to indicate that the system is shutting down.
|
|
|
|
|
Thanks,
but the problem is I can not poll in a loop.
I need to run a single query when I got the control back from the T.P. program I'm running from my code.
Any ideas?
|
|
|
|
|
You don't poll to get those notifications, they arrive in the message queue like any other messages.
|
|
|
|
|
The problem is that I can't listen to the message pipe. I need a single method cal to guery OS "is there a shutdown pending or not". That's the situation. Any ideas?
|
|
|
|
|
Big problem,
Is it possible to upload files to www.something.com if I have the username and password? I need to send files from my program to our web server. Please help me. Thanks!
|
|
|
|
|
|
can any can say the solution for this
Unhandled exception 0xC0000005: Access violation reading location.
|
|
|
|
|
u are allocating undersize memory to buffer
|
|
|
|