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

8/22/2022 - Mon
tadoox

ExtractFileName(Application.ExeName)
ASKER
andrezzz

ExtractFileName cut out only directory path... but i need executable file name of dll or executable file name of windows hook...
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".
Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER
andrezzz

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

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

If you don't believe it, just try it.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Bobcsi

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question