Balloon Tooltip Problem using Win Vista SDK

Hi,

I have win32 Api Windows Application, my application goes on to system tray intially and keeps running. I have handled event On Left click on application in system tray in WndProc. In this we call a custom balloon Function. Below is part of code i have in WinMain which Push application to system tray

NOTIFYICONDATA structNID; //This is defined Globally Above WinMain

structNID.cbSize = sizeof(NOTIFYICONDATA); // sizeof the struct in bytes

structNID.hWnd = (HWND) hWnd; //handle of the window which will process this app. messages

structNID.uID = IDI_ICON1; //ID of the icon that willl appear in the system tray

structNID.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; //ORing of all the flags

strcpy_s(structNID.szTip,"Test App"); //Text of the tooltip

structNID.hIcon = hMainIcon; // handle of the Icon to be displayed, obtained from LoadIcon

structNID.uCallbackMessage = WM_USER_SHELLICON;

//put the actual icon now

Shell_NotifyIcon(NIM_ADD, &structNID);

Below is code for Balloon Function

string msg = "Test";

structNID.cbSize=sizeof(structNID);

structNID.uFlags = NIF_INFO;

structNID.uTimeout = 50;

string appname = "Testing";

strcpy_s(structNID.szInfo, msg.c_str());

strcpy_s(structNID.szInfoTitle, appname.c_str());

Shell_NotifyIcon(NIM_MODIFY, &structNID);

This works well and shows balloon tip if i compile the application using Visual Studio 2005 without installing Windows Vista SDK. In case i install Win Vista SDK and compile it using VS 2005 the balloon stops coming. Can some one help me




Answer this question

Balloon Tooltip Problem using Win Vista SDK

  • narukrish

    Maybe you need to initialize hWnd member and specify the uTimeout value in milliseconds when you display the balloon


  • pmont

    Hello friends,

    Ultimately after lot of hit and trail i found a solution to this issue. Let me tell you 1st that the application shows balloon perfectly well in windows Vista. It was giving problems only in other OS. When i checked sizeof(NOTIFYICONDATA); it was different if WinSDK was installed, it was 508 Bytes while it was 504 bytes in case WinSDK is not installed. This is due to reason a new member of hBallopIcon is added in shellapi.h to this structure. I dont know if this was creating problem, but what i did was replaced shellapi.h that came with winsdk with one which is there with Visual studio 2005 and things started working perfectly fine on most of OS. I still havent tested it on Windows Vista, will soon do it and let you know result on it. Still i am not able to understand it is bug in WinSDK or do i need to pass some hBalloonIcon or more parameter in case i wanna use shellapi.h which came with WinSDK

    Anyone Interested please reply with there thoughts/suggestion/comments..



  • Vital Vasilev

    Hi,

    About Hwnd i have intialized it,

    hWnd is declared globally and in WinMain i m doing

    hWnd = CreateWindow("Test",

    "Test ",

    WS_OVERLAPPEDWINDOW,

    CW_USEDEFAULT,

    CW_USEDEFAULT,

    CW_USEDEFAULT,

    CW_USEDEFAULT,

    NULL,

    NULL,

    hInstance,

    NULL);

    Also in Balloon function as posted above in code, i am setting uTimeout as 50, even setting it to 50000 doesnt work. And if i havent installed winSDK for Vista it works perfectly fine. Why is it so



  • IxxI

    The Perfect solution was to declare a Macro which tells the compiler the lowest version that Application must support and it worked fine.



  • GregJ334344

    A better place for such issues is the win32 API newsgroups at http://msdn.microsoft.com/newsgroups

    OTP

    Thanks,
    Ayman Shoukry
    VC++ Team


  • Balloon Tooltip Problem using Win Vista SDK