Announcement

Collapse
No announcement yet.

Has the program been minimized?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Has the program been minimized?

    Hello
    I wanted a DLL file to write the name of a program in its input and return 1 in the output if the program was minimized, return 0 if it was not minimized, and return -1 if the program was not opened. Can someone give me this DLL file? or Build this one?

    Thanks in advance

  • #2
    This can be done entirely in AutoPlay Media Studio, no DLL needs to be built, no plugins is required. You can use DLL.CallFunction() to query the Windows API function IsIconic() and check if a window is minimized or not. I suggest that you invest some time to learn this program, and show your project where you are stuck, instead of just asking to have things done for you repeatedly.

    Ulrich

    Comment


    • #3
      Hi Ulrich ... I know how to work with Autoplay and my wizard , and I know how to work with the dll.callfunctions function, but I need to be able to see the program that I run in the input (for example iexplorer.exe) Has it been minimized or not? How should I send this information to the user32.dll file?) My problem is here ... Regarding the suggestion you made, I will definitely do the same from now on ... Thank you From your guidance ...

      Comment


      • #4
        Check the documentation for DLL.CallFunction() and the page I linked in my reply - the function IsIconic() returns an integer and takes a single parameter, which is the window handle. You can get this handle very easily in AutoPlay Media Studio if you put a little effort into this.

        Ulrich

        Click image for larger version  Name:	SCRN-2021-05-11-01.png Views:	0 Size:	31.0 KB ID:	306986

        Comment


        • #5
          I test this code:
          Code:
          result = DLL.CallFunction(_SystemFolder .. "\\User32.dll", "IsIconic", Application.GetWndHandle("iexplore.exe"), DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
          alert = Dialog.Message("Notice", result, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
          But this code always shows 0, (Whether Internet Explorer is open, minimized, or restored!)

          What's wrong?

          Comment


          • #6
            First, get a list of open programs with Window.EnumerateProcesses(true). This will give you a table of the programs which have a window on the desktop, and also the handle of each window. Find the window you want in this list, and pass the handle to the IsIconic() function.

            Also, you need to transform the handle to string to work correctly. This function will return true or false, and takes the window handle as an argument. I defined this function:
            Code:
            function Window.IsIconic(nWhnd)
               local nRes = String.ToNumber(DLL.CallFunction(_SystemFolder .. "\\user32.dll", "IsIconic", tostring(nWhnd), DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL));
               error = Application.GetLastError();
               if (error ~= 0) then
                  Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
               end
               return (nRes > 0);
            end
            Possible use:
            Code:
            local bRes = Window.IsIconic(nWhnd);
            if bRes then
               Dialog.Message("", "Window is minimized");
            else
               Dialog.Message("", "Window is not minimized");
            end
            Ulrich

            Comment


            • #7
              result = Window.EnumerateProcesses(true);
              for a,z in pairs (result) do
              if String.Find(z, "IEXPLORE.EXE", 1, false) ~= -1 then
              hndl = a
              break
              end
              end
              minimized = DLL.CallFunction("User32.dll", "IsIconic", hndl, DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
              alert = Dialog.Message("Notice", minimized, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);[/CODE]

              Comment


              • #8
                Thank's a lot Ulrich ...

                Originally posted by startup View Post
                result = Window.EnumerateProcesses(true);
                for a,z in pairs (result) do
                if String.Find(z, "IEXPLORE.EXE", 1, false) ~= -1 then
                hndl = a
                break
                end
                end
                minimized = DLL.CallFunction("User32.dll", "IsIconic", hndl, DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
                alert = Dialog.Message("Notice", minimized, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);[/CODE]
                this code works correctly! Thank's a lot startup ...
                What' s is a and z in the loop?
                Why hndl = a ?

                Comment


                • #9
                  in this function a is the handle z is the full path of the process after exit the loop a and z becomes nil so it is necessary to store a value in another variable like hndl or any name you like

                  Comment


                  • #10
                    dude

                    PHP Code:
                    Declare Function IsIconic Lib "user32.dll" (ByVal hwnd As Long) As Long
                    If minflag <> 0  (require String.ToNumberthen


                    IsIconic Example

                    Comment


                    • #11
                      fantastic info Ulrich!
                      great example startup!

                      I had no idea DLL.CallFunction() had such potential.

                      David R.

                      Comment


                      • #12
                        yes daviz it has. but that was a simple function. some other functions makes a chalenge

                        Comment


                        • #13
                          Originally posted by startup View Post
                          yes daviz it has. but that was a simple function. some other functions makes a chalenge
                          Thank you very much, what about folders ?! It is possible?!

                          Comment


                          • #14
                            yes using winapi
                            • WinApi.FindWindow
                            • WinApi.IsWindowMinimized

                            Comment


                            • #15
                              yes.
                              you can modify the String.Find in my code to detect folders..
                              if you remember :-
                              z = full path.
                              that means that you can catch folders also.

                              Comment

                              Working...
                              X