Home > Software engineering >  The mouse click desktop icon for a file name
The mouse click desktop icon for a file name

Time:10-04

 
SIZE_T len=sizeof (LVITEM);
Lvi. CchTextMax=512;
Lvi. ISubItem=0;
Lvi. PszText=(LPWSTR _item);
Lvi. Mask=LVIF_IMAGE | LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
if(! WriteProcessMemory (g_hProcess _lvi, & amp; Lvi, sizeof (LVITEM), NULL)) {
Rs=GetLastError ();
}
: : SendMessage (g_DLVhwnd LVM_GETITEMTEXT, (WPARAM) icont, (LPARAM) _lvi);
ReadProcessMemory (g_hProcess _item, item, 512, NULL);


Use the above code to obtain the mouse to select a single desktop file name, but hidden in the file extension when not available to the file extension, is there a master can help me have a look,
Thank you thank you very much!

CodePudding user response:

GetFullPathName
The GetFullPathName function retrieves The full path and filename of a specified file.

DWORD GetFullPathName (
LPCTSTR lpFileName,//a pointer to the name of the file to find the path for
DWORD nBufferLength,//the size, in characters, of the path buffer
LPTSTR lpBuffer,//a pointer to the path buffer
LPTSTR * lpFilePart//pointer to filename path in
);

The Parameters
LpFileName
Pointer to a null - terminated string that specifies a valid filename. This string can use either short (8.3 form the) or long filenames.
NBufferLength
Specifies the size, in characters, of the buffer for the drive and path.
LpBuffer
Pointer to a buffer that contains the null - terminated string for the name of the drive and path.
LpFilePart
Pointer to a variable that receives the address (in lpBuffer) of the final filename component in the path.
The Return Values
If the GetFullPathName function succeeds, the return value is the length, in characters, of the string copied to lpBuffer, not o the terminating null character.

If the lpBuffer buffer is too small, the return value is the size of the buffer, in characters, required to hold the path.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Few
The GetFullPathName function merges The name of The current drive and directory with The specified filename to determine The full path and filename of The specified file. It also calculates The address of The filename portion of The full path and filename. This function does not verify that The resulting path and filename are valid, or that they refer to an existing file on The associated volume.

QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winbase. H.
The Import Library: Use kernel32. Lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also
The File I/O the Overview, the File Functions provides, GetShortPathName, GetTempPath, SearchPath


CodePudding user response:

reference 1st floor zhao4zhong1 response:
GetFullPathName
The GetFullPathName function retrieves The full path and filename of a specified file.

DWORD GetFullPathName (
LPCTSTR lpFileName,//a pointer to the name of the file to find the path for
DWORD nBufferLength,//the size, in characters, of the path buffer
LPTSTR lpBuffer,//a pointer to the path buffer
LPTSTR * lpFilePart//pointer to filename path in
);

The Parameters
LpFileName
Pointer to a null - terminated string that specifies a valid filename. This string can use either short (8.3 form the) or long filenames.
NBufferLength
Specifies the size, in characters, of the buffer for the drive and path.
LpBuffer
Pointer to a buffer that contains the null - terminated string for the name of the drive and path.
LpFilePart
Pointer to a variable that receives the address (in lpBuffer) of the final filename component in the path.
The Return Values
If the GetFullPathName function succeeds, the return value is the length, in characters, of the string copied to lpBuffer, not o the terminating null character.

If the lpBuffer buffer is too small, the return value is the size of the buffer, in characters, required to hold the path.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Few
The GetFullPathName function merges The name of The current drive and directory with The specified filename to determine The full path and filename of The specified file. It also calculates The address of The filename portion of The full path and filename. This function does not verify that The resulting path and filename are valid, or that they refer to an existing file on The associated volume.

QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winbase. H.
The Import Library: Use kernel32. Lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related