Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MessageBox from a service ...

MessageBox from a service ...

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vimal Earnest
    wrote on last edited by
    #1

    Hi all, How to show a message box from a windows service ? Any tips, pointers, links ? Thanks in advance ~ Vimal

    G P 2 Replies Last reply
    0
    • V Vimal Earnest

      Hi all, How to show a message box from a windows service ? Any tips, pointers, links ? Thanks in advance ~ Vimal

      G Offline
      G Offline
      geo_m
      wrote on last edited by
      #2

      add MB_SERVICE_NOTIFICATION flag in the MessageBox function

      V 1 Reply Last reply
      0
      • G geo_m

        add MB_SERVICE_NOTIFICATION flag in the MessageBox function

        V Offline
        V Offline
        Vimal Earnest
        wrote on last edited by
        #3

        Thanks. :) Though the MB_SERVICE_NOTIFICATION flag is specified in the MSDN, the complier gives an "undeclared identifier" error on my windows 2000 machine :~ . But MB_DEFAULT_DESKTOP_ONLY does the trick. ~ Vimal

        G 1 Reply Last reply
        0
        • V Vimal Earnest

          Thanks. :) Though the MB_SERVICE_NOTIFICATION flag is specified in the MSDN, the complier gives an "undeclared identifier" error on my windows 2000 machine :~ . But MB_DEFAULT_DESKTOP_ONLY does the trick. ~ Vimal

          G Offline
          G Offline
          geo_m
          wrote on last edited by
          #4

          Well, I think, that MB_SERVICE_NOTIFICATION have a little bit better behavior ;). Reason for "undeclared identifier" - you probably didn't set the windows version macros. Just simply put following snippet before you will include <windows.h> header (usually included in stdafx.h) // Allow use of features specific to Windows 95 and Windows NT 4 or later. #ifndef WINVER #define WINVER 0x0400 #endif // Allow use of features specific to Windows NT 4 or later. #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0400 #endif // Allow use of features specific to Windows 98 or later. #ifndef _WIN32_WINDOWS #define _WIN32_WINDOWS 0x0410 #endif // Allow use of features specific to IE 4.0 or later. #ifndef _WIN32_IE #define _WIN32_IE 0x0400 #endif

          V 1 Reply Last reply
          0
          • G geo_m

            Well, I think, that MB_SERVICE_NOTIFICATION have a little bit better behavior ;). Reason for "undeclared identifier" - you probably didn't set the windows version macros. Just simply put following snippet before you will include <windows.h> header (usually included in stdafx.h) // Allow use of features specific to Windows 95 and Windows NT 4 or later. #ifndef WINVER #define WINVER 0x0400 #endif // Allow use of features specific to Windows NT 4 or later. #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0400 #endif // Allow use of features specific to Windows 98 or later. #ifndef _WIN32_WINDOWS #define _WIN32_WINDOWS 0x0410 #endif // Allow use of features specific to IE 4.0 or later. #ifndef _WIN32_IE #define _WIN32_IE 0x0400 #endif

            V Offline
            V Offline
            Vimal Earnest
            wrote on last edited by
            #5

            Thanks again. True I didn't set the version macros.I compiled the code after including the _WIN32_WINNT macro and MB_SERVICE_NOTIFICATION works fine. :-D ~ Vimal

            1 Reply Last reply
            0
            • V Vimal Earnest

              Hi all, How to show a message box from a windows service ? Any tips, pointers, links ? Thanks in advance ~ Vimal

              P Offline
              P Offline
              praveenpnayak
              wrote on last edited by
              #6

              You should use SERVICE_INTERACTIVE_PROCESS in dwServiceType while creating the service (In CreateService()). (You can use also do this manually by going to services window and changing to property of the service and checking "Allow service to interact with desktop" under Log On As group. Praveen

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups