|
Ah, you won't get mouseclick events from an icon clicked on the tray, that works differently. See here[^]. You can specify what message your application wants to receive if the icon gets clicked on the tray. You should probably look for that message instead of mouseclicks. You should have said that earlier.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
but, if so, i want to hook such message, what should i do?
|
|
|
|
|
Well, first you need to determine what that message is, as said, the application can TELL the shell what it wants to receive so bascily it can be anything. Try using spy++, maybe it helps, maybe it does not.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
ok. i used spy++ and found the tray icon always receives TB_GETBUTTONINFO message. and i googled found someone said i almost couldn't hook that message in its owner window's message loop, because TB_GETBUTTONINFO is internal messages in controls. right?
If so, maybe i only can hook its owner window's main message callback procedure. any idea?
|
|
|
|
|
I'm not sure but i think you misunderstood something, what i meant is the message that is received by the application if the tray icon is clicked. Usually this works something like:
-the application uses Shell_NotifyIcon[^] to install an icon on the tray, specifying -for example- WM_USER or WM_APP or some other message it wants to receive when the icon is clicked on
-the user right-clicks the icon on the tray, the application receives the message it specified when using Shell_NotifyIcon along with some other information telling it that the icon was right-clicked (you can look this up in the documentatin if you like), the message is targeted at the window that was also specified when Shell_NotifyIcon was used.
-the application displays the popup menu at the mouse cursor's position and handles the user's menu selection
So basicly, i gess what you want is to catch the message fed to Shell_NotifyIcon.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
You are calling CallNextHookEx()[^] in both the case i.e. nCode > 0 or nCode < 0; You may return a nonzero value to prevent the system from passing the message to the target window procedure from your handler. Even have a look at this[^].
|
|
|
|
|
But here he does exactly that, not call CallNextHookEx and return non-zero:
if(process_id==target_process_id){
.... my process
return 1;
}
Am i missing something?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Sorry ! I missed it !
It's my coffee time !
|
|
|
|
|
you can see, if nCode>0, to the target process(other processes are not what i want to deal with) the flow will enter the if block, so the second CallNextHookEx will never be called.
|
|
|
|
|
Does GetWindowThreadProcessId return proper process id ? The only possibility is your if(process_id==target_process_id) is not satisfying. Check whether you've defined the shared section properly, and even look for values of target_process_id and process_id by debug printing them.
|
|
|
|
|
yes, target_process_id do be defined in a shared segment:
#pragma data_seg (".SHARED")
HHOOK g_hPreviousMouseHook = 0;
HHOOK g_hPreviousWinProcHook = 0;
HINSTANCE g_hInstance = 0;
HWND g_hMinimizedWindowList[ARRAY_SIZE] = {0};
int g_iMinimizedWindowCount = 0;
DWORD target_process_id = 0;
#pragma data_seg()
#pragma comment(linker, "/SECTION:.SHARED,RWS")
Malli_S, this code slice is copied from your tutor article http://www.codeproject.com/KB/system/TrayMe.aspx. Im trying your demo project today.
|
|
|
|
|
You through with your issue ?
[Delegates] [Virtual Desktop] [Tray Me !]
-Malli...!
|
|
|
|
|
yes. I wanna make the target program do nothing when the user click its right mouse key on the tray icon.
|
|
|
|
|
A mousehook seems like an overkill solution for getting all the mouse events for a window.
Why not just get the messages in the window's windowproc (possibly by subclassing if it's not your window)?
Or is the window in another app?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
oh, Code-o-mat told me that the tray icon not use WM_RBUTTONUP message any more. yes, i used spy++ and found its message should be TB_GETBUTTONINFO message. Im trying to find a way to hook this message or another method to hook the real procedure of such message.
|
|
|
|
|
Hi,
I have changed my input locale to 'Japanese' through Regional Settings and Language options in control panel. (and Restarted my PC as well)
2. I have written a simple MFC dialog application.
3. In resource view, Inserted a copy of dialog in Japanese (Copied the title as japanese string)
4. I am able to see japanese character in Visual C++ 6.0 environment.
5. But When i execute the application. Firstly,it is the english dialog which is launched not my japanese dialog. Second even i change the english strings to japanese string in english dialog, junk characters are shown in place of japanese string.
Please provide me a answer.
Thanks
Prashant
|
|
|
|
|
Please check whether the unicode is enabled in your dialog project? You have to define - UNICODE and _UNICODE to preprocessor definitions.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
I am working on this little VC++ 6.0 simple dialog-based application.
No matter whatever I change about the styles etc I only get a combobox
that at launch being clicked shows a drop down cell (one cell) that shows one item with a spin
control on the right corner instead of a full list of items. Of course I can use
the spin control to go through all the items, but it's kind of annoying when
I can simply pick easily from a drop list that shows everything at one time.
how can I solve that problem
Trioum
|
|
|
|
|
Open the resource editor and click on the arrow of the control. You'll be able to modify the size of the drop region instead of the size of the control.
|
|
|
|
|
|
What's the difference between what you are expecting to see and what you are actually seeing?
|
|
|
|
|
why did you delete your question without answering the reply you got ?!
|
|
|
|
|
Thanks for delete your question.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hamid. wrote: Thanks for delete your question
what was it about ?!
|
|
|
|