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



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: SoapHttpClientProtocol request canceled
    ... the VB app on Citrix works fine with .NET components when only ... .NET1.1 is installed and the app uses .NET1.1. ... > The VB.NET exe and the VB6 exe both use VB.NET dll to sent request/response ... >> inputHeaderer, String messageControlPayload, string inputMessage) ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: How to get application handle name (show in tilte bar) from *.
    ... I need for non-mfc application.... ... have only the exe name and path in local m/c. ... > If it is an MFC app, this should give you the caption string. ...
    (microsoft.public.vc.mfc)
  • Re: Software Protection and Anti Crack code
    ... There are a couple of easy methods to make cracking the app a lot more ... compressed exe. ... horror of all time is to try and track dynamic string from the OLE ...
    (comp.lang.asm.x86)
  • Re: Mobile Service & Auto Start
    ... SYSTEMTIME is declared wrong. ... have never needed to write an app like this and I just figured ... just very dumb about the CeRunAppAtTime call and why it may not ... So I have an exe that I start 5 min after I push a button. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Mobile Service & Auto Start
    ... registry Init key is not going to work reliably. ... have never needed to write an app like this and I just figured ... I just played with what exe inits ... just very dumb about the CeRunAppAtTime call and why it may not ...
    (microsoft.public.dotnet.framework.compactframework)