Re: How to get application handle name (show in tilte bar) from *.
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Sat, 04 Jun 2005 01:31:25 -0400
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
.
- Follow-Ups:
- References:
- How to get application handle name (show in tilte bar) from *.exe?
- From: Sandy
- RE: How to get application handle name (show in tilte bar) from *.exe?
- From: Arman Sahakyan
- Re: How to get application handle name (show in tilte bar) from *.exe?
- From: Joseph M . Newcomer
- Re: How to get application handle name (show in tilte bar) from *.
- From: Sandy
- How to get application handle name (show in tilte bar) from *.exe?
- Prev by Date: Re: Very large CListView - How update view?
- Next by Date: Re: A question about CCommandLineInfo
- Previous by thread: Re: How to get application handle name (show in tilte bar) from *.
- Next by thread: Re: How to get application handle name (show in tilte bar) from *.
- Index(es):
Relevant Pages
|