Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: get window system error dllcall
Here's how you can change that number into a text message.
Note that this is ONLY for DllCall and DllLastError(). It won't work for WinBatch errors reported by LastError().
;--------------------------------------- ; Get Windows System Error String ;--------------------------------------- #DefineFunction SystemError(Err) Buffer = BinaryAlloc(256) BinaryEodSet(Buffer,255) L = DllCall(StrCat(DirWindows(1),"Kernel32.dll"),long:"FormatMessageA",long:4096,long:0,long:Err,long:0,lpbinary:Buffer,long:256,long:0) if L == 0 Text = StrCat("Error #",Err) else Text = BinaryPeekStr(Buffer,0,256) endif BinaryFree(Buffer) Return Text #EndFunction ; ; How to use it... ; ;Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later). ;Windows 95/98/Me: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later). ;HRESULT SHEmptyRecycleBin(HWND hwnd, LPCTSTR pszRootPath, DWORD dwFlags); ;Empties recycle bin on c: drive driveroot = "CCC:" ;INVALID drive root to force system error. ;driveroot = "C:" ;VALID S_OK = 0 SHERB_NOCONFIRMATION = 1 ; No dialog box confirming the deletion of the objects will be displayed. SHERB_NOPROGRESSUI= 2 ; No dialog box indicating the progress will be displayed. SHERB_NOSOUND=4 ; No sound will be played when the operation is complete. dllHandle = DllLoad(strCat(DirWindows(1),"Shell32.dll")) ret = DllCall(dllHandle,long:"SHEmptyRecycleBinA",lpnull,lpstr:driveroot,long:SHERB_NOCONFIRMATION|SHERB_NOPROGRESSUI|SHERB_NOSOUND) if ret != S_OK ErrorText = SystemError(DllLastError()) Message("We Failed",ErrorText) exit endif Message("Finished","Emptied the Recycle Bin")
Article ID: W15135
File Created: 2002:10:18:14:35:24
Last Updated: 2002:10:18:14:35:24