[Not Solved] Application name in Task bar of Windows?



  • Hi,
    The executable for my application is MyApp.exe & I am talking about running it on Windows7 only.
    When I launch it, right click its icon on task bar, it is showing "MyApp.exe".
    I would like it to show "MyApp" only. How to do that?

    I created a shortcut for the executable of my application.
    Now I launch my application - either from exe or from shortcut.
    Right click the icon on task bar.
    Now this is showing the text which is the filename of the shortcut i.e. "MyApp.exe - Shortcut".
    Now if I rename the shortcut file to "Crap" & again launch the application by either shortcut or target, it is showing "Crap" in task manager.
    Why is this happening?
    Why cannot it show a fixed title in task bar?

    PS: The Window title is always set to "MyApp".



  • in the MyApp.pro there is an option:
    @TARGET = <here the name of the project>@

    try changing it to MyApp, or you could do this at RunTime:

    @QCoreApplication a(argc, argv);
    a.setApplicationName("MyApp");
    qDebug() << a.applicationName()@

    or in the "version info" of your App, on win32 Apps you could add it into a file.rc:
    @
    VS_VERSION_INFO VERSIONINFO
    FILEVERSION 1,0,0,1
    PRODUCTVERSION 1,0,0,1
    FILEFLAGSMASK 0x3fL
    #ifdef _DEBUG
    FILEFLAGS 0x1L
    #else
    FILEFLAGS 0x0L
    #endif
    FILEOS 0x40004L
    FILETYPE 0x2L
    FILESUBTYPE 0x0L
    BEGIN
    BLOCK "StringFileInfo"
    BEGIN
    BLOCK "000004b0"
    BEGIN
    VALUE "Comments", "\0"
    VALUE "CompanyName", "\0"
    VALUE "FileDescription", "MyApp Description\0"
    VALUE "FileVersion", "1, 0, 0, 1\0"
    VALUE "InternalName", "Test\0"
    VALUE "LegalCopyright", "Copyright © 2013\0"
    VALUE "LegalTrademarks", "\0"
    VALUE "OriginalFilename", "OriginalFilename\0"
    VALUE "PrivateBuild", "\0"
    VALUE "ProductName", "MyApp\0"
    VALUE "ProductVersion", "1, 0, 0, 1\0"
    VALUE "SpecialBuild", "\0"
    END
    END
    BLOCK "VarFileInfo"
    BEGIN
    VALUE "Translation", 0x0, 1200
    END
    END
    @

    and adding it to the pro file like this:

    @win32:RC_FILE = MyApplication.rc@



  • Hi xklz,
    Thanks for your reply, but both solutions do not work.
    Is there anything else that I can do?



  • sorry I edited the post, check if with the rc fil it works


  • Moderators

    You said that you right click on the icon in task manager? There's no name of the app under right click in task manager. It shows a context menu.

    Did you maybe mean a shortcut pinned to the task bar? The one with the "start" menu?
    If so then it has nothing to do with Qt. It's just how Windows shortcuts work. If you pin a shortcut it will show the name of the shortcut. If you want it to show the app name pin the app itself.



  • @Chris I am extremely sorry for my typo.
    I meant Task Bar only.
    It may be pinned or may not be pinned.
    For both situations it is behaving wrongly.

    @xklz Thanks a lot!
    I will try it & get back to you.
    Hope that it solves many of my questions :)



  • Hi xklz,

    Sorry to say but your code simply has no effect on my application.
    Not a single thing has changed.
    Probably this has got anything to do with the compiler?
    I am using the MinGW compiler that comes with Qt 4.8.1 SDK.



  • You should try to state your problems in a clear and understandable manner. As it seems, I am not the only one who doesn't understand what your problem even is.
    There are a couple of things in the taskbar:

    a) The Start-button. Nothing to do with your application.
    b) Quick launch area right next to the start button. The shortcuts there are never named after a program, since one point of a shortcut is to use custom names. So, again, this has nothing to do with your application.
    c) Free space between quick launch and tray icons. Not related to your application.
    d) The tray icons. One of these might belong to your application, a tooltips text is set by using QSystemTrayIcon::setToolTip(QString). A right click might reveal a context menu, but that is completely under your control.
    e) The clock and that other thing right next to it. Not related to your application.
    f) The symbol that represents a running application. Right click on it does not show its name but rather offers a context menu. The name of the symbol can be set via QWidget::setWindowTitle(QString).
    g) If I missed a case, you need to specify your problem in a much better way. If I didn't, that applies too - guesswork shouldn't be necessary.

    Hence, you are probably talking about what Chris Kawa mentioned ( b), for reference): You are looking at a shortcut that was named by you, explicitly. It's name is not chosen by Windows or the programmer of the application it points to, but by the end-user alone.



  • Yes I meant the Quick launch area!
    Sorry for not being technical enough.
    What I meant was that if my application is not pinned to the task bar, and I launch the application by double clicking the exe, then it is showing "myApp.exe" when I right click the icon for my application in the quick launch area.
    I wanted it to show "My App" instead.
    If I similarly run VLC Media Player, it is correctly showing "VLC Media Player". So I thought there must be an option to specify the string to be displayed.
    But as you say it is controlled by Windows & Qt cannot do anything, it is fine with me.



  • Isn't VLC created with Qt?

    I am still not exactly sure what you mean, but I am fairly certain that the solution to your problem lies in this thread. You just have to pick the correct one.

    I have a self-created Qt-application in my systray (it shows the name I set in the code), in my quicklaunch area (it shows the name I picked for the shortcut) and when the window is open, it shows the correct name. So I think I should be able to witness your problem if it was indeed a problem of Qt.
    Did you try "this":http://qt-project.org/doc/qt-5.1/qtgui/qguiapplication.html#applicationDisplayName-prop or "this":http://qt-project.org/doc/qt-5.1/qtcore/qcoreapplication.html#applicationName-prop ?


  • Moderators

    Ah, I'm a little slow on the uptake but I finally got what you mean.
    And better yet - I've got an answer for you :)

    Ok, so it's a little complicated (as always with windows), so I'll walk you through it.
    First of all you have to include a resource file (.rc) as posted by xklz. The field you're interested in is "FileDescription". You can verify that it is included ok by going to the resulting exe properties and checking the description field.

    Now if you run your exe you will notice that it doesn't work (some advice I gave you, huh?).
    But! Copy it somewhere else (anywhere really) and try again. Ahha. Now it's working.

    So what the heck is going on?
    Well, Windows has this (un)friendly feature called MUI Cache, that spies on what apps you run and caches some info about them like the friendly name and company (probably to speed things up by not reading it from exe directly every time it needs it). It is then stored in the registry here:
    HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\Shell\MuiCache

    Find your app on the list and remove any info you find (actually for the name just the X:\your\app\path\app.exe.FriendlyAppName is enough).
    Run your app now from the old location and it should do what you want. Note though, that you need to repeat that every time you change the name in your app.



  • Hi Chris,
    Sorry I could not reply you earlier.

    I tried every step you mentioned above with great care. But I could not achieve Windows to identify the "file description" tag.
    It just kept it blank.
    I dont understand what could be the problem.
    Maybe Qt 4.8.1 or MinGW or my laptop itself or I am doing something wrong.
    I think I will just let it be...
    I appreciate your concern & thanks for your help....



  • In my .pro file, I resolved this like so:

    TARGET = "Cool Application"
    

    Try that. Set it to whatever you want, but use doublequotes.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.