Qt/c++: How to set platform independent application icon? - c++

I am developing my Qt (c++) application on MacBook. However, the application might run in both Windows and Mac Systems.
Is there is a way to set platform independent application icon ?!

Setting application icons is already independent, Windows and OS X require different icon formats: http://doc.qt.io/qt-5/appicon.html

the application might run in both Windows and Mac Systems
Right, but not the same executable (binary), you'll compile two versions, one for Windows and one for Mac. Executable icon could be displayed by the OS (when aplication icon is shown on desktop, task bar...) before the application is actually started. So this icon cannot be set programmatically, it must be set at compilation time. And, you must refer to this post to know how to set the application icon for binaries on each different platform.

Related

Windows 10 Creators Update (1703) crashes our application

Our users are experiencing crashes when Windows 10 Creators Update (1703) is automatically installed through Windows Updates. The Windows application of ours is a multilevel, C++ WinForms application. The application can start, but if we click on certain menus, it crashes. Appears to be a graphics issue or something to do with fonts, perhaps. Why?
When the Windows 10 1703 update was applied, the installer replaced the Windows/Fonts directory and did not include shortcuts to fonts included elsewhere in Windows.
In our case, our application was needing Lucida Sans Typewriter font, which had been registered with Windows, but located in a bundled JRE for IBM Client Access off Program Files (Our application uses some IBM Client Access components).
Shortcuts of the Lucida fonts were in the Windows/Fonts directory before the update, but absent after the update (which caused our application to crash).
The Fix: We had to copy/paste all the Lucida fonts (there are 8 of them) required from the embedded JRE/lib/fonts directory into the Windows/Fonts directory to resolve the issue. We found if we did this before the 1703 update or after, our application continued to work.
The Lesson: We are going to ensure our applications use fonts that we control 100%, by copying them into Windows/Fonts during install.

How to avoid DPI awareness in a QtApplication for Windows

I have a QtWebKit application and I want to avoid DPI awareness. I tried adding a manifest as documented in MSDN but it only worked in Windows 8.1 (not in Windows 8 and lower versions.)
Inspecting the Qt source code (4.7) I found inside the file qapplication_win.cpp the following snippet:
// Notify Vista and Windows 7 that we support highter DPI settings
ptrSetProcessDPIAware = (PtrSetProcessDPIAware)
QLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware");
if (ptrSetProcessDPIAware)
ptrSetProcessDPIAware();
For more information take a look at the Commit
That said, I don't really know why it's working in Windows 8.1 and more importantly how can I disable this Qt feature... any Macro/Qt API I should use?

MFC program in Windows 7 not changing icon in taskbar

I am creating an app for a client. It is written in 32 bit MFC using Visual Studio 2010 and run on 64 bit Windows 7 (compatibility with other versions of windows not required, it's for a very closed system on limited machines) The program will be started automatically in minimized mode when the machine boots.
The program collects data from a bunch of serial ports, and if restored, shows specifics and allows the user to change or fix things, but when minimized should just show a single "red LED" icon to show something is amiss, or a "green LED" icon to show everything is OK, no user intervention is required.
On my development machine (also Win 7-64), running the program from within Visual Studio or directly from Windows Explorer, when I change the icon using CWnd::SetIcon it changes in the window and in the taskbar, just as I want it to. If I make a shortcut to the program and start it with the shortcut, the default icon is displayed in the taskbar and will not change. Fine, it's taking the icon from the shortcut, that is explained.
The odd part is that on the target machine, no matter how I start it, including clicking on in using Windows Explorer in it's folder (like I did on my development machine), or using the Windows Registry "Run", it always uses the default icon, and never changes in the taskbar. I expected that when I used a shortcut on the desktop or in the Startup folder, since that was the behavior on my development machine.
So why would it work on one machine, when run directly from the exe, and not on another of the same windows version?
More to the point, how can I make it work on the target system? I also need to make sure that solution will work when autostarted on power-up/login.

Stopping the explorer.exe taskbar from opening when using the windows file explorer on XP

I am creating a shell-replacement for developers, which creates a new windows user, titled "developer" and only when you log into this user, should the shell be launched.
The replacement start menu is replaced with a shell based terminal with great features, the taskbar is replaces with a tree based view for windows, and the process monitor is replaced with a view where you can attach process monitors, debuggers, profiles, and memory leak detectors, etc.
I would like my application replace the regular windows shell. I have however came across a registry key that, on windows 7, works just fine. but on windows XP if I use the regular windows XP file manager the windows XP task bar from explorer.exe launches, even though I changed said registry entry!
Does anybody have any idea what it is I need to do to fully replace the windows shell AND taskbar using windows XP while still retaining use of the windows based file manager?: )
Edit:
Using C++, developing using NetBeans using Qt for my gui library. however, as I do not think this should effect the answer, I figured I would include it either way.
I believe Windows XP does not support per-user shell replacement (not sure, it's been a while since I played with the desktop stuff), but you should be able to set the 'Shell' entry under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon and prevent Explorer from registering itself as the shell when it first runs. This will affect all the users in the machine, of course.

How to hide console window in Mac OS (gcc compiler)?

I write an application with Code::Blocks IDE in Mac OS (C++ application).
CodeBlocks uses gcc to compile the source code.
When I double click on the output of the project (executable binary file), my application executes correctly but a console application shown. My application is a background application without any reading or writing to console, and I add it to startup items. I don't want when I logon, a balnk console (of my application) shown. I want to hide the console window.
How to hide console window in Mac OS with gcc compiler?
It sounds like what you are developing is a daemon (background process that is launched when a user account is logged on, or system is launched). OS X uses launchd and launchctl to manage daemons, so you'll need to set up the proper plist entry in either the /System/Library/LaunchAgents (to launch during system boot) or ~/Library/LaunchAgents (to launch when a user logs in) directory, and register it with launchctl.