Einzelnen Beitrag anzeigen

Benutzerbild von Flocke
Flocke

Registriert seit: 9. Jun 2005
Ort: Unna
1.172 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#8

Re: [C] Zeichenfolge aus Funktion zurückgeben

  Alt 13. Sep 2006, 10:31
Etwa so:
Code:
TCHAR *
SysErrorMessage (DWORD dwErrorCode, TCHAR *pszBuf, int nLenBuf)
{
  FormatMessage(
    FORMAT_MESSAGE_FROM_SYSTEM | (pszBuf ? FORMAT_MESSAGE_ALLOCATE_BUFFER : 0),
    NULL,
    dwErrorCode ? dwErrorCode : GetLastError(),
    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
    pszBuf ? pszBuf : (LPTSTR)&pszBuf,
    pszBuf ? nLenBuf : 0,
    NULL);
  return pszBuf;
}
// Nachtrag: noch erweitert
Volker
Besucht meine Garage
Aktuell: RtfLabel 1.3d, PrintToFile 1.4
  Mit Zitat antworten Zitat