elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


+  Foro de elhacker.net
|-+  Sistemas Operativos
| |-+  Windows (Moderador: Randomize)
| | |-+  CAMBIAR POSICION EN INICIO DEL PROGRAMA
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] 2 Ir Abajo Respuesta Imprimir
Autor Tema: CAMBIAR POSICION EN INICIO DEL PROGRAMA  (Leído 6,168 veces)
FCOSTA

Desconectado Desconectado

Mensajes: 139


Ver Perfil
CAMBIAR POSICION EN INICIO DEL PROGRAMA
« en: 1 Octubre 2014, 03:34 am »

HOLA

Tengo un programita (un simple EXE) que me sirve para el contraste del monitor. (Lo baje de una web. Es gratis.)

PERO cada vez que se ejecuta me sale la interface (la pantallita del programa que están simple que solo tiene una pantalla) pues me sale justo EN MEDIO del monitor.  Y tengo que coger con el puntero del raton y llevarla a la esquina derecha abajo que me es mas comoda. (me va mejor) Y eso es cada dia.
Un dia no cuesta nada. Pero cada dia es un poco “palo”.

Yo pregunto… ¿Hay alguna forma de que el interface (pantalla) del programa se inicie en el lugar que tu quieras del monitor? 

Para mas información uso el XP

Gracias a todos.


En línea

andreselmejor


Desconectado Desconectado

Mensajes: 1.990


TL WN620G,no audita pero navega como rayo.


Ver Perfil
Re: CAMBIAR POSICION EN INICIO DEL PROGRAMA
« Respuesta #1 en: 1 Octubre 2014, 03:50 am »


En el acceso directo o en el .exe en las propiedades(click boton derecho del mouse) colocale que inicie(ejecute) en pantalla minimizada no pantalla normal,con eso te la iniciara minimizada en una esquina.

Suerte.


 


En línea

Tal vez así,se aprende un poco mas.

Por fin se fue !!!!!! (2014-2018) sin piñericosas !!!!!!!

De antologia :

http://foro.elhacker.net/foro_libre/duda_mi_mira_fijamente-t325117.0.html

Descarga MP3 gratis
Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.788



Ver Perfil
Re: CAMBIAR POSICION EN INICIO DEL PROGRAMA
« Respuesta #2 en: 1 Octubre 2014, 14:30 pm »

En el acceso directo o en el .exe en las propiedades(click boton derecho del mouse) colocale que inicie(ejecute) en pantalla minimizada no pantalla normal,con eso te la iniciara minimizada en una esquina.

Creo que se refiere a posicionar la ventana de la aplicación en la esquina inferior derecha, pero en estado normal, no minimizada.



Se puede hacer mediante la API de Windows, siempre puedes escribir un wrapper para la función específica, pero obviamente para esto necesitas desarrollar un Script o una aplicación, ¿como andas de conocimientos de programación?.

Los pasos a seguir:
1) Encontrar el proceso.
2) Obtener el Handle de su ventana principal.
3) Mover la ventana.

Este ejemplo lo he desarrollado en VB.NET para ayudarte a resolver tu problema,
el código posiciona la ventana de X programa en Y esquina de la pantalla especificada (bueno, la verdad es que no lo he testeado en más pantallas que la primaria, de momento puede estar solo de adorno), si te sirve, solo tienes que seguir este ejemplo de abajo para llamar al método usando el nombre del proceso que quieres mover a la esquina derecha, luego compilas el código con VisualStudio, y ejecutas la aplicación compilada despues de ejecutar el programa que quieres mover.

Ejemplo de uso:

Código
  1. SetWindowPosition.SetWindowPos("proceso.exe", SetWindowPosition.Corner.BottomRight)
  2. SetWindowPosition.SetWindowPos("proceso.exe", X:=100, Y:=100, Bounds:=SystemInformation.VirtualScreen)

Source:

Código
  1. ' ***********************************************************************
  2. ' Author           : Elektro
  3. ' Last Modified On : 10-01-2014
  4. ' ***********************************************************************
  5. ' <copyright file="SetWindowPosition.vb" company="Elektro Studios">
  6. '     Copyright (c) Elektro Studios. All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Example Usage "
  11.  
  12. ' SetWindowPosition.SetWindowPos("proceso.exe", SetWindowPosition.Corner.BottomRight)
  13. ' SetWindowPosition.SetWindowPos("proceso.exe", X:=100, Y:=100, Bounds:=SystemInformation.VirtualScreen)
  14.  
  15. #End Region
  16.  
  17. #Region " Imports "
  18.  
  19. Imports System.ComponentModel
  20. Imports System.Runtime.InteropServices
  21.  
  22. #End Region
  23.  
  24. ''' <summary>
  25. ''' Set the position of a window.
  26. ''' </summary>
  27. Public Class SetWindowPosition
  28.  
  29. #Region " P/Invoke "
  30.  
  31.    ''' <summary>
  32.    ''' Platform Invocation methods (P/Invoke), access unmanaged code.
  33.    ''' This class does not suppress stack walks for unmanaged code permission.
  34.    ''' <see cref="System.Security.SuppressUnmanagedCodeSecurityAttribute"/>  must not be applied to this class.
  35.    ''' This class is for methods that can be used anywhere because a stack walk will be performed.
  36.    ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/ms182161.aspx
  37.    ''' </summary>
  38.    Protected NotInheritable Class NativeMethods
  39.  
  40. #Region " Methods "
  41.  
  42.        ''' <summary>
  43.        ''' Changes the size, position, and Z order of a child, pop-up, or top-level window.
  44.        ''' These windows are ordered according to their appearance on the screen.
  45.        ''' The topmost window receives the highest rank and is the first window in the Z order.
  46.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx
  47.        ''' </summary>
  48.        ''' <param name="hWnd">
  49.        ''' A handle to the window.
  50.        ''' </param>
  51.        ''' <param name="hWndInsertAfter">
  52.        ''' A special handle to the window to precede the positioned window in the Z order.
  53.        ''' This parameter must be a window handle or one of the <see cref="SpecialWindowHandles"/> values.
  54.        ''' </param>
  55.        ''' <param name="X">
  56.        ''' The new position of the left side of the window, in client coordinates.
  57.        ''' </param>
  58.        ''' <param name="Y">
  59.        ''' The new position of the top of the window, in client coordinates.
  60.        ''' </param>
  61.        ''' <param name="cx">
  62.        ''' The new width of the window, in pixels.
  63.        ''' </param>
  64.        ''' <param name="cy">
  65.        ''' The new height of the window, in pixels.
  66.        ''' </param>
  67.        ''' <param name="uFlags">
  68.        ''' The window sizing and positioning flags.
  69.        ''' </param>
  70.        ''' <returns><c>true</c> if the function succeeds, <c>false</c> otherwise.</returns>
  71.        <DllImport("user32.dll", SetLastError:=True)>
  72.        Friend Shared Function SetWindowPos(
  73.               ByVal hWnd As IntPtr,
  74.               ByVal hWndInsertAfter As SpecialWindowHandles,
  75.               ByVal X As Integer,
  76.               ByVal Y As Integer,
  77.               ByVal cx As Integer,
  78.               ByVal cy As Integer,
  79.               ByVal uFlags As SetWindowPosFlags
  80.        ) As Boolean
  81.        End Function
  82.  
  83.        ''' <summary>
  84.        ''' Retrieves the dimensions of the bounding rectangle of the specified window.
  85.        ''' The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
  86.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519%28v=vs.85%29.aspx
  87.        ''' </summary>
  88.        ''' <param name="hWnd">A handle to the window.</param>
  89.        ''' <param name="rc">
  90.        ''' A pointer to a RECT structure that receives the screen coordinates of
  91.        ''' the upper-left and lower-right corners of the window.
  92.        ''' </param>
  93.        ''' <returns><c>true</c> if the function succeeds, <c>false</c> otherwise.</returns>
  94.        <DllImport("user32.dll", SetLastError:=True)>
  95.        Friend Shared Function GetWindowRect(
  96.               ByVal hWnd As IntPtr,
  97.               ByRef rc As Rectangle
  98.        ) As Boolean
  99.        End Function
  100.  
  101. #End Region
  102.  
  103. #Region " Enumerations "
  104.  
  105.        ''' <summary>
  106.        ''' Specifies the window sizing and positioning flags.
  107.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx
  108.        ''' </summary>
  109.        <Description("Enum used as 'uFlags' parameter of 'NativeMethods.SetWindowPos' function")>
  110.        <Flags>
  111.        Friend Enum SetWindowPosFlags As UInteger
  112.  
  113.            ''' <summary>
  114.            ''' If the calling thread and the thread that owns the window are attached to different input queues,
  115.            ''' the system posts the request to the thread that owns the window.
  116.            ''' This prevents the calling thread from blocking its execution while other threads process the request.
  117.            ''' </summary>
  118.            ''' <remarks>SWP_ASYNCWINDOWPOS</remarks>
  119.            SynchronousWindowPosition = &H4000UI
  120.  
  121.            ''' <summary>
  122.            ''' Prevents generation of the WM_SYNCPAINT message.
  123.            ''' </summary>
  124.            ''' <remarks>SWP_DEFERERASE</remarks>
  125.            DeferErase = &H2000UI
  126.  
  127.            ''' <summary>
  128.            ''' Draws a frame (defined in the window's class description) around the window.
  129.            ''' </summary>
  130.            ''' <remarks>SWP_DRAWFRAME</remarks>
  131.            DrawFrame = &H20UI
  132.  
  133.            ''' <summary>
  134.            ''' Applies new frame styles set using the SetWindowLong function.
  135.            ''' Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed.
  136.            ''' If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
  137.            ''' </summary>
  138.            ''' <remarks>SWP_FRAMECHANGED</remarks>
  139.            FrameChanged = &H20UI
  140.  
  141.            ''' <summary>
  142.            ''' Hides the window.
  143.            ''' </summary>
  144.            ''' <remarks>SWP_HIDEWINDOW</remarks>
  145.            HideWindow = &H80UI
  146.  
  147.            ''' <summary>
  148.            ''' Does not activate the window.
  149.            ''' If this flag is not set, the window is activated and moved to the top of
  150.            ''' either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
  151.            ''' </summary>
  152.            ''' <remarks>SWP_NOACTIVATE</remarks>
  153.            DoNotActivate = &H10UI
  154.  
  155.            ''' <summary>
  156.            ''' Discards the entire contents of the client area. If this flag is not specified,
  157.            ''' the valid contents of the client area are saved and copied back into the
  158.            ''' client area after the window is sized or repositioned.
  159.            ''' </summary>
  160.            ''' <remarks>SWP_NOCOPYBITS</remarks>
  161.            DoNotCopyBits = &H100UI
  162.  
  163.            ''' <summary>
  164.            ''' Retains the current position (ignores X and Y parameters).
  165.            ''' </summary>
  166.            ''' <remarks>SWP_NOMOVE</remarks>
  167.            IgnoreMove = &H2UI
  168.  
  169.            ''' <summary>
  170.            ''' Does not change the owner window's position in the Z order.
  171.            ''' </summary>
  172.            ''' <remarks>SWP_NOOWNERZORDER</remarks>
  173.            DoNotChangeOwnerZOrder = &H200UI
  174.  
  175.            ''' <summary>
  176.            ''' Does not redraw changes.
  177.            ''' If this flag is set, no repainting of any kind occurs.
  178.            ''' This applies to  the client area, the nonclient area (including the title bar and scroll bars),
  179.            ''' and any part of the parent window uncovered as a result of the window being moved.
  180.            ''' When this flag is set, the application must explicitly invalidate or
  181.            ''' redraw any parts of the window and parent window that need redrawing.
  182.            ''' </summary>
  183.            ''' <remarks>SWP_NOREDRAW</remarks>
  184.            DoNotRedraw = &H8UI
  185.  
  186.            ''' <summary>
  187.            ''' Same as the SWP_NOOWNERZORDER flag.
  188.            ''' </summary>
  189.            ''' <remarks>SWP_NOREPOSITION</remarks>
  190.            DoNotReposition = &H200UI
  191.  
  192.            ''' <summary>
  193.            ''' Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
  194.            ''' </summary>
  195.            ''' <remarks>SWP_NOSENDCHANGING</remarks>
  196.            DoNotSendChangingEvent = &H400UI
  197.  
  198.            ''' <summary>
  199.            ''' Retains the current size (ignores the cx and cy parameters).
  200.            ''' </summary>
  201.            ''' <remarks>SWP_NOSIZE</remarks>
  202.            IgnoreResize = &H1UI
  203.  
  204.            ''' <summary>
  205.            ''' Retains the current Z order (ignores the hWndInsertAfter parameter).
  206.            ''' </summary>
  207.            ''' <remarks>SWP_NOZORDER</remarks>
  208.            IgnoreZOrder = &H4UI
  209.  
  210.            ''' <summary>
  211.            ''' Displays the window.
  212.            ''' </summary>
  213.            ''' <remarks>SWP_SHOWWINDOW</remarks>
  214.            ShowWindow = &H40UI
  215.  
  216.        End Enum
  217.  
  218.        ''' <summary>
  219.        ''' Specifies a special handle to the window to precede the positioned window in the Z order.
  220.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx
  221.        ''' </summary>
  222.        <Description("Enum used as 'hWndInsertAfter' parameter of 'NativeMethods.SetWindowPos' function")>
  223.        Friend Enum SpecialWindowHandles As Integer
  224.  
  225.            ''' <summary>
  226.            ''' Places the window at the top of the Z order.
  227.            ''' </summary>
  228.            Top = 0I
  229.  
  230.            ''' <summary>
  231.            ''' Places the window at the bottom of the Z order.
  232.            ''' If the hWnd parameter identifies a topmost window,
  233.            ''' the window loses its topmost status and is placed at the bottom of all other windows.
  234.            ''' </summary>
  235.            Bottom = 1I
  236.  
  237.            ''' <summary>
  238.            ''' Places the window above all non-topmost windows.
  239.            ''' The window maintains its topmost position even when it is deactivated.
  240.            ''' </summary>
  241.            TopMost = -1I
  242.  
  243.            ''' <summary>
  244.            ''' Places the window above all non-topmost windows (that is, behind all topmost windows).
  245.            ''' This flag has no effect if the window is already a non-topmost window.
  246.            ''' </summary>
  247.            NoTopMost = -2I
  248.  
  249.        End Enum
  250.  
  251. #End Region
  252.  
  253.    End Class
  254.  
  255. #End Region
  256.  
  257. #Region " Enumerations "
  258.  
  259.    ''' <summary>
  260.    ''' Specifies a screen corner.
  261.    ''' </summary>
  262.    <Description("Enum used as 'Corner' parameter of 'SetWindowPos' function")>
  263.    Friend Enum Corner As Integer
  264.  
  265.        ''' <summary>
  266.        ''' Top-Left screen corner.
  267.        ''' </summary>
  268.        TopLeft = 0I
  269.  
  270.        ''' <summary>
  271.        ''' Top-Right screen corner.
  272.        ''' </summary>
  273.        TopRight = 1I
  274.  
  275.        ''' <summary>
  276.        ''' Bottom-Left screen corner.
  277.        ''' </summary>
  278.        BottomLeft = 2I
  279.        ''' <summary>
  280.        ''' Bottom-Right screen corner.
  281.        ''' </summary>0
  282.        BottomRight = 3I
  283.  
  284.    End Enum
  285.  
  286. #End Region
  287.  
  288. #Region " Public Methods "
  289.  
  290.    ''' <summary>
  291.    ''' Set the position of a window.
  292.    ''' </summary>
  293.    ''' <param name="ProcessName">The process name.</param>
  294.    ''' <param name="Corner">The new window position, a screen corner.</param>
  295.    ''' <param name="Bounds">
  296.    ''' The screen <see cref="Rectangle"/> where the window is shown.
  297.    ''' If this parameter is empty, <see cref="Screen.PrimaryScreen"/> is used as default.
  298.    ''' </param>
  299.    Friend Shared Sub SetWindowPos(ByVal ProcessName As String,
  300.                                   ByVal Corner As Corner,
  301.                                   Optional ByVal Bounds As Rectangle = Nothing)
  302.  
  303.        Dim Rect As Rectangle  ' The specified screen bounds
  304.        Dim HWND As IntPtr     ' The process main window handle.
  305.        Dim Width As Integer   ' The process window width.
  306.        Dim Height As Integer  ' The process window height.
  307.        Dim x As Integer
  308.        Dim y As Integer
  309.  
  310.        If Bounds.IsEmpty Then
  311.            Bounds = Screen.PrimaryScreen.WorkingArea
  312.        End If
  313.  
  314.        ' Iterate the process instances.
  315.        For Each p As Process In Process.GetProcessesByName(FixProcessName(ProcessName))
  316.  
  317.            Try
  318.                ' Get the main window handle.
  319.                HWND = p.MainWindowHandle
  320.  
  321.                ' Copy the process window position and size into the Rectangle.
  322.                ' NOTE: This is not a bad practice, but 'GetWindowRect' function should use a Windows API 'RECT' structure.
  323.                NativeMethods.GetWindowRect(HWND, Rect)
  324.                Width = (Rect.Width - Rect.Left)    ' Set the window width
  325.                Height = (Rect.Height - Rect.Top) ' Set the window height
  326.  
  327.                Select Case Corner
  328.  
  329.                    Case SetWindowPosition.Corner.TopLeft
  330.                        x = Bounds.Left
  331.                        y = Bounds.Top
  332.  
  333.                    Case SetWindowPosition.Corner.TopRight
  334.                        x = Bounds.Right - Width
  335.                        y = Bounds.Top
  336.  
  337.                    Case SetWindowPosition.Corner.BottomLeft
  338.                        x = Bounds.Left
  339.                        y = Bounds.Bottom - Height
  340.  
  341.                    Case SetWindowPosition.Corner.BottomRight
  342.                        x = Bounds.Right - Width
  343.                        y = Bounds.Bottom - Height
  344.  
  345.                End Select
  346.  
  347.                ' Move the Main Window.
  348.                NativeMethods.SetWindowPos(HWND, New IntPtr(NativeMethods.SpecialWindowHandles.NoTopMost),
  349.                                           x, y, 0, 0,
  350.                                           NativeMethods.SetWindowPosFlags.IgnoreResize)
  351.  
  352.            Catch ex As Exception
  353.                Throw
  354.  
  355.            End Try
  356.  
  357.        Next
  358.  
  359.    End Sub
  360.  
  361.    ''' <summary>
  362.    ''' Set the position of a window.
  363.    ''' </summary>
  364.    ''' <param name="ProcessName">The process name.</param>
  365.    ''' <param name="X">The new X coordinate.</param>
  366.    ''' <param name="Y">The new Y coordinate.</param>
  367.    ''' <param name="Bounds">
  368.    ''' The screen <see cref="Rectangle"/> where the window is shown.
  369.    ''' If this parameter is empty, <see cref="Screen.PrimaryScreen"/> is used as default.
  370.    ''' </param>
  371.    Friend Shared Sub SetWindowPos(ByVal ProcessName As String,
  372.                             ByVal X As Integer,
  373.                             ByVal Y As Integer,
  374.                             Optional ByVal Bounds As Rectangle = Nothing)
  375.  
  376.        Dim Rect As Rectangle  ' The specified screen bounds
  377.        Dim HWND As IntPtr     ' The process main window handle.
  378.        Dim Width As Integer   ' The process window width.
  379.        Dim Height As Integer  ' The process window height.
  380.  
  381.        If Bounds.IsEmpty Then
  382.            Bounds = Screen.PrimaryScreen.WorkingArea
  383.        End If
  384.  
  385.        ' Iterate the process instances.
  386.        For Each p As Process In Process.GetProcessesByName(FixProcessName(ProcessName))
  387.  
  388.            Try
  389.                ' Get the main window handle.
  390.                HWND = p.MainWindowHandle
  391.  
  392.                ' Copy the process window position and size into the Rectangle.
  393.                ' NOTE: This is not a bad practice, but 'GetWindowRect' function should use a Windows API 'RECT' structure.
  394.                NativeMethods.GetWindowRect(HWND, Rect)
  395.                Width = (Rect.Width - Rect.Left)  ' Set the window width
  396.                Height = (Rect.Height - Rect.Top) ' Set the window height
  397.  
  398.                ' Move the Main Window.
  399.                NativeMethods.SetWindowPos(HWND, New IntPtr(NativeMethods.SpecialWindowHandles.NoTopMost),
  400.                                           x, y, 0, 0,
  401.                                           NativeMethods.SetWindowPosFlags.IgnoreResize)
  402.  
  403.            Catch ex As Exception
  404.                Throw
  405.  
  406.            End Try
  407.  
  408.        Next
  409.  
  410.    End Sub
  411.  
  412. #End Region
  413.  
  414. #Region " Private Methods "
  415.  
  416.    ''' <summary>
  417.    ''' Fixes the name of a process.
  418.    ''' </summary>
  419.    ''' <param name="name">The process name.</param>
  420.    ''' <returns>System.String.</returns>
  421.    Private Shared Function FixProcessName(ByVal name As String) As String
  422.  
  423.        If name.EndsWith(".exe", StringComparison.OrdinalIgnoreCase) Then
  424.            Return name.Remove(name.Length - ".exe".Length)
  425.        Else
  426.            Return name
  427.        End If
  428.  
  429.    End Function
  430.  
  431. #End Region
  432.  
  433. End Class

Saludos.
« Última modificación: 1 Octubre 2014, 14:39 pm por Eleкtro » En línea

FCOSTA

Desconectado Desconectado

Mensajes: 139


Ver Perfil
Re: CAMBIAR POSICION EN INICIO DEL PROGRAMA
« Respuesta #3 en: 1 Octubre 2014, 19:40 pm »

MUCHISIMAS GRACIAS ELEKTOR (ERES UN CRACK)

Efectivamente, yo no quiero que funcione minimizado sino que
corra completo, pero a un lado del monitor.

PERO AHORA TENGO UN PROBLEMA... JEJEJEJEJE
QUE SI SE PROGRAMAR ¡¡¡¡ EN VISUAL BASIC ¡¡¡¡¡

PERO de VISUAL BASIC. NET ¡¡¡NO TENGO NI IDEA¡¡¡¡

Si este programa lo tienes en Visual Basic me ira de pelicula.
Porque si lo tengo que traducir lo tengo negro.

De todas formas. Muchisimas gracias.
En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.788



Ver Perfil
Re: CAMBIAR POSICION EN INICIO DEL PROGRAMA
« Respuesta #4 en: 1 Octubre 2014, 21:34 pm »

Si este programa lo tienes en Visual Basic me ira de pelicula.
Porque si lo tengo que traducir lo tengo negro.

Aquí te lo he subido: http://www.mediafire.com/?c7bt666mw7wcwtu
La aplicación compilada la tienes en la carpeta ...\Bin\Debug

Método de empleo:
Código:
SetWindowPos.exe "Nombre del proceso.exe"

...y se posicionará en la esquina inferior derecha, eso sí, con cierto tipo de ventanas no funcionará, pero espero que no sea el caso xD.

saludos
En línea

FCOSTA

Desconectado Desconectado

Mensajes: 139


Ver Perfil
Re: CAMBIAR POSICION EN INICIO DEL PROGRAMA
« Respuesta #5 en: 2 Octubre 2014, 18:22 pm »

Lo siento Elektor pero no me funciona
NO hace nada. No me da error, Ni me dice que el fichero no existe. No dice nada. Ni hace nada. Es como si pulsara sobre un lugar de la pantalla donde no hay nada.

Te explicare lo que hice….
1.- Al tratar de instalarlo me dijo que necesitaba instalar el NET.Framework 4.0
2.- Lo descargue de la pagina de Microsoft
3.- Lo instale.
4.- Copie el fichero “SetWindowPos.exe” a mi carpeta raíz del disco C:\
4.- Me fui a la carpeta de Windows y copie también el fichero NOTEPAD.EXE a la carpeta raíz de mi disco (C:\) para que asi lo pudiera “ver” (C:\notepad.exe)
5 .- Cree un acceso directo en el escritorio que dice asi (C:\SetWindowPos.exe "notepad.exe").
6.- Y cuando pulso con el raton no hace nada de nada. Ni errores, ni nada.

No se que será.

Saludos
En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.788



Ver Perfil
Re: CAMBIAR POSICION EN INICIO DEL PROGRAMA
« Respuesta #6 en: 2 Octubre 2014, 18:40 pm »

No entendiste bien el funcionamiento @FCOSTA, te explico:

1) No es una aplicación gráfica, es una aplicación commandline, es decir, se ejecuta desde la consola con los parámetros que ya indiqué más arriba:

Método de empleo:
Código:
SetWindowPos.exe "Nombre del proceso.exe"

2) La aplicación busca el programa entre los procesos activos, no es necesario mover el archivo a la misma carpeta, simplemente asegúrate que el proceso esté en ejecución, como ya indiqué: Primero ejecutas el "notepad" (notepad, por decir algo) y luego la aplicación que te envié.

3) No le añadí al código ningúna verificación de errores que te pueda indicar si hubo algún error (como por ejemplo si el proceso no se encontró), esto es porque no lo he desarrollado de forma profesional debido a que no lo vi necesario, solo le añadí un par de instruccines básicas para que tomase el argumento que le debes enviar por consola para que te funcionase, nada más.
Asegúrate de utilizarla como es debido y todo debería ir bien :P



EDITO:
Un ejemplo Visual:




¿Lo entendiste ahora?, en pocas palabras, úsalo como si se tratase de un comando de Batch al que le pasas un parámetro, del mismo modo,
La idea es que ejecutes esa aplicación al mismo tiempo que ejecutas la aplicación que quieres mover, supongo que lo haces al inicio de Windows, pues eso, solo tienes que añadir una entrada más a la sección 'RUN' donde se define la ejecución de esos programas.

Ejemplo:

Código
  1. Windows Registry Editor Version 5.00
  2.  
  3. [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
  4. "SetWindowPos"="\"C:\\SetWindowPos.exe\" \"Nombre del Programa.exe\""

PD: Si sigues teniendo dificultades enviame el exe del programa que se pone en medio de la pantalla (y sus dependencias si tiene alguna para poder ejecutarlo) y te hago un apaño.

Saludos!
« Última modificación: 2 Octubre 2014, 18:54 pm por Eleкtro » En línea

FCOSTA

Desconectado Desconectado

Mensajes: 139


Ver Perfil
Re: CAMBIAR POSICION EN INICIO DEL PROGRAMA
« Respuesta #7 en: 2 Octubre 2014, 21:22 pm »

¡¡¡¡ MAGNIFICO ¡¡¡¡  CUANDO YO DIGO QUE ERES UN CRACK ME QUEDO CORTO……. ¡¡¡ FABULOSO ¡¡¡   ¡¡¡ FUNCIONA DE FABULA ¡¡¡

Perdoname Elektor por no haber entendido el funcionamiento a la primera. PERO AHORA FUNCIONA ….. Y además me funciona desde el Acceso Directo del Escritorio (No necesito hacerlo desde la consola).

Creo que el error estaba en que no sabia que el programa debía de estar funcionando ANTES de aplicar tu programa. MUCHAS GRACIAS.

OYE Crack…. ¿Y si te pido algo mas… puedo o no puedo?? JEJEJEJE

Veras tu programa va de fabula….. PERO LE ENCUENTRO UN pequeño defecto (o falta para mi)……

Veras. Tu programa hace lo que dice, o sea envía la pantalla al lado derecho abajo…. PERO ENVIA LA PANTALLA “ENTERA” . O sea te pone la pantalla COMPLETA del programa a la parte derecha. (Muy bien).

PERO si la pantalla de interface del programa es un poco grande, pues no has conseguido nada. El monitor sigue estando “ocupado”. ¿Me explico?.

Por ejemplo me explicare.
La interface de mi programa ocupa un 50% de la pantalla EN EL CENTRO del monitor. Y cuando le aplico tu programa sigue ocupando el 50% del monitor solo que a la derecha. No he ganado nada.

Yo lo que hago cada dia con el raton es ponerla a la derecha PERO DEJANDO SOLO A LA VISTA LOS DOS BOTONES QUE ME INTERESAN.  Y de este modo solo me ocupa un 8% (calculo) de la pantalla. ¿Me explico?. El resto del interface queda fuera del monitor.

¿Habria manera de que cambiando algunos parámetros de tu código pudiera hacer que la interface se posicionara donde quisiéramos. O sea que pudiera quedar en la parte derecha del tamaño que queramos? ¿Me explico?.

Lo ideal seria algo asi por ejemplo……

C:\SetWindowPos.exe "notepad.exe", 225,151,18,165

O sea que añadiendole unos números al comando, la pantalla de la interface se posicionara en un lugar o en otro de la pantalla.

Un muy cordial saludo Crack
Y muchas gracias 







 
En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.788



Ver Perfil
Re: CAMBIAR POSICION EN INICIO DEL PROGRAMA
« Respuesta #8 en: 3 Octubre 2014, 00:08 am »

¿Habria manera de que cambiando algunos parámetros de tu código pudiera hacer que la interface se posicionara donde quisiéramos. O sea que pudiera quedar en la parte derecha del tamaño que queramos? ¿Me explico?.

Lo ideal seria algo asi por ejemplo……

C:\SetWindowPos.exe "notepad.exe", 225,151,18,165

O sea que añadiendole unos números al comando, la pantalla de la interface se posicionara en un lugar o en otro de la pantalla.

Una cosa es pedir un favor y otra muy distinta es aprovecharse, si hubieras especificado al principio que además de mover la ventana también querías redimensionarla no me habría importado, pero si la gente pide ayuda y no comenta estos detalles solo consigue hacer perder el tiempo a los que pretenden ayudar.

Aquí tienes: https://www.mediafire.com/?cpb9pp90b6tuz2h

Sintaxis:
Código:
SetWindow programa.exe x y width height

Ejemplo:
Código:
SetWindow.exe "Notepad" 0 0 100 100

Comentaste que tienes conocimientos de programación de VB6, algo es algo, y te he enviado el source del programa que escribí para ti, así que si tienes cualquier otra duda o quieres implementar cualquier otro tipo de mejora o funcionalidad en el programa entonces puedes formular las preguntas en la sección de programación .NET donde gustosamente te indicaré los pasos a realizar y te ayudaré, pero lo harás tu, no yo.

Saludos!
« Última modificación: 3 Octubre 2014, 00:10 am por Eleкtro » En línea

FCOSTA

Desconectado Desconectado

Mensajes: 139


Ver Perfil
Re: CAMBIAR POSICION EN INICIO DEL PROGRAMA
« Respuesta #9 en: 3 Octubre 2014, 01:43 am »

Jolin... NO TE ENFADES POR FAVOR.
Has sido SUPER GENEROSO y SUPER ATENTO conmigo.
No te enfades, por favor.
Si en algo te he molestado te pido perdon de rodillas.

Solo dos preguntas....

1.- El codigo que dices que me has enviado ¿es en VB.NET o en VB6?

2.- Y no he recibido nada. Mi direccion de correo es:

"eco180@terra.com".

Muchisimas gracias, y te pido perdon por las molestias.

GRACIAS



 
En línea

Páginas: [1] 2 Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines