Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 31-03-2009
rarratia rarratia is offline
Miembro
 
Registrado: sep 2004
Posts: 50
Poder: 20
rarratia Va por buen camino
Pasar parámetros a programas de window

Amigos:

Tengo la función SellExecute que abre la calculadora de window (calc.exe), quisiera saber si hay alguna forma de ubicar en una posición determinada dicha calculadora y que no se abra en la posición por defecto. ¿Se puede lograr esto?
Responder Con Cita
  #2  
Antiguo 31-03-2009
Avatar de Faust
Faust Faust is offline
Miembro
 
Registrado: abr 2006
Ubicación: México D.F.
Posts: 930
Poder: 19
Faust Va por buen camino
Claro que si... usa la función SetWindowPos del API de Windows...

Puedes ver un ejemplo en una de las respuestas de un hilo que abrí hace tiempo, aqui.
__________________
Herr Heins Faust
Responder Con Cita
  #3  
Antiguo 01-04-2009
rarratia rarratia is offline
Miembro
 
Registrado: sep 2004
Posts: 50
Poder: 20
rarratia Va por buen camino
Cita:
Empezado por Faust Ver Mensaje
Claro que si... usa la función SetWindowPos del API de Windows...

Puedes ver un ejemplo en una de las respuestas de un hilo que abrí hace tiempo, aqui.
¿Para saber la posción que trae la calculadora se usa una función especial????
Responder Con Cita
  #4  
Antiguo 01-04-2009
Avatar de Faust
Faust Faust is offline
Miembro
 
Registrado: abr 2006
Ubicación: México D.F.
Posts: 930
Poder: 19
Faust Va por buen camino
Otra opción (que no he usado) es SetWindowPlacement para posicionar una ventana y GetWindowPlacement para obtener su posición y su estado...

Ambas funciones utilizan la estructura WINDOWPLACEMENT, encontrarás ayuda de esto en la ayuda de Windows SDK.

Cita:
The GetWindowPlacement function retrieves the show state and the restored, minimized, and maximized positions of the specified window.

BOOL GetWindowPlacement(

HWND hWnd, // handle of window
WINDOWPLACEMENT *lpwndpl // address of structure for position data
);


Parameters

hWnd

Identifies the window.

lpwndpl

Points to the WINDOWPLACEMENT structure that receives the show state and position information.
Before calling GetWindowPlacement, set the length member of the WINDOWPLACEMENT structure to sizeof(WINDOWPLACEMENT).
GetWindowPlacement fails if lpwndpl->length is not set correctly.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The flags member of WINDOWPLACEMENT retrieved by this function is always zero. If the window identified by the hWnd parameter is maximized, the showCmd member is SW_SHOWMAXIMIZED. If the window is minimized, showCmd is SW_SHOWMINIMIZED. Otherwise, it is SW_SHOWNORMAL.
The length member of WINDOWPLACEMENT must be set to sizeof(WINDOWPLACEMENT). If this member is not set correctly, the function returns FALSE.

See Also

SetWindowPlacement, WINDOWPLACEMENT
Cita:
The SetWindowPlacement function sets the show state and the restored, minimized, and maximized positions of the specified window.

BOOL SetWindowPlacement(

HWND hWnd, // handle of window
CONST WINDOWPLACEMENT *lpwndpl // address of structure with position data
);


Parameters

hWnd

Identifies the window.

lpwndpl

Points to a WINDOWPLACEMENT structure that specifies the new show state and window positions.
Before calling SetWindowPlacement, set the length member of the WINDOWPLACEMENT structure to sizeof(WINDOWPLACEMENT).
SetWindowPlacement fails if lpwndpl->length is not set correctly.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The length member of WINDOWPLACEMENT must be set to sizeof(WINDOWPLACEMENT). If this member is not set correctly, the function returns FALSE.

See Also

GetWindowPlacement, WINDOWPLACEMENT
Cita:
The WINDOWPLACEMENT structure contains information about the placement of a window on the screen.

typedef struct _WINDOWPLACEMENT { // wndpl
UINT length;
UINT flags;
UINT showCmd;
POINT ptMinPosition;
POINT ptMaxPosition;
RECT rcNormalPosition;
} WINDOWPLACEMENT;


Members

length

Specifies the length, in bytes, of the structure. Before calling the GetWindowPlacement or SetWindowPlacement functions, set this member to sizeof(WINDOWPLACEMENT).

GetWindowPlacement and SetWindowPlacement fail if this member is not set correctly.

flags

Specifies flags that control the position of the minimized window and the method by which the window is restored. This member can be one or both of the following values:



Value Meaning
WPF_RESTORETOMAXIMIZED
Specifies that the restored window will be maximized, regardless of whether it was maximized before it was minimized. This setting is only valid the next time the window is restored. It does not change the default restoration behavior. This flag is only valid when the SW_SHOWMINIMIZED value is specified for the showCmd member.
WPF_SETMINPOSITION
Specifies that the coordinates of the minimized window may be specified. This flag must be specified if the coordinates are set in the ptMinPosition member.


showCmd

Specifies the current show state of the window. This member can be one of the following values:



Value Meaning
SW_HIDE Hides the window and activates another window.
SW_MINIMIZE Minimizes the specified window and activates the top-level window in the system's list.
SW_RESTORE Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position (same as SW_SHOWNORMAL).
SW_SHOW Activates a window and displays it in its current size and position.
SW_SHOWMAXIMIZED Activates a window and displays it as a maximized window.
SW_SHOWMINIMIZED Activates a window and displays it as an icon.
SW_SHOWMINNOACTIVE Displays a window as an icon. The active window remains active.
SW_SHOWNA Displays a 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 (same as SW_RESTORE).


ptMinPosition

Specifies the coordinates of the window's upper-left corner when the window is minimized.

ptMaxPosition

Specifies the coordinates of the window's upper-left corner when the window is maximized.

rcNormalPosition

Specifies the window's coordinates when the window is in the restored position.



See Also

ShowWindow, POINT, RECT
__________________
Herr Heins Faust
Responder Con Cita
  #5  
Antiguo 01-04-2009
rarratia rarratia is offline
Miembro
 
Registrado: sep 2004
Posts: 50
Poder: 20
rarratia Va por buen camino
Gracias amigos, esto ha sido de gran ayuda, me nace una inquietud más y tal vez la más difícil, ¿puedo asociar el evento onClose de la calculadora a un evento en delphi para que me avise cuando la ventana cierra?
Responder Con Cita
  #6  
Antiguo 01-04-2009
Avatar de Faust
Faust Faust is offline
Miembro
 
Registrado: abr 2006
Ubicación: México D.F.
Posts: 930
Poder: 19
Faust Va por buen camino
No creo que sea tan difícil, lo malo es que no sé como, pero seguro alguien más en el foro sabrá la respuesta.
__________________
Herr Heins Faust
Responder Con Cita
  #7  
Antiguo 01-04-2009
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Poder: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Quizás

Saludos.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Pasar variables entre programas Belaix Varios 5 24-11-2008 07:06:31
Pasar parámetros entre programas lacovera Varios 2 07-05-2008 03:11:51
Pasar Parametros pmtzg Varios 1 08-12-2007 01:06:38
Pasar parametros.... Coco_jac SQL 2 02-09-2006 04:28:16
Abrir programas con parámetros cuando se recibe un mail Athalon Internet 2 04-07-2003 14:14:05


La franja horaria es GMT +2. Ahora son las 07:53:56.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi