唉!唉!
大家幫忙看看.我的想法是這樣..
1. thisworkbook
Private Sub WorkBook_Open()
XLhwnd = FindWindow("XLMAIN", vbNullString)
ParentHwnd = FindWindowEx(XLhwnd, ByVal 0&, "XLDESK", vbNullString)
'prevWndProc = SetWindowLong(ParentHwnd, GWL_WNDPROC, AddressOf WndProc)
Set myApp = New Class1
Set myApp.clsApp = Application
Me.IsAddin = False
flg = True
With Application.CommandBars("standard").Controls.Add(Type:=msoControlButton, before:=1, temporary:=True)
.FaceId = 200
.OnAction = "myReload"
End With
myInit
chgXLDESKrgn
End Sub
2. module
Public prevWndProc As Long
Function WndProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
WndProc = CallWindowProc(prevWndProc, hWnd, Msg, wParam, lParam)
If Msg = WM_SIZE Then
If flg Then
'Call frmExplorer.Image1_Click 'Use this statement if you want to hide the explorer after the window resized
'Call myReload 'Use this statement if you want to show the explorer after the window resized
End If
End If
End Function
情形是這樣的...
remark這一行
'prevWndProc = SetWindowLong(ParentHwnd, GWL_WNDPROC, AddressOf WndProc)
當然就沒有callback啦.沒有解決上面的問題.但是功能大致可行.僅是有時候要要多按一下而已.
請大家測試callback功能.去掉這行remark.
為何就是不穩定總是當機?難道callback函數在excel還不行用?
cP0IctR5.rar
(42.05 KB, 下载次数: 37)
|