开发者

Prevent undock computer in Windows

In Windows Vista SP2 and in Windows 7 there is a new item in the Start menu: Undock computer.

In respons to the DBT_QUERYCHANGECONFIG event I return BROADCAST_QUERY_DENY but the undocking function proceeds anyway. What is wrong?

A simple WindowProc to illustrate the problem:

LRESULT CMainWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
    switch (message) {

        case WM_DEVICECHANGE: {
            switch (wParam) {
                case DBT_QUERYCHANGECONFIG : {
                    return BROADCAST_QUERY_DENY;
                }
                break;
            }
            break;
        }
    }
    return CFrameWnd::WindowProc(message, wPar开发者_StackOverflowam, lParam);
}


I could not say for certain, but I believe I read that Microsoft changed some things regarding sleep, hibernate, and maybe this undock although I didn't read about undock.

The change I recall reading about was that applications can no longer stop a laptop from sleeping. They get notified and about 1 second to do something, that is it.

Double check all of the above with MS documentation if you can find it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜