How can I retrieve a windows filename?
{
If you are working on a DLL and are interested in the filename of the
DLL rather than the filename of the application, then you can use this function:
}
function GetModuleName: string;
var
szFileName: array[0..MAX_PATH] of Char;
begin
FillChar(szFileName, SizeOf(szFileName), #0);
GetModuleFileName(hInstance, szFileName, MAX_PATH);
Result := szFileName;
end;
Tags: windows delphi dll winapi
Source: By Blorgbeard as answer to the question
This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 3.0
Related code-snippets:
- Is gettimeofday() guaranteed to be of microsecond resolution?
- Embedding Windows Media Player for all browsers. Will help in making it portable.
- Register Windows program with mailto protocol programmatically.
- How do I see preview JPEG file of PDF on Windows?
- What are the best ways to access Exchange using PHP?
- Visual Studio Setup Project - Per User Registry Settings.
- What is the best file copy alternative than the Windows defaults?
- What does wiggling the mouse do?
- How do I install Debian in Windows?
- Windows Equivalent of 'nice'.
- How do you create your own moniker (URL Protocol) on Windows systems?
- Registry vs. INI file for storing user configurable application settings. In Linux, registry vs. INI file for storing user configurable applications settings.
- How can I redirect stderr from calls to fprintf?
- How do I wrap RSYNC for Windows?
- Delphi MDI Application and the titlebar of the MDI Children section.