全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1806
推到 Plurk!
推到 Facebook!

ReportEvent

答題得分者是:RaynorPao
jessechan
版主


發表:109
回覆:394
積分:254
註冊:2002-04-05

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-11-18 18:49:03 IP:203.75.xxx.xxx 未訂閱
請問有人會用 BOOL ReportEvent( HANDLE hEventLog, // handle returned by RegisterEventSource WORD wType, // event type to log WORD wCategory, // event category DWORD dwEventID, // event identifier PSID lpUserSid, // user security identifier (optional) WORD wNumStrings, // number of strings to merge with message DWORD dwDataSize, // size of binary data, in bytes LPCTSTR *lpStrings, // array of strings to merge with message LPVOID lpRawData // address of binary data ); 這個 Win32 API 嗎, 我得到一個 error code 87 不知是什麼意思. Jesse Chan
------
Jesse Chan
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-11-19 00:37:34 IP:61.221.xxx.xxx 未訂閱
引言: 請問有人會用 BOOL ReportEvent( HANDLE hEventLog, // handle returned by RegisterEventSource WORD wType, // event type to log WORD wCategory, // event category DWORD dwEventID, // event identifier PSID lpUserSid, // user security identifier (optional) WORD wNumStrings, // number of strings to merge with message DWORD dwDataSize, // size of binary data, in bytes LPCTSTR *lpStrings, // array of strings to merge with message LPVOID lpRawData // address of binary data ); 這個 Win32 API 嗎, 我得到一個 error code 87 不知是什麼意思. Jesse Chan
JesseChan你好: 以下內容轉貼自 M$ Platform SDK 關鍵字 Reporting an Event
Reporting an Event
After you have added a source name to the registry, use the RegisterEventSource function to get a handle to the Application event log. The following example obtains the handle and then adds an event to the log using the ReportEvent function.     void MyReportEvent(LPCTSTR *szMsg)
{
    HANDLE h; 
 
    h = RegisterEventSource(NULL,  // uses local computer 
             TEXT("SamplApp"));    // source name 
    if (h == NULL) 
        ErrorExit("Could not register the event source."); 
 
    if (!ReportEvent(h,           // event log handle 
            EVENTLOG_ERROR_TYPE,  // event type 
            0,                    // category zero 
            MSG_ERR_EXIST,        // event identifier 
            NULL,                 // no user security identifier 
            1,                    // one substitution string 
            0,                    // no data 
            szMsg,                // pointer to string array 
            NULL))                // pointer to data 
        ErrorExit(TEXT("Could not report the event.")); 
 
    DeregisterEventSource(h); 
} 
Recall that your header file contains the event identifiers. For this example, the following event identifier was used:     //
// MessageId: MSG_ERR_EXIST
// MessageText:
//  File %1 does not exist.
//
#define MSG_ERR_EXIST                         ((DWORD)0xC0000004L)
--
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
系統時間:2024-03-29 16:22:39
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!