Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OnKickIdle

185 views
Skip to first unread message

Daniel Xu

unread,
Aug 26, 2004, 2:02:26 AM8/26/04
to
Hi, All,

How to use OnKickIdle and enable UPDATE_COMMAND_UI in Modeless Dialog
Box?

I've the article in codeguru. The web address is:
http://www.codeguru.com/Cpp/I-N/internet/chatprograms/article.php/c6223/

Need help badly.

In the Chat_room source code, I notice that the author added OnKickIdle
function, and explained:

//OnKickIdle is responsible for the Update CommandUI
//SDI/MDI applications have their own WM routing for this
//but Dialog doesn't. That's why we had to intercept and handle it - yh

I have tested the OnKickIdle function in the Modeless and Modal Dialog
Box. In the Modal Dialog Box, this function will handle the WM_KICKIDLE
Message. but in the Modeless Dialog Box, the function will have no response.
So I want to ask about the difference between the two modal dialog box.

--
Thanks & Regards
Daniel

--

__?__
/ \
/ ^ ^ \
( (o) (o) )
\ /
*=oOOO======(_)=====OOOo====*=====================================*
| | SHANGHAI CELLINK CO, LTD. |
| Daniel Xu | danie...@cellink.com.cn |
*=============Oooo.=========*=====================================*
.oooO ( )
( ) ) /
\ ( (_/
\_)


Ajay Kalra

unread,
Aug 26, 2004, 8:41:22 AM8/26/04
to
IIRC, OnKickIdle is not fired for a modeless dialog. This is a MFC
only concept. What are you trying to do? You may be able to do what
you want using some other ways.

-------------
Ajay Kalra
ajay...@yahoo.com

"Daniel Xu" <danie...@cellink.com.cn> wrote in message news:<eFKuWGzi...@TK2MSFTNGP11.phx.gbl>...

Daniel Xu

unread,
Aug 26, 2004, 11:10:28 PM8/26/04
to
Hi, Ajay,

Thanks for your reply. I want use ON_UPDATE_COMMAND_UI message of MFC in
modeless dialog, and it will response in Toolbar, I want change the Toolbar
Check/Uncheck state. Can you show me another way? I just look for the
website, but find nothing helpful information. Needs your help. Thanks!

Thanks & Regards
Daniel


"Ajay Kalra" <ajay...@yahoo.com> ????
news:df39ee97.0408...@posting.google.com...

Ajay Kalra

unread,
Aug 27, 2004, 8:41:02 AM8/27/04
to
You are out of luck for using UPDATE_COMMAND_UI in a modeless dialog.
You will need to implement it yourself or simply use a different way
to change the state of toolbar buttons. Last option, of changing state
of buttons on demand, is much easier. If you want to do
UPDATE_COMMAND_UI, you will probably need to use SetWindowsHookEx with
WH_FOREGROUNDIDLE to accomplish it.

-----------------
Ajay Kalra
ajay...@yahoo.com

"Daniel Xu" <danie...@cellink.com.cn> wrote in message news:<#2ou5K#iEHA...@TK2MSFTNGP09.phx.gbl>...

RainMan

unread,
Aug 27, 2004, 4:47:04 PM8/27/04
to
> You are out of luck for using UPDATE_COMMAND_UI in a modeless dialog.
Not necessarily.

Daniel,
Is dialog invoked from your main application or is it a main window of your
app?

Daniel Xu

unread,
Aug 27, 2004, 11:56:27 PM8/27/04
to
Hi, RainMan,

No, the dialog that I invoked is not the main application, it is a popup
dialog. As Ajay said "use SetWindowsHookEx with WH_FOREGROUNDIDLE to
accomplish it", do you have any source code or sample? Maybe I will look up
MSDN?

--
Thanks & Regards
Daniel

"RainMan" <Rai...@ProximaCentauri.com> 写入邮件
news:6137051F-C32C-4B7C...@microsoft.com...

Daniel Xu

unread,
Sep 6, 2004, 9:31:01 PM9/6/04
to
Hi, Ajay,

I tried to use SetWindowsHookEx with WH_FOREGROUNDIDLE to accomplish
this problem, but I can not settle it. So I have no choise to trouble you.
Needs your help badly.
I make a DLL file to use SetWindowsHookEx with WH_FOREGROUNDIDLE, and
the main app Load the DLL, but Callback function's parameters as follow:
LRESULT CALLBACK ForegroundIdleProc(int code, WPARAM wParam, LPARAM
lParam)
the Code, wParam, and lParam always be 0. I think your idea is hook mouse
movement, and when the mouse click the toolbar button. then the hook will be
handled. Ritht?
Do you have any sample or document? I still can not find any information
about a modeless dialog box use UPDATE_COMMAND_UI message of toolbar.

Thanks & Regards
Daniel

"Ajay Kalra" <ajay...@yahoo.com> ????
news:df39ee97.04082...@posting.google.com...

Ajay Kalra

unread,
Sep 7, 2004, 8:30:51 AM9/7/04
to
Daniel,

I dont have any samples for this. This is how I think it can be
accomplished. Whenever I have encountered modeless dialog(not main
window) in MFC, I have always avoided using ON_UPDATE_COMMAND_UI.

Sorry I could not be of much help.

------------------
Ajay kalra
ajay...@yahoo.com


"Daniel Xu" <danie...@cellink.com.cn> wrote in message news:<uXfXuoHl...@tk2msftngp13.phx.gbl>...

0 new messages