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. The Lounge
  3. Is there any program out there that can close messageboxes pressing enter automatically? (in windows XP)

Is there any program out there that can close messageboxes pressing enter automatically? (in windows XP)

Scheduled Pinned Locked Moved The Lounge
questioncsharpc++visual-studiocom
25 Posts 9 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.
  • J Offline
    J Offline
    Joan M
    wrote on last edited by
    #1

    SOLVED ALREADY, I've done a small program in C++ that handles that for me. The problem was not doing the program itself (which is super easy to do) the problem was getting an executable file that would work in Windows XP. After a good tip from @Daniel_Pfeffer, I've learned how to configure newer versions of Visual Studio to link for Windows XP. THANK YOU ALL! :thumbsup: I've seen "Clickoff" and "windows closer by Murgee", but the first one seems not to be capable to click on the message box and press enter afterwards, and the second one can't simply run on windows XP. I've done a super simple small C++ program that would do that search for window handle, send return there. and that should be it. The problem is that what is output from my Visual Studio is not compatible anymore with windows xp... (that's why I'm searching for a free application that could do that). Each 2 or 3 years I get a request that implies opening 3 virtual machines and open a set of files... each time I try to open those files it takes between 30 minutes to several hours. And always appears some messageboxes that need to be confirmed for the process to continue. This leaves me in front of the computer waiting for them... Thank you all! :beer:

    www.robotecnik.com[^] - robots, CNC and PLC programming

    https://www.robotecnik.com freelance robots, PLC and CNC programmer.

    L J P D M 8 Replies Last reply
    0
    • J Joan M

      SOLVED ALREADY, I've done a small program in C++ that handles that for me. The problem was not doing the program itself (which is super easy to do) the problem was getting an executable file that would work in Windows XP. After a good tip from @Daniel_Pfeffer, I've learned how to configure newer versions of Visual Studio to link for Windows XP. THANK YOU ALL! :thumbsup: I've seen "Clickoff" and "windows closer by Murgee", but the first one seems not to be capable to click on the message box and press enter afterwards, and the second one can't simply run on windows XP. I've done a super simple small C++ program that would do that search for window handle, send return there. and that should be it. The problem is that what is output from my Visual Studio is not compatible anymore with windows xp... (that's why I'm searching for a free application that could do that). Each 2 or 3 years I get a request that implies opening 3 virtual machines and open a set of files... each time I try to open those files it takes between 30 minutes to several hours. And always appears some messageboxes that need to be confirmed for the process to continue. This leaves me in front of the computer waiting for them... Thank you all! :beer:

      www.robotecnik.com[^] - robots, CNC and PLC programming

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Quote:

      search for window handle

      Handle of the MessageBox or handle of the OK Button?

      It does not solve my Problem, but it answers my question

      J 1 Reply Last reply
      0
      • L Lost User

        Quote:

        search for window handle

        Handle of the MessageBox or handle of the OK Button?

        It does not solve my Problem, but it answers my question

        J Offline
        J Offline
        Joan M
        wrote on last edited by
        #3

        It should be the same as the button is the default button on that messagebox... Do you know any application that would do this? Thank you.

        www.robotecnik.com[^] - robots, CNC and PLC programming

        https://www.robotecnik.com freelance robots, PLC and CNC programmer.

        L 1 Reply Last reply
        0
        • J Joan M

          It should be the same as the button is the default button on that messagebox... Do you know any application that would do this? Thank you.

          www.robotecnik.com[^] - robots, CNC and PLC programming

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          No, I don't know such an application. As far as I understand you tried to do it by yourslef. I also just tried it and for me it works fine (ok, I did it with c++ builder). The main difference to your approach seems to be you send a VK_RETURN while I'm doing SendMessage(xWnd, WM_CLOSE, 0, 0); I hope it helps :)

          It does not solve my Problem, but it answers my question

          J 1 Reply Last reply
          0
          • L Lost User

            No, I don't know such an application. As far as I understand you tried to do it by yourslef. I also just tried it and for me it works fine (ok, I did it with c++ builder). The main difference to your approach seems to be you send a VK_RETURN while I'm doing SendMessage(xWnd, WM_CLOSE, 0, 0); I hope it helps :)

            It does not solve my Problem, but it answers my question

            J Offline
            J Offline
            Joan M
            wrote on last edited by
            #5

            The application itself is super easy to do... I don't want to close the messagebox, I want to accept it, that's why the VK_RETURN. It works in my computer without much hassle... The problem is that my version of visual studio doesn't have the right builder options for Windows XP. That's why I'm searching for an app like that... :(

            www.robotecnik.com[^] - robots, CNC and PLC programming

            https://www.robotecnik.com freelance robots, PLC and CNC programmer.

            L 2 Replies Last reply
            0
            • J Joan M

              The application itself is super easy to do... I don't want to close the messagebox, I want to accept it, that's why the VK_RETURN. It works in my computer without much hassle... The problem is that my version of visual studio doesn't have the right builder options for Windows XP. That's why I'm searching for an app like that... :(

              www.robotecnik.com[^] - robots, CNC and PLC programming

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              What is the difference to send a VK_RETURN (which closes the message box) and send a WM_CLOSE :) ?

              It does not solve my Problem, but it answers my question

              1 Reply Last reply
              0
              • J Joan M

                The application itself is super easy to do... I don't want to close the messagebox, I want to accept it, that's why the VK_RETURN. It works in my computer without much hassle... The problem is that my version of visual studio doesn't have the right builder options for Windows XP. That's why I'm searching for an app like that... :(

                www.robotecnik.com[^] - robots, CNC and PLC programming

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Put your sourcecode in my profile blog. I will try then to make a native W32 for you ;)

                It does not solve my Problem, but it answers my question

                J 1 Reply Last reply
                0
                • L Lost User

                  Put your sourcecode in my profile blog. I will try then to make a native W32 for you ;)

                  It does not solve my Problem, but it answers my question

                  J Offline
                  J Offline
                  Joan M
                  wrote on last edited by
                  #8

                  Have not seen how to post it in your blog... Hope you don't mind I post it here:

                  #include "pch.h"
                  #include
                  #include
                  #include
                  #include
                  #include
                  #include

                  int main(int argc, char *argv[])
                  {
                  LPCTSTR windowName = "Pregunta";
                  int ims = 10000;

                  if (argc > 1)	windowName = argv\[1\];
                  if (argc > 2)	ims = atoi(argv\[2\]);
                  
                  while (true)
                  {
                  	HWND hHandle = ::FindWindow(NULL, windowName);
                  	std::cout << hHandle;
                  	std::cout << "\\r\\n";
                  
                  	if (hHandle != NULL)
                  	{
                  		::PostMessage(hHandle, WM\_KEYDOWN, VK\_RETURN, 0x001C0001);
                  		::PostMessage(hHandle, WM\_KEYDOWN, VK\_DOWN, 0x00500001);
                  	}
                  	Sleep(ims);
                  }
                  

                  }

                  Thank you for taking time to do this! :beer: PS: the compiler must not be set to unicode to accept this as valid.

                  www.robotecnik.com[^] - robots, CNC and PLC programming

                  https://www.robotecnik.com freelance robots, PLC and CNC programmer.

                  L 1 Reply Last reply
                  0
                  • J Joan M

                    SOLVED ALREADY, I've done a small program in C++ that handles that for me. The problem was not doing the program itself (which is super easy to do) the problem was getting an executable file that would work in Windows XP. After a good tip from @Daniel_Pfeffer, I've learned how to configure newer versions of Visual Studio to link for Windows XP. THANK YOU ALL! :thumbsup: I've seen "Clickoff" and "windows closer by Murgee", but the first one seems not to be capable to click on the message box and press enter afterwards, and the second one can't simply run on windows XP. I've done a super simple small C++ program that would do that search for window handle, send return there. and that should be it. The problem is that what is output from my Visual Studio is not compatible anymore with windows xp... (that's why I'm searching for a free application that could do that). Each 2 or 3 years I get a request that implies opening 3 virtual machines and open a set of files... each time I try to open those files it takes between 30 minutes to several hours. And always appears some messageboxes that need to be confirmed for the process to continue. This leaves me in front of the computer waiting for them... Thank you all! :beer:

                    www.robotecnik.com[^] - robots, CNC and PLC programming

                    J Offline
                    J Offline
                    Jacquers
                    wrote on last edited by
                    #9

                    Have a look at AutoHotKey, there may be a suitable script.

                    1 Reply Last reply
                    0
                    • J Joan M

                      SOLVED ALREADY, I've done a small program in C++ that handles that for me. The problem was not doing the program itself (which is super easy to do) the problem was getting an executable file that would work in Windows XP. After a good tip from @Daniel_Pfeffer, I've learned how to configure newer versions of Visual Studio to link for Windows XP. THANK YOU ALL! :thumbsup: I've seen "Clickoff" and "windows closer by Murgee", but the first one seems not to be capable to click on the message box and press enter afterwards, and the second one can't simply run on windows XP. I've done a super simple small C++ program that would do that search for window handle, send return there. and that should be it. The problem is that what is output from my Visual Studio is not compatible anymore with windows xp... (that's why I'm searching for a free application that could do that). Each 2 or 3 years I get a request that implies opening 3 virtual machines and open a set of files... each time I try to open those files it takes between 30 minutes to several hours. And always appears some messageboxes that need to be confirmed for the process to continue. This leaves me in front of the computer waiting for them... Thank you all! :beer:

                      www.robotecnik.com[^] - robots, CNC and PLC programming

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #10

                      Like this? PIEBALDconsult - Professional Profile[^]

                      J 1 Reply Last reply
                      0
                      • J Joan M

                        Have not seen how to post it in your blog... Hope you don't mind I post it here:

                        #include "pch.h"
                        #include
                        #include
                        #include
                        #include
                        #include
                        #include

                        int main(int argc, char *argv[])
                        {
                        LPCTSTR windowName = "Pregunta";
                        int ims = 10000;

                        if (argc > 1)	windowName = argv\[1\];
                        if (argc > 2)	ims = atoi(argv\[2\]);
                        
                        while (true)
                        {
                        	HWND hHandle = ::FindWindow(NULL, windowName);
                        	std::cout << hHandle;
                        	std::cout << "\\r\\n";
                        
                        	if (hHandle != NULL)
                        	{
                        		::PostMessage(hHandle, WM\_KEYDOWN, VK\_RETURN, 0x001C0001);
                        		::PostMessage(hHandle, WM\_KEYDOWN, VK\_DOWN, 0x00500001);
                        	}
                        	Sleep(ims);
                        }
                        

                        }

                        Thank you for taking time to do this! :beer: PS: the compiler must not be set to unicode to accept this as valid.

                        www.robotecnik.com[^] - robots, CNC and PLC programming

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #11

                        Hi again Finally this does the job in my environement

                        HWND xWnd= FindWindow(NULL, "DlgWnd");
                        if (xWnd)
                        {
                        int xWatchDogCount= 0;
                        while(xWatchDogCount++ < 10) // Prevent from do forever
                        {
                        HWND xOkBtnWnd = FindWindowEx(xWnd, NULL, NULL, "OK");
                        if (xOkBtnWnd)
                        {
                        PostMessage(xOkBtnWnd, WM_KEYDOWN, VK_SPACE, 0);
                        PostMessage(xOkBtnWnd, WM_KEYUP, VK_SPACE, 0);
                        }
                        }
                        }

                        It does not solve my Problem, but it answers my question

                        L J 3 Replies Last reply
                        0
                        • J Joan M

                          SOLVED ALREADY, I've done a small program in C++ that handles that for me. The problem was not doing the program itself (which is super easy to do) the problem was getting an executable file that would work in Windows XP. After a good tip from @Daniel_Pfeffer, I've learned how to configure newer versions of Visual Studio to link for Windows XP. THANK YOU ALL! :thumbsup: I've seen "Clickoff" and "windows closer by Murgee", but the first one seems not to be capable to click on the message box and press enter afterwards, and the second one can't simply run on windows XP. I've done a super simple small C++ program that would do that search for window handle, send return there. and that should be it. The problem is that what is output from my Visual Studio is not compatible anymore with windows xp... (that's why I'm searching for a free application that could do that). Each 2 or 3 years I get a request that implies opening 3 virtual machines and open a set of files... each time I try to open those files it takes between 30 minutes to several hours. And always appears some messageboxes that need to be confirmed for the process to continue. This leaves me in front of the computer waiting for them... Thank you all! :beer:

                          www.robotecnik.com[^] - robots, CNC and PLC programming

                          D Offline
                          D Offline
                          Daniel Pfeffer
                          wrote on last edited by
                          #12

                          Joan M wrote:

                          The problem is that what is output from my Visual Studio is not compatible anymore with windows xp...

                          For Visual Studio 2017 or 2019: 1. Open the Visual Studio Installer 2. Click "Modify" 3. Select the "Individual Components" tab 4. Scroll down, and select the "Windows XP support for C++" option This should enable you to target Windows XP (it will appear as a separate option in the list of toolsets)

                          Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                          J 1 Reply Last reply
                          0
                          • L Lost User

                            Hi again Finally this does the job in my environement

                            HWND xWnd= FindWindow(NULL, "DlgWnd");
                            if (xWnd)
                            {
                            int xWatchDogCount= 0;
                            while(xWatchDogCount++ < 10) // Prevent from do forever
                            {
                            HWND xOkBtnWnd = FindWindowEx(xWnd, NULL, NULL, "OK");
                            if (xOkBtnWnd)
                            {
                            PostMessage(xOkBtnWnd, WM_KEYDOWN, VK_SPACE, 0);
                            PostMessage(xOkBtnWnd, WM_KEYUP, VK_SPACE, 0);
                            }
                            }
                            }

                            It does not solve my Problem, but it answers my question

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #13

                            test

                            It does not solve my Problem, but it answers my question https://www.youtube.com/watch?v=FjrEUdsajPA

                            1 Reply Last reply
                            0
                            • L Lost User

                              Hi again Finally this does the job in my environement

                              HWND xWnd= FindWindow(NULL, "DlgWnd");
                              if (xWnd)
                              {
                              int xWatchDogCount= 0;
                              while(xWatchDogCount++ < 10) // Prevent from do forever
                              {
                              HWND xOkBtnWnd = FindWindowEx(xWnd, NULL, NULL, "OK");
                              if (xOkBtnWnd)
                              {
                              PostMessage(xOkBtnWnd, WM_KEYDOWN, VK_SPACE, 0);
                              PostMessage(xOkBtnWnd, WM_KEYUP, VK_SPACE, 0);
                              }
                              }
                              }

                              It does not solve my Problem, but it answers my question

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #14

                              test

                              It does not solve my Problem, but it answers my question Rubik's Cube with Patrick Bossert A - Z of the 80s C episode - YouTube[^]

                              1 Reply Last reply
                              0
                              • D Daniel Pfeffer

                                Joan M wrote:

                                The problem is that what is output from my Visual Studio is not compatible anymore with windows xp...

                                For Visual Studio 2017 or 2019: 1. Open the Visual Studio Installer 2. Click "Modify" 3. Select the "Individual Components" tab 4. Scroll down, and select the "Windows XP support for C++" option This should enable you to target Windows XP (it will appear as a separate option in the list of toolsets)

                                Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                                J Offline
                                J Offline
                                Joan M
                                wrote on last edited by
                                #15

                                SUPER! I'll try it thanks!

                                www.robotecnik.com[^] - robots, CNC and PLC programming

                                https://www.robotecnik.com freelance robots, PLC and CNC programmer.

                                1 Reply Last reply
                                0
                                • P PIEBALDconsult

                                  Like this? PIEBALDconsult - Professional Profile[^]

                                  J Offline
                                  J Offline
                                  Joan M
                                  wrote on last edited by
                                  #16

                                  That's almost the same code I've done... Mine works perfectly (like yours) but I was not able to put the executable in windows XP... I've got a suggestion explaining how to get Visual Studio to be able to link for XP. I'll do that. THANKS for answering!

                                  www.robotecnik.com[^] - robots, CNC and PLC programming

                                  https://www.robotecnik.com freelance robots, PLC and CNC programmer.

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    Hi again Finally this does the job in my environement

                                    HWND xWnd= FindWindow(NULL, "DlgWnd");
                                    if (xWnd)
                                    {
                                    int xWatchDogCount= 0;
                                    while(xWatchDogCount++ < 10) // Prevent from do forever
                                    {
                                    HWND xOkBtnWnd = FindWindowEx(xWnd, NULL, NULL, "OK");
                                    if (xOkBtnWnd)
                                    {
                                    PostMessage(xOkBtnWnd, WM_KEYDOWN, VK_SPACE, 0);
                                    PostMessage(xOkBtnWnd, WM_KEYUP, VK_SPACE, 0);
                                    }
                                    }
                                    }

                                    It does not solve my Problem, but it answers my question

                                    J Offline
                                    J Offline
                                    Joan M
                                    wrote on last edited by
                                    #17

                                    @Daniel_Pfeiffer posted how to get modern visual studios to be able to link for windows XP... I'll follow that advice. Thanks!

                                    www.robotecnik.com[^] - robots, CNC and PLC programming

                                    https://www.robotecnik.com freelance robots, PLC and CNC programmer.

                                    L 1 Reply Last reply
                                    0
                                    • J Joan M

                                      @Daniel_Pfeiffer posted how to get modern visual studios to be able to link for windows XP... I'll follow that advice. Thanks!

                                      www.robotecnik.com[^] - robots, CNC and PLC programming

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #18

                                      :thumbsup:

                                      It does not solve my Problem, but it answers my question Rubik's Cube with Patrick Bossert A - Z of the 80s C episode - YouTube[^]

                                      1 Reply Last reply
                                      0
                                      • J Joan M

                                        SOLVED ALREADY, I've done a small program in C++ that handles that for me. The problem was not doing the program itself (which is super easy to do) the problem was getting an executable file that would work in Windows XP. After a good tip from @Daniel_Pfeffer, I've learned how to configure newer versions of Visual Studio to link for Windows XP. THANK YOU ALL! :thumbsup: I've seen "Clickoff" and "windows closer by Murgee", but the first one seems not to be capable to click on the message box and press enter afterwards, and the second one can't simply run on windows XP. I've done a super simple small C++ program that would do that search for window handle, send return there. and that should be it. The problem is that what is output from my Visual Studio is not compatible anymore with windows xp... (that's why I'm searching for a free application that could do that). Each 2 or 3 years I get a request that implies opening 3 virtual machines and open a set of files... each time I try to open those files it takes between 30 minutes to several hours. And always appears some messageboxes that need to be confirmed for the process to continue. This leaves me in front of the computer waiting for them... Thank you all! :beer:

                                        www.robotecnik.com[^] - robots, CNC and PLC programming

                                        M Offline
                                        M Offline
                                        milo xml
                                        wrote on last edited by
                                        #19

                                        You can try this. I've used it in the past for some scripting. https://www.autoitscript.com/site/[^]

                                        J 1 Reply Last reply
                                        0
                                        • J Joan M

                                          SOLVED ALREADY, I've done a small program in C++ that handles that for me. The problem was not doing the program itself (which is super easy to do) the problem was getting an executable file that would work in Windows XP. After a good tip from @Daniel_Pfeffer, I've learned how to configure newer versions of Visual Studio to link for Windows XP. THANK YOU ALL! :thumbsup: I've seen "Clickoff" and "windows closer by Murgee", but the first one seems not to be capable to click on the message box and press enter afterwards, and the second one can't simply run on windows XP. I've done a super simple small C++ program that would do that search for window handle, send return there. and that should be it. The problem is that what is output from my Visual Studio is not compatible anymore with windows xp... (that's why I'm searching for a free application that could do that). Each 2 or 3 years I get a request that implies opening 3 virtual machines and open a set of files... each time I try to open those files it takes between 30 minutes to several hours. And always appears some messageboxes that need to be confirmed for the process to continue. This leaves me in front of the computer waiting for them... Thank you all! :beer:

                                          www.robotecnik.com[^] - robots, CNC and PLC programming

                                          M Offline
                                          M Offline
                                          Member 9167057
                                          wrote on last edited by
                                          #20

                                          The output from Visual Studio is compatible with XP when you build with the XP-compatible toolchain.

                                          J 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