Re: How to get application handle name (show in tilte bar) from *.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Joseph

As you told - - - If the executable is actually running, you can use the
technique I gave of enumerating the processes and finding the caption using
GetWindowText.

1- Sandeep -------- Can u give some more details or links.

2 - For example if u open ms word then In Window Task Manager, in
Applications Tab u see it contain handle name -- Microsoft Word -- and in
Processes Tab -- WinWord.exe -- . Is there any way to read the information
of window task manager Or Who do Window task Manager work when be execute
any .exe and puuting value in Application and Processes tab?

Please advice... ASAP



"Joseph M. Newcomer" wrote:


> If it is non-MFC, you basically have no hope of doing it reliably. Many apps make the
> fundamental mistake of encoding the string as a literal in the source code instead of
> using resources, and if it isn't MFC, you have no idea which resource actually has the
> string anyway.
>
> You can't get a handle to a .exe file; you can only get a handle to a process or a loaded
> HMODULE.
>
> If the executable is actually running, you can use the technique I gave of enumerating the
> processes and finding the caption using GetWindowText.
> joe
>
> On Thu, 2 Jun 2005 23:28:02 -0700, "Sandy" <Sandy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> >Hi Joseph
> >
> >I need for non-mfc application.... it will always be some other
> >application like 3rd party gird tool(like syncfusion) or some text
> >editor(like notepad and other)
> >
> >Bcoz v knw the handle of MS Word is ( Microsoft Word) so i can transfer the
> >live data from my mfc application to word. But if some new application then
> >... v have only information is exe name.
> >
> >i need a code .... which can get the handle of any application. For this v
> >have only the exe name and path in local m/c.
> >
> >Please advice
> >
> >"Joseph M. Newcomer" wrote:
> >
> >> If you need to point to some random .exe file and extract the name, you should probably
> >> try doing a LoadModule on that .exe file, and a ::LoadString(module, AFX_IDS_APP_TITLE).
> >> If it is an MFC app, this should give you the caption string. Otherwise, you will have to
> >> look for the MFC doc/view string. For non-MFC apps, it will likely be some other string,
> >> no idea how to predict how it is stored. So your success rate will vary.
> >> joe
> >>
> >> On Thu, 2 Jun 2005 02:08:02 -0700, "Arman Sahakyan" <armancho_x@xxxxxxxxxx(donotspam)>
> >> wrote:
> >>
> >> >To specify the application name, you need either pass the desired name
> >> >to CWinApp constructor:
> >> >CYourApp::CYourApp() : CWinApp("name")
> >> >{
> >> >}
> >> >or
> >> >if not specified, to the resource string with the ID of AFX_IDS_APP_TITLE.
> >> >If the application name is not found in the resource, it comes from the
> >> >program's .EXE filename.
> >> >
> >> >You can get the app name by the global function AfxGetAppName or by
> >> >the public variable m_pszAppName of type const char*.
> >>
> >> Joseph M. Newcomer [MVP]
> >> email: newcomer@xxxxxxxxxxxx
> >> Web: http://www.flounder.com
> >> MVP Tips: http://www.flounder.com/mvp_tips.htm
> >>
>
> Joseph M. Newcomer [MVP]
> email: newcomer@xxxxxxxxxxxx
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
>
.



Relevant Pages

  • Re: VB6 Restore Minimized Window - External Application
    ... I know the EXE name of the application that I want to call. ... will be called so that they write their current caption to a registry key. ... Knowing the EXE name and knowing that only one copy of the EXE will be ... >>I am finding the handle by enumming windows, ...
    (microsoft.public.vb.winapi)
  • Re: App.ExeName is not what it should be
    ... But it should return the actual exe name when you are running the compiled exe, and the exe name is the name you entered into to the FileName box when using the IDE File / Make menu. ... If you place a Command Button on your Form to write App.ExeName to the Form's caption property and if you use File / Make to compile your project to an executable and save the compiled exe to the desktop using the name "mytestprog.exe" do you see the exe file as an icon on your desktop and is that icon called "mytestprog.exe"? ... and if you then run the exe and then click the button does the Form's caption say something other than "mytestprog"? ...
    (microsoft.public.vb.general.discussion)
  • Re: Determine frame caption color?
    ... As I said, though, here I have the default Vista theme enabled and that caption color sure looks black to me. ... If you build an exe, and have a manifest, and initialize the controls correctly, your exe can also show the XP Style, with the blue frame caption. ...
    (microsoft.public.vb.general.discussion)