📎 AI Summary:
The thread discusses a developer experiencing inconsistent behavior when attempting to hide the taskbar during CD/DVD insertion and ejection. Despite handling the WM_DEVICECHANGE message, the taskbar remains visible sporadically, especially during insertion. Replies suggest that simply polling GetMessage may be insufficient, recommending the use of hooks to reliably intercept Windows messages for better consistency.

liz08

Active Member
Member details
Joined
Oct 9, 2017
Messages
21
Thread Author #1
Hello,

In our application we get the handle of the taskbar using Windows API and hide it using SW_HIDE.
Yet when the CD / DVD is inserted / ejected the taskbar is visible.

We tried to handle the WM_DEVICECHANGE windows message which is received when any device is inserted to the system and called the windows API to hide the taskbar during this usecase.
Yet the issue is now sporadic. At times the taskbar remains hidden and at times it is unlocked and visible.

Can you please let me know what else windows message is required to be handled when CD/DVD is inserted/ejected.

Thank u.
 

Solution
Hey... WM_GETICON was causing the taskbar to show up..
This message was handled by using Windows API and hide it using SW_HIDE. The issue is no more reproducible.

Neemobeer

Windows Forum Team
Staff member
Member details
Joined
Jul 4, 2015
Messages
8,995
You may want to google around. I recall an application someone wrote to audit the message queue. You could write your own and just see which messages are called during a disc insert. You should be using a hook to intercept messages if your not too otherwise the messages will process before you can block them.
 

liz08

Active Member
Member details
Joined
Oct 9, 2017
Messages
21
Thread Author #3
I had added traces to get the windows messages! That helped me to get wm_devicechange as one the windows messages ! During eject the taskbar is successfully hidden! It is while inserting the taskbar that the issue is sporadically reproduced.. although the same message is received is received when CD is inserted.
 

liz08

Active Member
Member details
Joined
Oct 9, 2017
Messages
21
Thread Author #4
I meant while inserting the CD , the issue is sporadically reproduced
 

Neemobeer

Windows Forum Team
Staff member
Member details
Joined
Jul 4, 2015
Messages
8,995
Are you using a hook or just GetMessage to find the messages when you block them?
 

liz08

Active Member
Member details
Joined
Oct 9, 2017
Messages
21
Thread Author #6
GetMessage is used to find the messages
 

Neemobeer

Windows Forum Team
Staff member
Member details
Joined
Jul 4, 2015
Messages
8,995
That's why it's sporadic. You need a hook to intercept everything in the queue.
 

liz08

Active Member
Member details
Joined
Oct 9, 2017
Messages
21
Thread Author #8
Thank you.. let me try it out.. 🙂
 

liz08

Active Member
Member details
Joined
Oct 9, 2017
Messages
21
Thread Author #9
Hello,

Found WM_DEVICECHANGE to the only message being sent by windows which is handled by our application to hide the taskbar
The issue is still reproducible.
 

Neemobeer

Windows Forum Team
Staff member
Member details
Joined
Jul 4, 2015
Messages
8,995
Are you using a hook or still polling GetMessage?
 

liz08

Active Member
Member details
Joined
Oct 9, 2017
Messages
21
Thread Author #11
Tried hook, GetMessage and spy(created MFC application, provided the handle of the mfc application window and checked for the win messages.

Through spy i got to know along with WM_DEVICECHANGE , WM_GETICON, WM_CANCELMODE, WM_ACTIVATEAPP and WM_ACTIVATETOPLEVEL also is sent by windows.
 

Neemobeer

Windows Forum Team
Staff member
Member details
Joined
Jul 4, 2015
Messages
8,995
A hook is the only reliable way you will accomplish this. You need to intercept all messages (global) and filter out the ones and allow the rest.
 

liz08

Active Member
Member details
Joined
Oct 9, 2017
Messages
21
Thread Author #13
Hey... WM_GETICON was causing the taskbar to show up..
This message was handled by using Windows API and hide it using SW_HIDE. The issue is no more reproducible.
 

Solution

liz08

Active Member
Member details
Joined
Oct 9, 2017
Messages
21
Thread Author #14
Hey... WM_GETICON was causing the taskbar to show up..
This message was handled by using Windows API and hide it using SW_HIDE. The issue is no more reproducible.