GetFileTitle

3.1

  #include <commdlg.h>    

  int GetFileTitle(lpszFile, lpszTitle, cbBuf)    
  LPCSTR lpszFile; /* pointer to filename (including drive and directory) */
  LPSTR lpszTitle; /* address of buffer that receives filename */
  UINT cbBuf; /* length of buffer, */  

The GetFileTitle function returns the title of the file identified by the lpszFile parameter.

Parameters

lpszFile

Points to the name and location of an MS-DOS file.

lpszTitle

Points to a buffer into which the function is to copy the name of the file.

cbBuf

Specifies the length, in bytes, of the buffer to which the lpszTitle parameter points.

Return Value

The return value is zero if the function is successful. The return value is a negative number if the filename is invalid. The return value is a positive integer that specifies the required buffer size, in bytes, if the buffer to which the lpszTitle parameter points is too small.

Comments

The function returns an error value if the buffer pointed to by the lpszFile parameter contains any of the following:

An empty string

A string containing a wildcard (*), opening bracket ([), or closing bracket (])

A string that ends with a colon (:), slash mark (/), or backslash (\)

A string whose length exceeded the length of the buffer

An invalid character (for example, a space or unprintable character).

The required buffer size includes the terminating null character.