|
excel没有秘密可言,楼主你不要指望没人看内容,论坛有要求,不要过多谈论,谢谢。程序中部分的如下:
Option Explicit
Public Wjm_1 As String, Wjm_2 As String
Private Const GWL_STYLE As Long = (-16)
Private Const WS_SYSMENU As Long = &H80000
Private Const HWND_TOP As Long = 0
Private Const SWP_NOMOVE As Long = &H2
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_DRAWFRAME As Long = &H20
Private Declare Function GetWindowLong Lib "user32.dll" _
Alias "GetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long) _
As Long
Private Declare Function SetWindowLong Lib "user32.dll" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function SetWindowPos Lib "user32.dll" ( _
ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) _
As Long
Private Sub HasSystemMenu(ByVal Allow As Boolean)
Dim lStyle As Long: lStyle = GetWindowLong(ApphWnd, GWL_STYLE)
If Allow Then
lStyle = lStyle Or WS_SYSMENU
Else
lStyle = lStyle And Not WS_SYSMENU
End If
Call SetWindowLong(ApphWnd, GWL_STYLE, lStyle)
Call SetWindowPos(ApphWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_DRAWFRAME)
End Sub
Private Function FindOurWindow(Optional ByVal sClass As String = vbNullString, Optional ByVal sCaption As String = vbNullString)
Dim hWndDesktop As Long
Dim hwnd As Long
Dim hProcThis As Long
Dim hProcWindow As Long
hWndDesktop = GetDesktopWindow
hProcThis = GetCurrentProcessId
Do
hwnd = FindWindowEx(hWndDesktop, hwnd, sClass, sCaption)
GetWindowThreadProcessId hwnd, hProcWindow
Loop Until hProcWindow = hProcThis Or hwnd = 0
FindOurWindow = hwnd
End Function
Private Function ApphWnd() As Long
If Val(Application.Version) >= 10 Then
ApphWnd = Application.hwnd
Else
ApphWnd = FindOurWindow("XLMAIN", Application.Caption)
End If
End Function |
|