Fair enough. It works with my XS code as well. (Also true that windows.h is pulled in by default.)

Now my main problem with NOTIFYICONDATA itself that it needs a hWnd parameter. In other words if I want to have a notify icon I have to have a main window. Currently I have a standalone application which creates a notify icon:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR + lpCmdLine, int nCmdShow) { INITCOMMONCONTROLSEX icc; WNDCLASSEX wc; LPCTSTR MainWndClass = TEXT("Template"); HWND hWnd; HACCEL hAccelerators; HMENU hSysMenu; MSG msg; // Initialise common controls. icc.dwSize = sizeof(icc); icc.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&icc); // Class for our main window. wc.cbSize = sizeof(wc); wc.style = 0; wc.lpfnWndProc = &MainWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = (HICON) LoadImage(hInstance, MAKEINTRESOURCE +(IDI_APPICON), IMAGE_ICON, 0, 0, LR_SHARED); wc.hCursor = (HCURSOR) LoadImage(NULL, IDC_ARROW, IMAGE +_CURSOR, 0, 0, LR_SHARED); wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU); wc.lpszClassName = MainWndClass; wc.hIconSm = (HICON) LoadImage(hInstance, MAKEINTRESOUR +CE(IDI_APPICON), IMAGE_ICON, 16, 16, LR_SHARED); // Register our window classes, or error. if (! RegisterClassEx(&wc)) { MessageBox(NULL, TEXT("Error registering window class."), TEXT +("Error"), MB_ICONERROR | MB_OK); return 0; } // Create instance of main window. hWnd = CreateWindowEx(0, MainWndClass, MainWndClass, WS_OVERLAPPED +WINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 320, 200, NULL, NULL, +hInstance, NULL); // Error if window creation failed. if (! hWnd) { MessageBox(NULL, TEXT("Error creating main window."), TEXT("Er +ror"), MB_ICONERROR | MB_OK); return 0; } // Create notify icon NOTIFYICONDATA nid; nid.cbSize = sizeof(NOTIFYICONDATA); nid.hWnd = hWnd; nid.uID = 100; nid.uVersion = NOTIFYICON_VERSION; nid.uCallbackMessage = WM_MYMESSAGE; nid.hIcon = LoadIcon(NULL, IDI_APPLICATION); wcscpy(nid.szTip, TEXT("Notify Icon")); nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; Shell_NotifyIcon(NIM_ADD, &nid); // Load accelerators. hAccelerators = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_AC +CELERATOR)); // Add "about" to the system menu. hSysMenu = GetSystemMenu(hWnd, FALSE); InsertMenu(hSysMenu, 5, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); InsertMenu(hSysMenu, 6, MF_BYPOSITION, ID_HELP_ABOUT, TEXT("About" +)); // Show window and force a paint. ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); // Main message loop. while(GetMessage(&msg, NULL, 0, 0) > 0) { if (! TranslateAccelerator(msg.hwnd, hAccelerators, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } // Finished so withdraw notify icon Shell_NotifyIcon(NIM_DELETE, &nid); return (int) msg.wParam; }
However in the XS code I guess I can't have a WinMain function.

In reply to Re^2: Prototype problem for XS module by chessgui
in thread Prototype problem for XS module by chessgui

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.