windows核心编程

所需积分/C币:7 2018-08-21 13:32:19 35.37MB PDF

Windows核心编程 PDF高清版,C++程序员必看的书籍之一
Chia-pub.coM t File Edit view Insert Project Debug Tools window Help 回x haNdlE hfile CreateFile("C: Jef f Ey return(0) 0. NULL. OFEN EXISTING. 0, NULL x Context WinM ain/HINSTANCE_", HINSTANCE_*, char RI @err, hr : 0x00000002 The system cannot find the file hfi1忌 OgfEffEfEE specified 区At0人 Locals\t n117C1p叫 OVR REAE Chinapub cot Error Lookup Error Message The system cannot find the file: Maul ok Up DWORD FormatMessage( dWoRd dwFTags LPCVOID SOurce, DWORD dwMessageld DWORd dWLanguageId PTSTR pSZBuffer DWORD sIze va_1ist *Arguments): VOID SetLastError( dWoRd dwErrCode) China pub coM XEn Ec[c厂gn The operation completed successfully. //Get the error code dWORd dwError =GetDigItemInt(hwnd, IDC_ERRORCODE, NULL, FALSE) HLOCAL local NULL // Buffer that gets the error message string 7/ Get the error code's textual description boOL fOk FormatMessage( FORMAT-MESSAGE-FROM_SYSTEM I FORMAT_MESSAGE_ALLOCATE_BUFFER nUlL. dwError MAKELANGiD(LANG_ENGLISH, SUBLANG_ENGLISH_US) (LPTSTR)&local, 0, NULL) f chlocal ! NULL)( SetDigItemText(hwnd, IDC_ERRORTEXT,(PCTSTR) Local Lock(local)): Local Free(local) ei se SetDigItem Text(hwnd, IDC_ERRORTEXT, TEXT( Error number not found. " ) X ErrorShowcpp 本水**率半**农*水非串枣串**半*忠*米串***水冰浓*冰**冰*串***水*来浓水冰率率***本忠非串*尔本*郴廓率**率*半***求水申赤水 Module: Errorshow cpp Notices: Copyright (c)2000 Jeffrey Richter 米半半*水半米半容半水水半非*冰水*米忠串忠*本水米半串事水水水*非冰水冰半半非水冰农*水水非木审水**水水冰**客水水本事冰*冰 #include ".\ CmnHdr See Appendix A.*/ #include <windows. h> include <tchar. h> Include "Resource, h lefine ESM_POKECODEANDLooKUP: (WM_USER+ 100) const TCHAR g_szAppName[]= TEXT("Error Show /J/1 BOOL Dig_OnIni tDialog(HWNDhwnd, HWNd hwnd Focus, LPARAM IParam) chSETDLGICoNS(hwnd, IDI_ERRORSHOW): //Dont accept error codes more than 5 digits long Edit_LimitText(Get]gItem(hwnd, IDC_ERRORCODE), 5); //Look up the command -1ine passed error number SendMessage(hwnd, ESM_POKECODEANDLOOKUP, 1 Param, 0): return(True) Chinapub.com //r void Dig_OnCommand( Hwnd hwnd, int id, hWnd hwndctl, UINT. codeNoti fy)[ switch (id)[ case idcancel Enddialog(hwnd, id) break case iDC ALWAY SONToP SetwindowPos(hwnd, isDigButton Checked (hwnd, IDC _ALWAYSONTOP) ?HMND-TOPMOST HWND-NOTOPMOST. 0,0,0,0, SWP_NOMOVE| SWP_NOSIZE) break case Idc errorcode: EnableWindow(Geto] gItem (hwnd, IDOK), Edit_GetTextLength(hwndCt1)>0) break case idok. / Get the error code dWoRd dwError GetDigItemInt(hwnd, IDC_ERRORCODE, NULL, FALSE): HLOCAL local= NULL; / Buffer that gets the error message string 7/ Get the error code's textual description bool fok FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM I FORMAT_MESSAGE_ALLOCATE_BUFFER NULL, dwError, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US (PTSTR)&local. 0, NULL) if(! fok)i / Is it a network-related error HMOdULE hD11 LoadLibrary Ex(TeXT("netmsgd11") DONT__RESOLVE_DLL_REFERENCES) 1f〔hD11!=NULL) FormatMessage FORMAT_MESSAGE_FROM_HMODULE FORMAT__MESSAGE__ SYSTEM hDil, dwError. MAKELANGID(LANG_ENGLISH, SUBLANGENGLISH_US) (PTSTR)&local, 0, NULL) FreeLf brary (hD11) if (local I= NULL)( SetDigItemText(hwnd, IDC_ERRORTEXT. (PCTSTR) Local Lock(local)): Local Free(local) else i SetDigItemText(hwnd, IDC_ERRORTEXT, TEXT("Error: number not found. " )) break Chinapub.com INT_PTR WINAPI D1 g_Proc(HWNDhwnd, UINT uMsg, WPARAM WParam, LPARAM 1 Param)( switch (uMsg) chHANDLE_DLGMSG(hwnd, WM_INITDIALOG, D1g_OnInitDialog) chHANDLE DLGMSG(hwnd, WM_COMMAND, D]g_On Command): case ESM_POKECODEANDLoOKUP: SetDlgItemInt(hwnd, IDC_ERRORCODE,(UINT)WParam, FALSE): FORWARD_WM_COMMAND(hwnd, IDOK, GetD1gItem(hwnd, IDOK),BN_CLICKED PostMessage); SetForegroundwindow (hwnd); break return( False): int WI NAPI -tWinMain(HINSTANCE hinstExe. HINSTANCE, PTSTR PSzCmdLine, int)i HWND hwnd FindWindow(TEXT(#32770"),TEXT("Error Show")) if (Iswindow (hwnd))[ // An instance is already running, activate it. and send it the new SendMessage(hwnd, ESM_POKECODEANDLOOKUP,-ttoi(pszcmdLine),0) h else i DialogBoxParam(hinstExe, MAKEINTRESOURCE(IDD-ERRORSHO) NULL DIg_Proc,-ttoi(psz cmdLine)); return (0): ///r//EndofFilef/f/ffll/l//////////// //Microsoft Developer studio generated resource script include " resource.h" #define APSTUDIO_READONLY_SYMBOLS / Generated from the teXtinclude 2 resource include "afxres. h" fundef APSTUdIo_READONLY_SYMBOLS / English (U.s) resources fif I defined(AFX__RESOURCE_DLL)I defined(AFX_TARG_ENU) fifdef WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH US Pragma code_page(1252) fendi // WIN32 Chinapub.com / Dialog IDD ERRORSHOW DIalOGeX 0.0. 182 42 STYLE DS_SETFOREGROUND I DS-3DLOOK I DS_CENTER I WS_MINIMIZEBOX| WS_VISIBLE WS-CAPTIONIWS_SYSMENU CAPTION " Error show' FonT 8, MS Sans Serif BEGIN LTEXT "Error: IDC STATIC, 4, 4, 19, 8 EDITTEXT I DC_ERRORCODE, 24, 2, 24, 14,ES_AUTOHSCROLL ES_NUMBER DEFPUSHBUTTON Look up",IDOK, 56, 2, 36, 14 CONTROL "&0n top", IDC_ALWAYSONTOP, "Button",BS_AUTOCHECKBOX I MS_ TABST0P,104,4,38,10 EDITTEXT IDC_ERRORTEXT. 4. 20, 176, 20, ES_MULTILINE I ES_AUTOVSCROLL I ES_READONLY I NOT WS_BORDER WS-VSCROLL WS EX CLIENTEDGE END //////////111111111111 // DESIGNINFO di fdef APSTUDIO-INVOKED GUIDELINES DESIGNINFO DISCARDABLE BEGIN IDD ERRORSHOW, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 175 TOPMARGIN. 7 BOTTOMMARGIN, 35 END END fendi / APSTUDIO-INVOKED fifdef APSTUDIO_INVOKED //111111111111111111111111111111111111111111111 // TEXTINCLUDE 1 TEXTINCLUDE DISCARDABLE Be resource.h\0" BEGIN END 2 TEXTINCLUDE DISCARDABLE BEGIN Include ""afxres. h""\r\n END 3 TEXTINCLUDE DISCARDABLE BEGIN \O" ND fendif / APSTUDIO-_INVOKED //Icon / / Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems IDI ERRORSHOW ICON DISCARDAbLE Error Show. ico" FFendif / English (U.S) resources ////1 f ifndef APSTUDio_INvOKeD //Generated from the TEXTINClUDE 3 resource fendif / not APSTUDIO_INVOKED

...展开详情
img
qq_42737727

关注 私信 TA的资源

上传资源赚积分,得勋章
最新资源