>>251 ほんとだ。スパイのソース見たらちゃんと書いてあったよ。 // Note that CallNextHookEx ignores the first parameter (hhook) so // it is acceptable (barely) to pass in a NULL. だって。
>>316 MSDNの FILETIME の説明を読めよ。 Copy the resulting FILETIME structure to a ULARGE_INTEGER structure. Use normal 64-bit arithmetic on the ULARGE_INTEGER value.
エディタ作りでドラッグ&ドロップをWM_NOTIFYを捕まえる(横取り)かフック、 っていうかサブクラスるか考え、WM_NOTIFYの 方向にしました。とても難しかたです。横取りの方法では ENDROPFILES構造体を使わねばならず、ほとんど 資料はありませんでした。この構造体はENDROPFILES cp:Character position at which the dropped files would be inserted. ていうメンバがあって要はエディット部の、どの位置にファイルが D&Dされるかの位置指示子です。エディットに何も書かずにD&D するとこの値が不正らしく、カーネルやらシェルエラーがぴよぴよ出て、悩まされましたが、 とりあえず適当にナンか書いてカーソルを適当な位置に置いておくと 成功です!万歳! 漏れは天才です ありがとうございmす! でも多分これからサブクラス化します。
Option Explicit Declare Function RegisterEventSource Lib "advapi32.dll" Alias _ "RegisterEventSourceA" ( ByVal lpUNCServerName As String, _ ByVal lpSourceName As String) As Long Declare Function DeregisterEventSource Lib "advapi32.dll" ( _ ByVal hEventLog As Long) As Long Declare Function ReportEvent Lib "advapi32.dll" Alias "ReportEventA" ( _ ByVal hEventLog As Long, ByVal wType As Integer, _ ByVal wCategory As Integer, ByVal dwEventID As Long, _ ByVal lpUserSid As Any, ByVal wNumStrings As Integer, _ ByVal dwDataSize As Long, plpStrings As Long, lpRawData As Any) As Boolean Declare Function GetLastError Lib "kernel32" () As Long Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _ hpvDest As Any,hpvSource As Any, ByVal cbCopy As Long) Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, _ ByVal dwBytes As Long) As Long Declare Function GlobalFree Lib "kernel32" ( ByVal hMem As Long) As Long
Public Const EVENTLOG_SUCCESS = 0 Public Const EVENTLOG_ERROR_TYPE = 1 Public Const EVENTLOG_WARNING_TYPE = 2 Public Const EVENTLOG_INFORMATION_TYPE = 4 Public Const EVENTLOG_AUDIT_SUCCESS = 8 Public Const EVENTLOG_AUDIT_FAILURE = 10
Public Sub LogNTEvent(sString As String, iLogType As Integer, _ iEventID As Long) Dim bRC As Boolean Dim iNumStrings As Integer Dim hEventLog As Long Dim hMsgs As Long Dim cbStringSize As Long hEventLog = RegisterEventSource("", App.Title) cbStringSize = Len(sString) + 1 hMsgs = GlobalAlloc(&H40, cbStringSize) CopyMemory ByVal hMsgs, ByVal sString, cbStringSize iNumStrings = 1 If ReportEvent(hEventLog, iLogType, 0, iEventID, 0&, iNumStrings, cbStringSize, hMsgs,hMsgs) = 0 Then MsgBox GetLastError() End If Call GlobalFree(hMsgs) DeregisterEventSource (hEventLog) End Sub
Sub Main() Call LogNTEvent("Information from " & App.EXEName, EVENTLOG_INFORMATION_TYPE, 1001) Call LogNTEvent("Warning from " & App.EXEName, EVENTLOG_WARNING_TYPE, 1002) Call LogNTEvent("Error from " & App.EXEName, EVENTLOG_ERROR_TYPE, 1003) End Sub