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. .NET (Core and Framework)
  4. problem with messagebox's in a windows service thread

problem with messagebox's in a windows service thread

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpjsontutorialquestion
3 Posts 2 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.
  • K Offline
    K Offline
    Kalyan_A
    wrote on last edited by
    #1

    hi All, I have an issue for which i need some guidance/help. I've tried to be concise but please excuse me if you do not find it so. I have a windows service which interacts with ms-office (and other) applications using their API. I usually switch-off interactivity support if provided by the library/API so that no messagebox's are thrown during execution. However, occasionally due to an unforeseen situation, we get a msgbox pop-up which blocks the service thread. Given the nature of the application, its difficult to identify if the thread is blocked due to a message box or due to some processing overhead in the 3rd party application. one of the solutions i thought of is as follows - implement a monitoring thread to check if the office app does not return control. if control is not returned within a given interval, kill the app and exit the task(which is not best but feasible most of the times) however this seems more of a brute-force approach and it doesnt tell me what the issue is. In some of the cases the issue may not be reproducible immediately. Is there a more graceful approach? has anyone resolved such an issue earlier on how to identify the above situation? Thanks in advance Kalyan

    R 1 Reply Last reply
    0
    • K Kalyan_A

      hi All, I have an issue for which i need some guidance/help. I've tried to be concise but please excuse me if you do not find it so. I have a windows service which interacts with ms-office (and other) applications using their API. I usually switch-off interactivity support if provided by the library/API so that no messagebox's are thrown during execution. However, occasionally due to an unforeseen situation, we get a msgbox pop-up which blocks the service thread. Given the nature of the application, its difficult to identify if the thread is blocked due to a message box or due to some processing overhead in the 3rd party application. one of the solutions i thought of is as follows - implement a monitoring thread to check if the office app does not return control. if control is not returned within a given interval, kill the app and exit the task(which is not best but feasible most of the times) however this seems more of a brute-force approach and it doesnt tell me what the issue is. In some of the cases the issue may not be reproducible immediately. Is there a more graceful approach? has anyone resolved such an issue earlier on how to identify the above situation? Thanks in advance Kalyan

      R Offline
      R Offline
      Ray Cassick
      wrote on last edited by
      #2

      Yes, don't directly access the office applications themselves at all in services and this will not happen. Any time you make calls to an application you run the risk of a dialog box coming up because those apps are made to interact at the UI layer with people. Sorry, that's just the way it is. Apps are made for PEOPLE to use... not services :)


      LinkedIn[^] | Blog[^] | Twitter[^]

      K 1 Reply Last reply
      0
      • R Ray Cassick

        Yes, don't directly access the office applications themselves at all in services and this will not happen. Any time you make calls to an application you run the risk of a dialog box coming up because those apps are made to interact at the UI layer with people. Sorry, that's just the way it is. Apps are made for PEOPLE to use... not services :)


        LinkedIn[^] | Blog[^] | Twitter[^]

        K Offline
        K Offline
        Kalyan_A
        wrote on last edited by
        #3

        Thanks Ray. Unfortunately, my application will have to live with it for now. Thanks for your reply. :)

        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