VB关于EnableWindow的问题

来源:百度知道 编辑:UC知道 时间:2024/04/30 07:56:47
我先用
dim e as long
e=enablewindow(me.hwnd,0)把自己的程序禁止输入了,但是
e的返回值是零,是零的话应该是函数使用失败,但是我的窗口确实不能输入了,为什么?
然后我把桌面句柄找来,再禁止,返回值又是零,而且窗口不能禁止输入,
为什么?
请高手来帮忙下,小弟先谢谢了
那如果函数调用失败,返回值也是零么?
如果这样,怎么区分啊??

这个函数很特别额
它的返回值为:
如果窗口原来是被禁止的,返回值不为零;
如果窗口原来不是被禁止的,返回值为零。

EnableWindow
The EnableWindow function enables or disables mouse and keyboard input to the specified window or control. When input is disabled, the window does not receive input such as mouse clicks and key presses. When input is enabled, the window receives all input.

BOOL EnableWindow(
HWND hWnd, // handle to window
BOOL bEnable // enable or disable input
);
Parameters
hWnd
[in] Handle to the window to be enabled or disabled.
bEnable
[in] Specifies whether to enable or disable the window. If this parameter is TRUE, the window is enabled. If the parameter is FALSE, the window is disabled.
Return Values
If the window was previously disabled, the return value is nonzero.

If the window was not previously disabled, the return value is zero. To get extended error information, call GetLastError.

返回0表示窗口原来是Ena