如果用API设置窗体上的某个按钮是否可用?
因为这个按钮可能是某一个按件上的按钮,没有提供相关的设置方法,只能用API循环窗体上所有的按钮再禁止了.不知道能不能实现.
[解决办法]
EnableWindow
[解决办法]
http://vbworld.sxnw.gov.cn/vbapi/detail/EnableWindow.htm
[解决办法]
http://www.m5home.com/bbs/dispbbs.asp?boardID=2&ID=20&page=1
//
来抢分了,呵呵
以上的程序中,对目标句柄的标题(或控件ID之类能唯一标识控件的属性)判断一下就行了
[解决办法]
GetDlgItem and EnableWindow
[解决办法]
在 Microsoft Visual Studio 6.0 Tools 下有个 SPY++,用它取得 hwnd,再用程序设置属性。
[解决办法]
窗口上添加几个按钮.用默认名字
====================窗口代码====================
Option Explicit
Private Declare Function EnumChildWindows Lib "user32.dll " (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function EnumWindows Lib "user32.dll " (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Sub Command1_Click()
EnumChildWindows Me.hwnd, AddressOf procEnumWindow, 1
End Sub
====================添加模块,写入以下代码====================
Option Explicit
Private Declare Function EnableWindow Lib "user32.dll " (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Function procEnumWindow(ByVal hwnd As Long, ByVal lParam As Long) As Long
Debug.Print hwnd, lParam
EnableWindow hwnd, 0
procEnumWindow = 1
End Function
[解决办法]
建议用SPY++,取得 按钮的类,再用findwindow,findwindowex,找到它的hwnd,然后enablewindow