logo
down
shadow

How to show the Systray Icon and also the corresponding executable in the taskmanager by default when we run the install


How to show the Systray Icon and also the corresponding executable in the taskmanager by default when we run the install

By : nitinpakhide
Date : October 22 2020, 08:10 PM
this will help My requirement is: When i installed a software using NSIS, once the installation is successfully completed it should show a notification icon (systray icon). , Use ExecShell, Exec or ExecWait to start a new process:
code :
Section
SetOutPath $INSTDIR
File "something\Display.exe"
ExecShell "" "$INSTDIR\Display.exe"
SectionEnd
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\Display.exe"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"

Section
SetOutPath $INSTDIR
File "something\Display.exe"
SectionEnd


Share : facebook icon twitter icon
Default state of the systray icon

Default state of the systray icon


By : user2834278
Date : March 29 2020, 07:55 AM
may help you . This is not supported. You can see Raymond thoughts on this.
How to make Systray icon by default more visible in Win7/8

How to make Systray icon by default more visible in Win7/8


By : user5614266
Date : March 29 2020, 07:55 AM
this one helps. You don't get to choose whether or not your notification icon is hidden. That's up to the user. This is by design. On the other hand MS do get to force some of their notification icons to be visible initially.
Raymond Chen discusses this here: There is no interface for preventing your notification icon from being hidden
Icon exists in systray?

Icon exists in systray?


By : Yan Zhu
Date : March 29 2020, 07:55 AM
wish helps you You should read this code-project article.
How to get the processes that have systray icon

How to get the processes that have systray icon


By : Príñcæ Salman Khan
Date : March 29 2020, 07:55 AM
seems to work fine I checked the application on 32bit and I saw that the dwData != 0. This helped me to understand that the problem is when working on 64bit.
I replaced public UInt32 dwData; with public UInt64 dwData;.
code :
    [ StructLayout( LayoutKind.Sequential ) ]
    internal struct TBBUTTON 
    {
        public Int32 iBitmap;
        public Int32 idCommand;
        public byte fsState;
        public byte fsStyle;
//      [ MarshalAs( UnmanagedType.ByValArray, SizeConst=2 ) ]
//      public byte[] bReserved;
        public byte bReserved1;
        public byte bReserved2;
       // public UInt32 dwData;
        public UInt64 dwData;
        public IntPtr iString;
    };  
  // window handle
  fixed (byte* pLocalBuffer = localBuffer)
  {
   ...
   ipWindowHandle = new IntPtr(iWindowHandle);

   threadId = User32.GetWindowThreadProcessId(ipWindowHandle, out processId);
   data.setProcessPid(processId);
  }
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);

BOOL IsWow64()
{
    static bool isset = false;
    static BOOL bIsWow64 = FALSE;

    if (isset) {
        return bIsWow64;
    }

    //IsWow64Process is not available on all supported versions of Windows.
    //Use GetModuleHandle to get a handle to the DLL that contains the function
    //and GetProcAddress to get a pointer to the function if available.

    LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
        GetModuleHandle(TEXT("kernel32")),"IsWow64Process");

    if(NULL != fnIsWow64Process)
    {
        if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
        {
            //TODO handle error?
            return FALSE;
        }
    }

    isset = true;
    return bIsWow64;
}

typedef struct _TBBUTTON64 {
    int iBitmap;
    int idCommand;
    BYTE fsState;
    BYTE fsStyle;
    BYTE bReserved[6];
    DWORD64 dwData;
    DWORD64 iString;
} TBBUTTON64, NEAR* PTBBUTTON64, *LPTBBUTTON64;
typedef const TBBUTTON64 *LPCTBBUTTON64;

bool EnumSystemTray() { 
    bool bFound = false;

    // find system tray window
    HWND trayWnd = FindWindow(_T("Shell_TrayWnd"), NULL);
    if (trayWnd) {
        trayWnd = FindWindowEx(trayWnd, NULL,_T("TrayNotifyWnd"), NULL);
        if (trayWnd) {
            trayWnd = FindWindowEx(trayWnd, NULL,_T("SysPager"), NULL);
            if (trayWnd) {              
                trayWnd = FindWindowEx(trayWnd, NULL,_T("ToolbarWindow32"), NULL);
                bFound = true;
            }
        }
    }

    ASSERT(bFound);

    DWORD dwTrayPid;
    GetWindowThreadProcessId(trayWnd, &dwTrayPid);

    int count = (int) SendMessage(trayWnd, TB_BUTTONCOUNT, 0, 0);

    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwTrayPid);
    if (!hProcess) {
        return true;
    }

    BOOL bIsWow64 = IsWow64();

    SIZE_T dwSize = bIsWow64 ? sizeof(TBBUTTON64) : sizeof(TBBUTTON);
    LPVOID lpData = VirtualAllocEx(hProcess, NULL, dwSize, MEM_COMMIT, PAGE_READWRITE);
    if (!lpData) {
        return true;
    }

    // Loop through all systray icons
    for (int i = 0; i < count; i++) {
        HWND hwnd32;

        SendMessage(trayWnd, TB_GETBUTTON, i, (LPARAM)lpData);
        if ( bIsWow64 ) {
            // Try to read memory from 64-bit Explorer process. Hope the address of the traybar data is below 4GB

            TBBUTTON64 tbb;
            if (!ReadProcessMemory(hProcess, lpData, (LPVOID)&tbb, sizeof(TBBUTTON64), NULL)) {
                continue;
            }

            DWORD64 hwnd;

            // First member of TRAYDATA structure is HWND, so we can just use the address of the struct to read the member
            if (!ReadProcessMemory(hProcess, (LPCVOID)tbb.dwData, (LPVOID)&hwnd, sizeof(DWORD64), NULL)) {
                continue;
            }

            // Hope this does not get truncated, but we shouldn't have that many windows
            hwnd32 = (HWND)hwnd;
        } else {
            TBBUTTON tbb;
            if (!ReadProcessMemory(hProcess, lpData, (LPVOID)&tbb, sizeof(TBBUTTON), NULL)) {
                continue;
            }

            DWORD32 hwnd;

            // First member of TRAYDATA structure is HWND, so we can just use the address of the struct to read the member
            if (!ReadProcessMemory(hProcess, (LPCVOID)tbb.dwData, (LPVOID)&hwnd, sizeof(DWORD32), NULL)) {
                continue;
            }

            hwnd32 = (HWND)hwnd;
        }

        DWORD dwProcessId = 0;
        GetWindowThreadProcessId(hwnd32, &dwProcessId);

        // XXX - DO SOMETHING WITH dwProcessId
    }

    VirtualFreeEx(hProcess, lpData, NULL, MEM_RELEASE);

    return true;
}
Pystray systray icon

Pystray systray icon


By : Peter Bowles
Date : March 29 2020, 07:55 AM
To fix this issue I want to use pystray module in python to create a system tray app on Windows. Until now I managed to write this:
code :
from pystray import MenuItem as item
import pystray
from PIL import Image

def action():
    pass

image = Image.open("image.jpg")
menu = (item('name', action), item('name', action))
icon = pystray.Icon("name", image, "title", menu)
icon.run()
item('Call something', lambda :  method())
Related Posts Related Posts :
  • root undoing previous changes after sudo su user
  • Create X509 Certificate from.p12 or .pem certificate
  • Keras layer.set_weights doesn't modify the layer. Why?
  • Available build tasks in TFS 2017
  • Change oracle apex database user
  • How to parse typesafe config with objects
  • Is "Comment" a protected word in the Open API 3.0 spec or Swagger Editor?
  • Display Percentage in a Row in Tableau
  • Bokeh Colorbar Vertical title to right of colorbar?
  • Why the multi-ports model can't import into C++?
  • Nativescript tab page textfield
  • Why does this greedy algorithm work?
  • Nested list mapping using MapStruct
  • How to I find the original row index of a table in a google visualization if I have a filtered rows view
  • Ribbon icon doesn't show up in Word Online
  • Fitting user defined function with MPFIT in IDL
  • yii2 user CRUD create or update with password
  • Does Perl 6 performance suffer by using rationals for decimal numbers
  • How to get Y value at a given X value of a trendline
  • ElastAlert flatline not finding results
  • CSS not extracted for common chunk with extract-text-webpack-plugin
  • Adding element to nested vector
  • How can I trigger an action after updating a Podio Category on zapier?
  • Ninject.MVC5 Release Scope Never Called - OutOfMemoryException
  • Grok custom time format
  • How can I avoid Same Origin Policy exception when using AWS API Gateway and CloudFront
  • How to test ActionCable with Capybara and poltergeist inside Docker?
  • opendaylight: how to include a library jar file?
  • OpenThread using Nest Learning Thermostat
  • In Coq, how to remove a defined variable from the namespace?
  • Adobe DTM Mobile Tracking Rules
  • Accessing Vuex submodules inner state with the $store object
  • Include one widget instead of excluding all others
  • Create folder temp in mac using lotuscript
  • RSU placement in veins/SUMO
  • Exclamation Unary operator stopped working on bindings
  • RxJs how to merge two overlapping observable into one
  • How to add Nuget Package Source at runtime?
  • Absolute positioning a FlatList item react-native
  • Python, using variables in pymodbus.utilities.computeCRC
  • Akamai CDN - Whitelist service by Request header or User agent
  • UIWebView/WKWebView crash on iOS11 (ran out of executable memory)
  • Is ZonePlayerId capability still working?
  • Testing polynomial definition (from natural numbers to integers)
  • Wakanda 2.x cannot set certain tables' scope to publicOnServer
  • Call task from another Verilog module
  • Perl 6 transforms combined graphemes?
  • How to get automake to set libdir to /usr/lib64 on dual-arch Linux platforms
  • Restore RSA private key by modulus, public and private exponents using Java Security
  • Visual Studio 2017 Reset Settings
  • SonarQube 6.5 - Not able to trigger TFS Build Definition
  • Composing tweet in Twitterkit since Xcode 9 with Swift 4 & IOS 11
  • Custom Bing Map Type Issue
  • How to update MvvmCross?
  • pageFunction in Puppeteer returns empty object
  • PyCharm Run --- why does it sometimes display a traceback and error and sometimes not?
  • Yii2, optional parameter in the rounte
  • Hive and Pig on top of same dataset
  • SCM_REPOSITORY_PATH being ignored on Azure web app
  • Pentaho Flow Input->Output->Input not working
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org