Proceso y restauración

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
Hola a todos...

Tengo este duda existencial, que no me deja tranquilo...

1) La idea es que al presionar el botón en el proyecto (ams), primero verifique si el "Windows Media Player" se está ejecutando (wmplayer.exe),
si es así, que lo MAXIMIZE o lo MUESTRE (pantalla activa).

2) Pero si no está ejecutado, que se ejecute buscando la ruta de instalación correcta (depende la versión de Windows):
x86 = "C:\\Program Files\\Windows Media Player\\wmplayer.exe"
x64 ="C:\\Program Files (x86)\\Windows Media Player\\wmplayer.exe"


Tengo este código que está en un Xbutton (OnClick) el cual funciona perfecto:

Código: Seleccionar todo

file_to_check_for = "wmplayer.exe";
processes = System.EnumerateProcesses();

for j, file_path in pairs(processes) do
    file = String.SplitPath(file_path);
    if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
        dResult = Window.Show(Application.GetWndHandle("wmplayer.exe"));
        else
        File.Open("C:\\Archivos de programa\\Windows Media Player\\wmplayer.exe");
        end
    end
Ahora, cuando necesito hacer lo mismo pero con el "VLC Media Player" (usando el mismo código y sólo cambiando la ruta y el ejecutable), genera error y se abre "18 veces" el VLC Media Player (18 ventanas) al mismo tiempo.

Código: Seleccionar todo

file_to_check_for = "vlc.exe";
processes = System.EnumerateProcesses();

for j, file_path in pairs(processes) do
    file = String.SplitPath(file_path);
    if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
        dResult = Window.Show(Application.GetWndHandle("vlc.exe"));
        else
        File.Open("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe");
        end
    end
A) Por qué sucederá eso?
B) Como se puede resolver el problema para que funcione el VLC... alguna solución?.


Agradezco su apoyo en esto.
HIDE: ON
Hidebb Message Hidden Description
usamakey escribió:
16 May 2024 16:14
HIDE: ON
Hidebb Message Hidden Description
Hi usamakey...
Gracias... probaré tu código.
Hi usamakey...
HIDE: ON
Hidebb Message Hidden Description
user_foro escribió:
16 May 2024 17:22
usamakey escribió:
16 May 2024 16:14
HIDE: ON
Hidebb Message Hidden Description
Hi usamakey...
Gracias... probaré tu código.
I have been able to notice that when I enter your code and test it, it opens VLC correctly... but every time I click on the xButton (where that code is) a new VLC window opens and the idea is that it is only a single one window (the same).
Example: If I click on the xButton I open the VLC and if I minimize that window and click on the xButton again, it should invoke the same VLC window (even if it is in the background or minimized), that is, it should be shown and not opened other.
It seems that the program only interprets the "File.Open" and not the rest of the code.
He podido notar que cuando ingreso tu código y lo pruebo, abre VLC correctamente... pero cada vez que hago clic en el xButton (donde está ese código) se abre una nueva ventana de VLC y la idea es que sólo sea una sola ventana (la misma).

Ejemplo: Si hago clic en el xButton abro el VLC y si minimizo esa ventana y vuelvo a hacer clic en el xButton, debería invocar la misma ventana de VLC (aunque esté en segundo plano o minimizada), es decir, debería estar mostrado y no abrir una nueva.

Parece que el programa sólo interpreta el final del código: "File.Open" y no toma el resto del código anterior.
HIDE: ON
Hidebb Message Hidden Description
usamakey escribió:
19 May 2024 13:15
HIDE: ON
Hidebb Message Hidden Description



Understand...
But, in the case of WMP no need to know the handle of the external window.... It makes it automatic!.


*.APZ (Reference):
HIDE: ON
Hidebb Message Hidden Description
dude,
Absolutely not.
that code launches windows media player every time
but it doesn't work on WMP window (hide and show)
to do this you need to know the window handle

usamakey escribió:
20 May 2024 09:31
dude,
Absolutely not.
that code launches windows media player every time
but it doesn't work on WMP window (hide and show)
to do this you need to know the window handle

understand...
And in what "Explicit" way can I get the window number and how should I do it in my project?
I appreciate your help on this.
usamakey escribió:
20 May 2024 09:31
dude,
Absolutely not.
that code launches windows media player every time
but it doesn't work on WMP window (hide and show)
to do this you need to know the window handle

The case of WMP is just an example of how well said code works, nothing more.

What I need is to do the same but in another type of player (Example: VLC)... The problem occurs when I use VLC (it doesn't do the same thing), it goes crazy opening windows.

I would appreciate it if you could help me with that please.

Video (Demo):
https://vimeo.com/948446650
Maybe what you want is similar to this example :

HIDE: ON
Hidebb Message Hidden Description


:) :hypno:
abood1987 escribió:
25 May 2024 13:55
Maybe what you want is similar to this example :

HIDE: ON
Hidebb Message Hidden Description


:) :hypno:
Hello abood1987...

Hello abood1987...

First thank you for your time and help. I have checked the apz and when I run it it only searches on x86, it would be great if the search was on both platforms, both x86 & x64. so as not to generate forced errors.

P.S.: VLC is installed on the computer where I ran the apz. (view image).

I would appreciate your help on that please.

I would appreciate your help on that please.

Imagen
Well, we will make the modification according to the Windows operating system
This code will help :

Código: Seleccionar todo

-- Check if the OS is 64 bit
b64Bit = System.Is64BitOS();

if b64Bit then
-- The OS is 64 bit
else
-- The OS is not 64 bit.
end
If you can't edit, I can help :pc:
Hi :success-1414025948:

Remember that you can work in a simple way using Plugin Name : ActiveX Object Plugin .

I found this example that you can study to understand it :

HIDE: ON
Hidebb Message Hidden Description
abood1987 escribió:
27 May 2024 14:10
Well, we will make the modification according to the Windows operating system
This code will help :

Código: Seleccionar todo

-- Check if the OS is 64 bit
b64Bit = System.Is64BitOS();

if b64Bit then
-- The OS is 64 bit
else
-- The OS is not 64 bit.
end
If you can't edit, I can help :pc:
Thanks for your help again... I don't really know where the code goes in the abood_project.apz.
I insert it in there, thinking it might be okay but it doesn't do it right.
Maybe since you offered me help with that, you can incorporate it into the app you sent me... please.
Welcome

Yes, the previous errors have been corrected and it works well
You will find the codes step by step to learn from them. You will find them in Global Functions
Download example on Mediafire Server :

HIDE: ON
Hidebb Message Hidden Description


Enjoy :friends:
abood1987 escribió:
30 May 2024 12:28
Welcome

Yes, the previous errors have been corrected and it works well
You will find the codes step by step to learn from them. You will find them in Global Functions
Download example on Mediafire Server :

HIDE: ON
Hidebb Message Hidden Description


Enjoy :friends:
Thanks for responding abood 1987...
When you run the application, it searches for the system type very well, but it keeps opening more windows.
The idea is that it is always a single window, if there is already one open, make it active (show it), but do not continue opening more windows of the same VLC.

P.S.: The song in the video is good.

Thank you again for your time.

Imagen.
user_foro escribió:
30 May 2024 18:03
but it keeps opening more windows.
The idea is that it is always a single window, if there is already one open, make it active (show it), but do not continue opening more windows of the same VLC.
The application did not open more than one window automatically for me. I did not notice that.
Or do you want the user to not be able to play another video manually, so it can only be done through the application?
Can you record what happens to you on video?
abood1987 escribió:
30 May 2024 18:59
user_foro escribió:
30 May 2024 18:03
but it keeps opening more windows.
The idea is that it is always a single window, if there is already one open, make it active (show it), but do not continue opening more windows of the same VLC.
The application did not open more than one window automatically for me. I did not notice that.
Or do you want the user to not be able to play another video manually, so it can only be done through the application?
Can you record what happens to you on video?
I need only a single window to be active.

Even if you click on the project, only use the current VLC window.

Please.-