窗体问题
如何点窗体无效,而是点击了窗体下边的其他界面?
意思就是点不着本窗体,实际上是点击了下边的窗体
[解决办法]
Option Explicit'窗体Form1,Form2Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongPrivate Const WS_EX_LAYERED As Long = &H80000Private Const WS_EX_TRANSPARENT As Long = &H20&Private Const LWA_ALPHA As Long = &H2Private Const GWL_EXSTYLE As Long = -20Private Sub Command1_Click() Dim OldStyle As Long OldStyle = GetWindowLong(Form1.hwnd, GWL_EXSTYLE) Call SetWindowLong(Form1.hwnd, GWL_EXSTYLE, GetWindowLong(Form1.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED) Call SetLayeredWindowAttributes(Form1.hwnd, 0, 255, LWA_ALPHA) '把这个255改成60,就透明得多了,再把鼠标移到Form2上的最大化最小化按钮上面,就有提示了。 Call SetWindowLong(Form1.hwnd, GWL_EXSTYLE, OldStyle Or WS_EX_LAYERED Or WS_EX_TRANSPARENT)End SubPrivate Sub Form_Load() Form2.ShowEnd Sub