GetLastError使用以及列印輸出方法

2021-07-11 07:48:13 字數 292 閱讀 2544

getlasterror()返回的只是乙個雙位元組數值(dword),但從雙位元組數無法直接知道錯誤出處,除非你把錯誤**及其含義都記住了(呵呵,一萬多個呢...),有個簡單輸出的方法如下:

#include #include void errorexit(lptstr lpszfunction) 

void main()

這樣就能直接列印出錯誤原因,而不是dword值了。

此段**想放在那裡就放在那裡。

具體的錯誤**及其含義請看 :

GetLastError 函式的介紹

getlasterror 函式的介紹 這是乙個很簡單的函式,它的作用就是取得上乙個函式操作時所產生的錯誤 通過錯誤 就可以在winerror.h標頭檔案中查詢到每一中錯誤 所表示的含義。也可以通過vc 自帶的error lookup工具來查詢其所表示的含義,其結果是一樣的。此函式的說明如下 dwor...

GetLastError 數字 轉換為 文字

1 具體引數 可參看 或 其它文章 或 msdn 2 vc6 測試 include include void main 3 delphi7 測試 define makelangid p,s word s 10 word p function makelangid p,s word dword beg...

NSSortDescriptor使用以及陣列排序

nssortdescriptor 指定用於物件陣列排序的物件的屬性。物件可能是字典,這種情況就是對字典陣列排序 如果是employee物件需要按照name來排序,就生成下面的descriptor nssortdescriptor descriptor nssortdescriptor sortdes...