Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found the code in the official docs for detecting windows versions wasn't quite right. This should work better:</p> <p>Try this for size (literally):</p> <pre><code>BOOL CheckWindowsVersion(DWORD dwMajor, DWORD dwMinor, DWORD dwBuild) { // Initialize the OSVERSIONINFOEX structure. OSVERSIONINFOEX osvi; ZeroMemory(&amp;osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwMajorVersion = dwMajor; osvi.dwMinorVersion = dwMinor; osvi.dwBuildNumber = dwBuild; // Initialize the condition mask. DWORDLONG dwlConditionMask = 0; VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL); VER_SET_CONDITION(dwlConditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL); // Perform the test. return VerifyVersionInfo(&amp;osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, dwlConditionMask); } </code></pre> <p>Then when you want to set the icon you can test for the correct windows version. For some reason in the official docs they were only checking for 6.1, when it should be 6.0.6 + all the other windows versions...</p> <pre><code>if( CheckWindowsVersion(6, 0, 6)) data.cbSize = sizeof(NOTIFYICONDATA); else if( CheckWindowsVersion(6, 0, 0)) data.cbSize = NOTIFYICONDATA_V3_SIZE; else if( CheckWindowsVersion(5, 0, 0)) data.cbSize = NOTIFYICONDATA_V2_SIZE; else data.cbSize = NOTIFYICONDATA_V1_SIZE; </code></pre> <p>I didn't fully test the VER_BUILDNUMBER part yet, but I presume this must be close.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload