|
Hi all,
I would need to close a pop-up menu when the current session expires automatically in my application.
This pop-up menu is displayed by TrackPopupMenu() when the user presses the right button on a window. On the other hand, when a time-out occurs (OnTimer()) the current session expires, and I would like to close all possible pop-up menus.
Could anyone help me?
Thank you.
Ser.
|
|
|
|
|
seanru wrote: and I would like to close all possible pop-up menus.
May be you can send a WM_LBUTTONDOWN message to the main window.
|
|
|
|
|
Off the top of my head WM_CANCELMODE[^] is the way to go to cancel menus.
Iain.
|
|
|
|
|
Thanks for your answers.
Anyway, I think it doesn't work.
What I need to do also is to 'close' Start Menu when a timer expires in my application, because that application should go to foreground, and Start Menu should disappear.
I tried to send WM_KEYDOWN and WM_LBUTTONDOWN to Windows task bar, but it does not work.
How could I close that Menu??
Thanks.
|
|
|
|
|
Sadly, the start menu is only an imitation menu. It has a load of non-menu features, and varies from one operating system and service pack to another.
About the only thing I can think of is to find the window with the current focus, and send a WM_KEYUP / WM_KEYDOWN with VK_ESCAPE as a parameter.
Iain.
|
|
|
|
|
Hi,
I have a thirdy party OCX. There is a sample VB program which uses "On Error" to trap runtime errors when an OCX method is invoked.
I want to build my application using this OCX and VC++. How do I trap runtime errors ? Do I have to use exception handling ?
Thanks
|
|
|
|
|
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?
|
|
|
|