Desktop Functions: Smart Device Functions:
|
Search Results for "GetLastError" in [All]user32
/// <para>If the function fails, the return value is NULL. To get extended error information, call GetLastError.</para>
''' <para>If the function fails, the return value is NULL. To get extended error information, call GetLastError.</para> When you call this function, the WndProc function must respond to the WM_NCCREATE message by returning TRUE. If it does not, the creation process will fail. A null handle will be returned from CreateWindowEx and GetLastError will return 0. See MSDN on WM_NCCREATE (http://msdn.microsoft.com/en-us/library/ms632635.aspx) and also WM_CREATE (http://msdn.microsoft.com/en-us/library/ms632619.aspx). You can have your WndProc call DefWindowProc, which will take care of this issue.
/// <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.</returns>
''' <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.</returns> If the clipboard is not owned, the return value is NULL. To get extended error information, call GetLastError. 5: GetDC Windows NT/2000/XP: To get extended error information, call GetLastError. 6: GetDCEx Windows NT/2000/XP: To get extended error information, call GetLastError. 7: GetLastError
static extern TODO GetLastError(TODO);
Declare Function GetLastError Lib "kernel32.dll" (TODO) As TODO
int nLatError = GetLastError(); // in kernel32.dll
/// If the function fails, the return value is zero. To get extended error information, call GetLastError. 10: GetWindowTex
/// call GetLastError. 11: MoveWindow
/// <br />To get extended error information, call GetLastError.
''' <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para></returns> 12: PostMessage MSDN says: If the function fails, the return value is zero. To get extended error information, call GetLastError.
/// information, call GetLastError. 14: RemoveProp
/// <para>Windows Vista: RemoveProp is subject to the restrictions of User Interface Privilege Isolation (UIPI). A process can only call this function on a window belonging to a process of lesser or equal integrity level. When UIPI blocks property changes, GetLastError will return 5.</para> 15: SetProp
/// <para>Windows Vista: SetProp is subject to the restrictions of User Interface Privilege Isolation (UIPI). A process can only call this function on a window belonging to a process of lesser or equal integrity level. When UIPI blocks property changes, GetLastError will return 5.</para>
/// <returns>If the data handle and string are added to the property list, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.</returns>
/// If the function fails, the return value is zero. To get extended error information, call GetLastError. 17: SetWindowsHookEx
/// <para>To get extended error information, call GetLastError.</para> 18: SetWindowText
/// To get extended error information, call GetLastError.
/// <see cref="!:https://msdn.microsoft.com/en-us/library/windows/desktop/ms679360%28v=vs.85%29.aspx">GetLastError</see> kernel3220: AttachConsole,
21: AttachConsole
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. 23: CreateMutex
// check GetLastError value (MUST use this call. See MSDN) 24: CreateNamedPipe
private static extern uint GetLastError();*/ 25: DeviceIoControl
Private Declare Function GetLastError Lib "kernel32" Alias "GetLastError" () As Integer
MsgBox(GetLastError())
MsgBox(GetLastError())
MsgBox(GetLastError())
MsgBox(GetLastError()) 26: GetLastError
static extern uint GetLastError();
// GetLastError is save! Tested extensively here http://stackoverflow.com/questions/17918266/winapi-getlasterror-vs-marshal-getlastwin32error
// You should never PInvoke to GetLastError. Call Marshal.GetLastWin32Error instead!
' You should never PInvoke to GetLastError. Call Marshal.GetLastWin32Error instead! Calling GetLastError directly via PInvoke is not guaranteed to work due to the CLR's internal interaction with the operating system. Instead, call Marshal.GetLastWin32Error.
/// If the function fails, the return value is TIME_ZONE_ID_INVALID. To get extended error information, call GetLastError.
/// If the function fails, the return value is zero. To get extended error information, call GetLastError. 28: GetVersion If you forget to set the OSVersionInfoSize field of the OSVERSIONINFO struct, the function will return false. GetLastError() will return: 29: GetVersionEx If you forget to set the OSVersionInfoSize field of the OSVERSIONINFO struct, the function will return false. GetLastError() will return: 30: IsProcessInJob Return Value - If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. 31: LocalFree The SetLastError flag needs to be set to true in order to retain information that would be obtained from GetLastError in the event of an error being returned. 32: QueryDosDevice
else if(GetLastError() == ERROR_INSUFFICIENT_BUFFER)
Marshal.ThrowExceptionForHR(GetLastError()); 33: SetLastError Call SetLastError(0) at the beginning of your function if you'll use GetLastError.
/// If the function fails, the return value is TIME_ZONE_ID_INVALID. To get extended error information, call GetLastError.
/// If the function fails, the return value is zero. To get extended error information, call GetLastError. 35: SuspendThread static extern uint GetLastError();
throw new Win32Exception((int)GetLastError());
throw new Win32Exception((int)GetLastError()); wtsapi3236: WTSOpenServer As always, only do SetLastError=true if you actually intend to call GetLastError.
/// If the function fails, the return value is zero. To get extended error information, call GetLastError.
/// If the function fails, the return value is zero. To get extended error information, call GetLastError. psapi
Console.WriteLine("Call to EnumDeviceDrivers failed! To get extended error information, call GetLastError.");
Console.WriteLine("Call to EnumDeviceDrivers failed! To get extended error information, call GetLastError.");
Console.WriteLine("Call to EnumDeviceDrivers failed! To get extended error information, call GetLastError.");
Console.WriteLine("Call to EnumDeviceDrivers failed! To get extended error information, call GetLastError."); misc40: Comments I'd go so far as to recommend always mandating SetLastError -- explicitly setting SetLastError=false, to call out the (comparatively rare) Win32 functions that don't expose a failure path through GetLastError. ConstantsOne of the many error codes returned by GetLastError, which should not be used within the .NET framework. Instead you must use Marshal.GetLastWin32Error(). 42: WINERROR It is documented that you should NOT use the pinvoke GetLastError() due to the fact that the runtime mpr43: WNetGetLastError
static extern TODO WNetGetLastErrorA(ref int lpError,ref string lpErrorBuf,int nErrorBufSize,string lpNameBuf,int nNameBufSize); public static extern uint WNetGetLastError(ref int lpError,StringBuilder lpErrorBuf,int nErrorBufSize,StringBuilder lpNameBuf,int nNameBufSize); Declare Function WNetGetLastError Lib "mpr.dll" Alias "WNetGetLastErrorA" (ByRef lpError As Integer, ByVal lpErrorBuf As String, ByVal nErrorBufSize As Integer, ByVal lpNameBuf As String, ByVal nNameBufSize As Integer) As Integer irprops
/// <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.</returns>
/// Returns NULL upon failure. Call the GetLastError function for more information on the error. The following table describe common errors:</returns> shell3245: SHFileOperation Do not use GetLastError with the return values of this function. icmp46: IcmpSendEcho
printf("IcmpCreatefile returned error: %ld\n", GetLastError()); winspool47: ClosePrinter As always, only do SetLastError=true if you actually intend to call GetLastError. 48: GetPrinterData As always, only do SetLastError=true if you actually intend to call GetLastError. 49: OpenPrinter As always, only do SetLastError=true if you actually intend to call GetLastError (This includes throwing a Win32Exception if the call fails) 50: WritePrinter
// If you did not succeed, GetLastError may give more information ws2_3251: send If no error occurs, sendto returns the total number of bytes sent, which can be less than the number indicated by len. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError. 52: SendTo If no error occurs, sendto returns the total number of bytes sent, which can be less than the number indicated by len. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError. 53: WSAGetLastError
static extern Int32 WSAGetLastError();
Declare Function WSAGetLastError Lib "ws2_32.dll" () As Int32 rapi54: CeGetLastError
public static extern int CeGetLastError(); function info on msdn at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceactsy/html/cerefCeGetLastErrorRAPI.asp 55: CeMoveFile Returns 0 for failure. Use CeGetLastError() and CeRapiGetError() to see errors on failure. coredll56: CreateEvent
''' <returns>Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.</returns>
''' <returns>Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.</returns> 57: CreateMutex
//public static extern int GetLastError(); 58: CreateProcess You will need the above ProcessInfo class and may also want to use GetLastError and WaitForSingleObject. 59: DisableGestures Returns true if function succeeds; otherwise, false. To retrieve extended error information, call GetLastError 60: GetLastError
static extern Int32 GetLastError();
Declare Function GetLastError Lib "coredll.dll" () As Int32 It is recommended that you do not call the Win32 GetLastError method directly. Because of the way P/Invoke works, the error message may get reset between Win32 calls in your code. Instead, call the Marshal.GetLastWin32Error method, which can be combined with the ever useful Marshal.ThrowExceptionForHR method. See below for an example.
Int32 lastError = GetLastError();
lastError = GetLastError() Cut off search results after 60. Please refine your search. |