How to Set Desktop shortcut icon different and task bar icon different for a QT Windows application? - c++

I need to set title.ico as my application icon and shortcut.ico as my desktop shortcut. Is there any way to do it in a Qt application itself while building?
Whenever the user right-clicks on my application and clicks on sendto->desktop(create shortcut), the shortcut should have shortcut.ico. But now it's always displaying title.ico.
I checked WinApi IShell_link but it didn't help.

I am also a beginner, but turns out this is possible. See this thread: https://forum.qt.io/topic/45324/taskbar-icon-different-from-the-icon-of-the-window/8
Hope I understood you right. Enjoy!
Edit 2018-03-13:
Create your icon in diffrent sizes (e.g. 16px, 32px, ...) as an .ico (while on Windows), for further information visit: http://doc.qt.io/qt-5/appicon.html
Call QWindow::setIcon() (http://doc.qt.io/qt-5/qwindow.html#setIcon)
Profit. The icon should now be visible in the greater resolution in the taskbar, while the smaller one is choosen for the app window.

Related

System Tray Notifications: Are they standard windows or Owner Drawn Popup Menus or other?

Are notification/alert windows (that appear above the Windows System Tray) like the examples below just a standard window, owner drawn HMENU's or are they implemented using NOTIFYICONDATA? Note: I know that the actual system tray icon is implemented using NOTIFYICONDATA, but are the notification windows also implemented using this structure?
In my WinAPI C++ application I want to show a similar notification where it will appear above the system tray icon, have buttons, horizontal scroll bars and etc. I know I can just create a new HWND, position it above the system tray and show that but if there is a specific WinAPI 'System Tray Notification' class/function I would prefer to use that, thus my question.
Are notification/alert windows (that appear above the Windows System Tray) like the examples below just a standard window, owner drawn HMENU's or are they implemented using NOTIFYICONDATA?
These are custom dialogs displayed when needed. They are not implemented using NOTIFYICONDATA. You can use Shell_NotifyIconGetRect() to get the current location of your tray icon when needed.
Tray notifications are all about notifying the process that owns the icon that a click event has occurred so it can then do its thing, whatever that may be.
There is no specialised mechanism or framework for anything GUI related in this case.
Best Practices: When a user right-clicks the icon, it should
bring up a normal shortcut menu. However, the result of a single
click with the left mouse button will vary with the function of the
icon. It should display what the user would expect to see in the form
best suited to that content—a popup window, a dialog box or the program
window itself. For instance, it could show status text for a status icon,
or a slider for the volume control.

MFC Application icon in the taskbar

In a MFC windows application, the right icon is shown in the taskbar if I run the .exe file created through a release/debug build. However it doesn't show and only loads windows default icon if the application gets installed on the machine.
What is the reason behind this latter behaviour?
Maybe your icon resources aren't available in all sizes? I.e. the 16 px is used for the task bar, but there is a default one for the bigger size that is used for the shortcut.

Cannot display new icon for the application

I am trying to change the icon of the application, and I have changed it and the project builds completely fine.
But when the application starts, I still see the default icon on the taskbar. On the otherhand, when I click on About, I can see the new Icon.
What am I missing?
You need to make sure that the resource ID of your icon is the lowest of all the icons in your resources. Windows will display the icon with the lowest ID.

Changing program icon dynamically

In C++, is there anyway to let the user chose the icon of the app? For example, Winamp lets you select which icon you wish to use from a list of icons in it's preferences. How is it done?
There is the icon that you see in explorer. This is a resource in your executable. You could change that, but I wouldn't advise you too. Virus scanners can get nervous if executables are modified, and in Windows Vista you will not even be allowed to write in the Program Files folder.
But the icon that is displayed on the task bar or in the system tray can be changed. This is actually the icon of your application window and it can be set by sending a WM_SETICON message.
And there are shortcuts. They can be changed too, and in a shortcut you can specify which icon should be used.
I found a discussion on changing icons that has information about the first two options.
For Visual Studio 2010 in an MFC dialog based app
A. In the resource view, rightclick Icon folder and add icon. Give it an ID like IDI_MYICON. Leave it as is or draw something nice.
B. Go to OnInitDialog. Add the following two lines of code:
HICON hMyIcon = LoadIcon( AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_MYICON) );
SetIcon( hMyIcon, FALSE ); // FALSE == use as small icon
You can read about these functions in the help to understand what is happening.
This sets the icon as icon for the sysmenu (topleft) and in the taskbar. This is however not automatically reflected in all situations. E.g. for a systray icon you need to explicitly specify the icon again in the call to Shell_NotifyIcon().

How to bring up the on screen keyboard using C++ in Windows 7 tablet devices?

I am developing an application for Windows 7 devices and I'm using an embedded web browser (webkit). Normally touching an edit control on a tablet device causes a little keyboard icon to appear. However, since my edit control is in the browser, it's not a real window with an hwnd and Window's doesn't bring up the icon you can click on to bring up the on screen keyboard.
Is there an API I can use to cause the little keyboard icon to appear as it normally would when focus goes to an edit control?
I tried searching MSDN, no success.
I looked at the Windows keyboard API. No dice.
I tried running OSK.exe. This could bring up multiple instances of the keyboard and it's just sloppy. I want to get the same effect a user would get when tapping a windows edit control so the UI is consistent.
There must be an API that can bring up that on screen keyboard.
Thanks.
David
Not sure if you have this answered already. I have been looking at doing a similar thing although it is a part of a larger application and the keyboard is rarely used (but nevertheless had to be supported). I assigned a shortcut key (right click Win 7 on screen keyboard application and choose Properties. In the shortcut tab, assign any shortcut you'd like). When I touch a SurfaceTextEdit control, I emulate the shortcut key from my C++ code using SendInput(). I know this is a hack, but it worked well for me because I rarely used the onscreen keyboard in my application.