Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

PathRemoveExtension (shlwapi)
 
.
Summary
PathRemoveExtension - Removes the file name extension from a path, if one is present.

C# Signature:

/// <summary>
/// Removes the file name extension from a path, if one is present.
/// </summary>
/// <param name="pszFile">A pointer to a null-terminated string of length MAX_PATH from which to remove the extension.</param>
[DllImport("shlwapi.dll", EntryPoint = "PathRemoveExtensionW",  SetLastError = True, CharSet= CharSet.Unicode)]
static extern void PathRemoveExtension([MarshalAs(UnmanagedType.LPTStr)]System.Text.StringBuilder pszFile);

VB.NET Extension

''' <summary>
''' Removes the file name extension from a path, if one is present.
''' </summary>
''' <param name="pszFile">A pointer to a null-terminated string of length MAX_PATH from which to remove the extension.</param>
<DllImport("shlwapi.dll", EntryPoint:="PathRemoveExtensionW",  SetLastError:=True, CharSet:=CharSet.Unicode)> _
Public Sub PathRemoveExtension(<MarshalAs(UnmanagedType.LPTStr)>pszFile As System.Text.StringBuilder)
End Sub

VB Signature:

Public Declare Sub PathRemoveExtension Lib "shlwapi" Alias "PathRemoveExtensionA" _
        (ByVal pszPath As String)

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Dim strFile As New system.Text.StringBuilder(255)
strFile.Append("c:\abc\def\words.doc")
Win32.API.Shlwapi.PathRemoveExtension(strFile)
System.Diagnostics.Debug.WriteLine(strFile.ToString())

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions