Avatar of andrezzz
andrezzz

asked on 

geting application executable name

I have hooks on windows (HCBT_ACTIVATE, HCBT_CREATEWND , HCBT_DESTROYWND)
To get aplication name I trie  GetWindowModuleFileName(Wnd, filename, 255);
But in many cases the result is dll file.
How I can get in all cases executable file name ?
for example if there are runngin Microsoft Explorer, then i must get iexplore.exe in all cases,but not some BROWSEUI.dll
Delphi

Avatar of undefined
Last Comment
Bobcsi
Avatar of tadoox
tadoox

ExtractFileName(Application.ExeName)
Avatar of andrezzz
andrezzz

ASKER

ExtractFileName cut out only directory path... but i need executable file name of dll or executable file name of windows hook...
Avatar of Madshi
Madshi

var arrCh : array [0..MAX_PATH] of char;
begin
  GetModuleFileName(0, arrCh, MAX_PATH);

This will give you the path+name of the current application. If you want to have the path of the current dll, use "HInstance" instead of "0".
Avatar of andrezzz
andrezzz

ASKER

I DON'T WANT TO GET DLL NAME, I WANT EXECUTABLE FILENAME...
Avatar of Madshi
Madshi

Just read my comment again before shouting. I gave you the solution.
Avatar of Madshi
Madshi

If you don't believe it, just try it.
ASKER CERTIFIED SOLUTION
Avatar of Bobcsi
Bobcsi

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Delphi
Delphi

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.

60K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo