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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Is Window / Dialog neede for a UI thread

Is Window / Dialog neede for a UI thread

Scheduled Pinned Locked Moved C / C++ / MFC
designquestion
5 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
    vipin_nvk
    wrote on last edited by
    #1

    Hi Can I write a windows service and create a UI thread in it which should be able to identify / receive windows messages and process them? Is a window / dialog needed for a UI thread so that it can handle windows messages? Thanx

    C P 2 Replies Last reply
    0
    • V vipin_nvk

      Hi Can I write a windows service and create a UI thread in it which should be able to identify / receive windows messages and process them? Is a window / dialog needed for a UI thread so that it can handle windows messages? Thanx

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      Well, window messages can only be sent to a window so you will actually need one to receive window messages. But you can run a message queue in a thread that has no windows in it and handle process/thread messages (which aren't directed towards any particular window).

      > The problem with computers is that they do what you tell them to do and not what you want them to do. <

      1 Reply Last reply
      0
      • V vipin_nvk

        Hi Can I write a windows service and create a UI thread in it which should be able to identify / receive windows messages and process them? Is a window / dialog needed for a UI thread so that it can handle windows messages? Thanx

        P Offline
        P Offline
        Peter Weyzen
        wrote on last edited by
        #3

        You can associate a hidden window with a service.

        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)

        V 1 Reply Last reply
        0
        • P Peter Weyzen

          You can associate a hidden window with a service.

          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)

          V Offline
          V Offline
          vipin_nvk
          wrote on last edited by
          #4

          Hi Is it possible to associate a hidden window with a service, moreover it is generally advised not to write interactive services (which have windows) and not use MFC support for windows services. So, how do I proceed? Thanx

          P 1 Reply Last reply
          0
          • V vipin_nvk

            Hi Is it possible to associate a hidden window with a service, moreover it is generally advised not to write interactive services (which have windows) and not use MFC support for windows services. So, how do I proceed? Thanx

            P Offline
            P Offline
            Peter Weyzen
            wrote on last edited by
            #5

            true... interactive services are become less viable in the newer versions of windows. So, to have some sort of UI that controls your service, you'll could write a 2nd program which interacts with the service and serves as it's UI. You can use FindWindow to get the window to post messages to. There are other ways to communicate with a service that doesn't involve a window -- named pipes, tcp, mailslots, stuff like that.

            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)

            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