DllMain 里,SetTimer定时器一点反应也没有
Public Function DllMain(ByVal hinstDLL As Long, ByVal fdwReason As Long, ByVal lpvReserved As Long) As LongDim riid As UUID
Dim aiid As UUID
Dim lpDllGetObj As Long
Select Case fdwReason
Case DLL_PROCESS_ATTACH '加载
CreateIExprSrvObj 0, 4, 0
CoInitialize 0
lpDllGetObj = GetProcAddress(hinstDLL, "DllGetClassObject")
CopyMemory gvbtab, ByVal lpDllGetObj + 2, 4
CopyMemory gvb, ByVal lpDllGetObj + 7, 4
CopyMemory gloaders, ByVal lpDllGetObj + 12, 4
With riid
.Data1 = 1
.Data4(0) = &HC0
.Data4(7) = &H46
End With
DllMain = UserDllMain(gloaders, gvb, hinstDLL, fdwReason, lpvReserved)
VBDllGetClassObject gloaders, gvb, gvbtab, aiid, riid, ofac
CopyMemory gvbtab, ByVal lpDllGetObj + 2, 4
CopyMemory gvb, ByVal lpDllGetObj + 7, 4
CopyMemory gloaders, ByVal lpDllGetObj + 12, 4
'自定义内容
'TimerProc
Handle = FindWindow(vbNullString, "Program manager")
lngTimerID = SetTimer(Handle, 0, 1000, AddressOf TimerProc) 'SetTimer第一个参数是进程句柄,第二个是timer的编号,第三个是时间间隔。第四个参数是一个回调函数。
Case DLL_PROCESS_DETACH '卸载
CoUninitialize
DllMain = UserDllMain(gloaders, gvb, hinstDLL, fdwReason, lpvReserved)
KillTimer Handle, lngTimerID
End Select
End Function
Public Function TimerProc()
MsgBox (Now)
End Function
各位呀,谁帮下忙呀