none
How to get the name of the current app? RRS feed

  • Question

  • I created a simple phone app (win7) and added a custom DLL to do some common functionality. I wanted to get the current running win mobile app name from the DLL itself.

    How do I get the name? I wasn't able to get it from Environment or Application or AppDomain. Where can i find that or the unique name like "com.test.abc"?

    Any help would be great.

    Saturday, November 27, 2010 1:11 AM

Answers

  • On Sat, 27 Nov 2010 01:11:00 +0000, muthuka wrote:

    I created a simple phone app (win7) and added a custom DLL to do some common functionality. I wanted to get the current running win mobile app name from the DLL itself.

    I'm confused.

    What is "win7"? If you mean your app runs under Windows 7, then you will need to use RAPI
    to get info about what is happening on the device. If you mean "Windows Phone 7", then I'm
    surprised you got a DLL to work.

    What do you mean by "current running win mobile app"? Multiple apps can be running on a
    device at the time.

     I think you have an app you wrote calling into a DLL you wrote, and both are running
    under Windows Mobile. And you want the DLL to provide the name of the app. That seems to
    be the hardest possible approach. I make sure each of my programs knows its own name
    (built in during compilation) and uses GetModuleFileName to get its full path as it
    starts.

    If your DLL needs to know the name of each caller, then I think the caller should pass its
    name to the DLL.


    How do I get the name? I wasn't able to get it from Environment or Application or AppDomain. Where can i find that or the unique name like "com.test.abc"?

    Any help would be great.

    • Marked as answer by Bin-ze Zhao Wednesday, December 1, 2010 9:23 AM
    Saturday, November 27, 2010 9:22 PM

All replies

  • You probably can P/Invoke GetCommandLine() and first argument in command line should have name of the executable.

     


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Saturday, November 27, 2010 3:45 AM
    Moderator
  • On Sat, 27 Nov 2010 01:11:00 +0000, muthuka wrote:

    I created a simple phone app (win7) and added a custom DLL to do some common functionality. I wanted to get the current running win mobile app name from the DLL itself.

    I'm confused.

    What is "win7"? If you mean your app runs under Windows 7, then you will need to use RAPI
    to get info about what is happening on the device. If you mean "Windows Phone 7", then I'm
    surprised you got a DLL to work.

    What do you mean by "current running win mobile app"? Multiple apps can be running on a
    device at the time.

     I think you have an app you wrote calling into a DLL you wrote, and both are running
    under Windows Mobile. And you want the DLL to provide the name of the app. That seems to
    be the hardest possible approach. I make sure each of my programs knows its own name
    (built in during compilation) and uses GetModuleFileName to get its full path as it
    starts.

    If your DLL needs to know the name of each caller, then I think the caller should pass its
    name to the DLL.


    How do I get the name? I wasn't able to get it from Environment or Application or AppDomain. Where can i find that or the unique name like "com.test.abc"?

    Any help would be great.

    • Marked as answer by Bin-ze Zhao Wednesday, December 1, 2010 9:23 AM
    Saturday, November 27, 2010 9:22 PM