开发者

Hide window using SetWindowPos doesnt hide combobox

开发者 https://www.devze.com 2023-01-22 20:51 出处:网络
Im trying to hide a window using this line of code SetWindowPos(d, IntPtr.Zero, 0, 0, 0, 0, 0x0001 | 0x0002 | 0x0004 | 0x0010 | 0x0080);

Im trying to hide a window using this line of code

SetWindowPos(d, IntPtr.Zero, 0, 0, 0, 0, 0x0001 | 0x0002 | 0x0004 | 0x0010 | 0x0080);

The SetWindowPos method is the one from user32.dll Most of the time it works fine, however if a combobox is open when Im hidding the window the list of the comb开发者_运维百科obox remains visible.

What am I doing wrong?


SetWindowsPos does not hide the dropdown list because the dropdown list of the combobox is not a child of the combobox, so it is not affected by SetWindowsPos.

(You might want to use Spy++ to see the parent of the dropdown list, which is NULL - meaning the desktop is its parent, in contrast with the combobox control who's parent is the form it is on)

Why not use the Form.Hide() method which properly hides the window and the combobox' dropdown list?

0

精彩评论

暂无评论...
验证码 换一张
取 消