Modify

Opened 13 years ago

Closed 13 years ago

#2030 closed Feature Request (Rejected)

_WinAPI_GetLastErrorMessage - accept specified error code parameter

Reported by: anonymous Owned by: Gary
Milestone: Component: Standard UDFs
Version: Severity: None
Keywords: fuvalik Cc:

Description

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_GetLastErrorMessage
; Description ...: Returns the calling threads last error message
; Syntax.........: _WinAPI_GetLastErrorMessage([$iError])
; Parameters ....: $iError 
; Return values .: Success      - Last error message
; Author ........: Paul Campbell (PaulIA)
; Modified.......: jpm, danielkza, Valik
; Remarks .......:
; Related .......: _WinAPI_GetLastError
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func _WinAPI_GetLastErrorMessage($nError = False)
    Local $tBufferPtr = DllStructCreate("ptr")
	Local $pBufferPtr = DllStructGetPtr($tBufferPtr)
	
	If Not $nError Then $iError = _WinAPI_GetLastError()

	Local $nCount = _WinAPI_FormatMessage(BitOR($__WINAPICONSTANT_FORMAT_MESSAGE_ALLOCATE_BUFFER, $__WINAPICONSTANT_FORMAT_MESSAGE_FROM_SYSTEM), _
		0, $nError, 0, $pBufferPtr, 0, 0)
    If @error Then Return SetError(@error, 0, "")

     Local $sText = ""
    Local $pBuffer = DllStructGetData($tBufferPtr, 1)
    If $pBuffer Then
        If $nCount > 0 Then
            Local $tBuffer = DllStructCreate("wchar[" & ($nCount+1) & "]", $pBuffer)
            $sText = DllStructGetData($tBuffer, 1)
        EndIf
        _WinAPI_LocalFree($pBuffer)
    EndIf

    Return $sText
EndFunc   ;==>_WinAPI_GetLastErrorMessage

Attachments (0)

Change History (2)

comment:1 Changed 13 years ago by TicketCleanup

  • Version 3.3.6.1 deleted

Automatic ticket cleanup.

comment:2 Changed 13 years ago by trancexx

  • Resolution set to Rejected
  • Status changed from new to closed

Why?

Don't reply.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Gary.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.