PDA

Ver la Versión Completa : abrir .htm en una nueva ventana con shellexecute


ruina
24-06-2004, 13:55:57
En mi aplicación abro una serie de ficheros html en disco mediante ShellExecute(0,'open',pchar(s),nil,nil,SW_SHOWNORMAL)

El problema es que unas veces los abre bien, en una ventana visible al usuario y otras lo hace en un explorador ya abierto y no visible (detras de la aplicación) con un resultado mas bien feo.

Me gustaria que:
a) abriese siempre una ventana nueva
ó
b) lo abriese una ventana existente pero maximizada y en el top most

(Si os preguntais porque uso 0 en lugar del application.handle es por que es un proyecto clx y el application.handle es un Qhandle)

ya no se que mas probar...

marcoszorrilla
24-06-2004, 14:36:14
Mírate estas opciones:

parameter can be one of the following values:

Value Meaning
SW_HIDE Hides the window and activates another window.
SW_MAXIMIZE Maximizes the specified window.
SW_MINIMIZE Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application. An application should call ShowWindow with this flag to set the initial show state of its main window.
SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE Displays the window as a minimized window. The active window remains active.
SW_SHOWNA Displays the window in its current state. The active window remains active.
SW_SHOWNOACTIVATE Displays a window in its most recent size and position. The active window remains active.
SW_SHOWNORMAL Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.

Un Saludo.

ruina
24-06-2004, 15:36:15
gracias, pero ya las he probado todas y no hay manera, unas veces las abre bien y otras no :\

roman
24-06-2004, 17:05:13
El problema es que unas veces los abre bien, en una ventana visible al usuario y otras lo hace en un explorador ya abierto

Esto pasa porque el usuario tiene habilitada la opción "Iniciar accesos directos en ventanas ya abiertas" del menú

Herramientas | Opciones de Internet | Opciones avanzadas |Examinar

del Internet Explorer.

Para forzar una nueva ventana independientemente de esta opción puedes recurrir al truco 83 de trucomanía. Pero también leete este hilo (http://www.clubdelphi.com/foros/archivo/viewtopic.php?t=13202&highlight=), por ahí del cuarto mensaje en donde Isabela menciona que dicho truco no le funciona y le proporcioné una alternativa que al parecer sí le sirvió.

// Saludos

ruina
24-06-2004, 19:42:18
Esto pasa porque el usuario tiene habilitada la opción "Iniciar accesos directos en ventanas ya abiertas" del menú

Herramientas | Opciones de Internet | Opciones avanzadas |Examinar

del Internet Explorer.

Wow Roman, le das un nuevo sentido a la expresión "pasar la pelota"! me mola ^_^ si le puedo echar las culpas al IE ya lo tengo todo solusionao xD

lo del CoInternetExplorer.Create me lo apunto, mañana lo pruebo y os cuento que ahora toy molido, ademas, el xp me ha chafao el arranque del linux y no se si cortarme las venas o dejarmelas largas, bueno esto no viene al caso pero asi me desahogo
...

roman
24-06-2004, 19:47:54
lo del CoInternetExplorer.Create me lo apunto, mañana lo pruebo y os cuento que ahora toy molido

En todo caso intenta primero con lo de trucomanía:


uses
UrlMon;

...

HlinkNavigateString(Nil,'index.html');


que es mucho más sencillo y rápido de probar.

// Saludos

pd: pero antes descansa ;)