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#
  4. program stucks cause it opened modal dialog in other application

program stucks cause it opened modal dialog in other application

Scheduled Pinned Locked Moved C#
debugginghelptutorialquestion
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.
  • 3 Offline
    3 Offline
    3Dizard
    wrote on last edited by
    #1

    Hi, problem is the following: I have a program sending a ButtonClick Message to another app so that this app opens a modal dialog. To achieve this I use PInvoke and the function SendMessage(hWnd, BM_CLICK, 0, 0). This code works, but when the Button is clicked and the modal dialog opens, my program (the one, which sent the message) stopps running, means no code after calling SendMessage is executed (can clearly see this in the debugger). When I manually close the opened dialog in the other app my program runs on. I can't explain myself this behaviour because all other programs run on properly. For example I could write another program, which runs the code, which should be executed after SendMessage. This program would run without any problems. Can anyone explain this to me? Any solutions to let my program work on? Thanks

    S 1 Reply Last reply
    0
    • 3 3Dizard

      Hi, problem is the following: I have a program sending a ButtonClick Message to another app so that this app opens a modal dialog. To achieve this I use PInvoke and the function SendMessage(hWnd, BM_CLICK, 0, 0). This code works, but when the Button is clicked and the modal dialog opens, my program (the one, which sent the message) stopps running, means no code after calling SendMessage is executed (can clearly see this in the debugger). When I manually close the opened dialog in the other app my program runs on. I can't explain myself this behaviour because all other programs run on properly. For example I could write another program, which runs the code, which should be executed after SendMessage. This program would run without any problems. Can anyone explain this to me? Any solutions to let my program work on? Thanks

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message. To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function.


      www.troschuetz.de

      M 1 Reply Last reply
      0
      • S Stefan Troschuetz

        The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message. To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function.


        www.troschuetz.de

        M Offline
        M Offline
        mav northwind
        wrote on last edited by
        #3

        ...or PostMessage or PostThreadMessage :) mav

        S 1 Reply Last reply
        0
        • M mav northwind

          ...or PostMessage or PostThreadMessage :) mav

          S Offline
          S Offline
          Stefan Troschuetz
          wrote on last edited by
          #4

          THX for the completion and congratulations for beating me by seconds on the other thread ;)


          www.troschuetz.de

          M 1 Reply Last reply
          0
          • S Stefan Troschuetz

            THX for the completion and congratulations for beating me by seconds on the other thread ;)


            www.troschuetz.de

            M Offline
            M Offline
            mav northwind
            wrote on last edited by
            #5

            Only because my answer was much shorter :-D

            3 1 Reply Last reply
            0
            • M mav northwind

              Only because my answer was much shorter :-D

              3 Offline
              3 Offline
              3Dizard
              wrote on last edited by
              #6

              Thanks guys. Don't know why I didn't investigate on that.

              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