Jump to content

Recommended Posts

Posted

Boas,

Queria usar uma numericdown para fazer o seguinte:

1- Na numericDown1 , selecionar o numero a ser lido pelo programa em baixo.

2- Num Botão - Vai abrir o programa

//  
Shell("F:\Bin\S\Readfiles.exe", AppWinStyle.NormalFocus)

3- depois queria que executa-se o botão Abrir do programa em baixo

4- e depois abrir o ficheiro (F:\ler\1\pwd.cod) existente na pasta corespondente ao numero da Numericdown.

http://prntscr.com/1ml4w8

Na pratica queria fazer automaticamente a abertura dos ficheiros o que faco manualmente.

se tive-se a fonte do programa da imagem, era mais facil.

Acham possivel de se fazer?

Abracos

Posted

E tens controlo sobre esse Readfiles? É aquele que mostraste a imagem?

Caso seja, o que tens de fazer é executar esse ReadFiles.exe, indicando como parametro o número escolhido na dropdown.

No ReadFiles, ao ser executado, caso tenha algum parametro definido, abre logo o ficheiro

Usas isto para ver se a aplicação tem algum parametro

Dim parameters As String() = Environment.GetCommandLineArgs
If parameters.Length > 1 Then
' Abrir ficheiro
Dim ficheiro As String = "F:\ler\" & parameters(1) & "\pwd.cod"

MessageBox.Show(ficheiro)
End If
Posted (edited)

1-incerir o numero na numericdown correspondente a pasta a ser lida pelo readfiles.exe

2- abrir o readfiles.exe

3- executar o botao Abrir existente no Readfiles

4- abrir o caminho da pasta definida no numericdown

Nao tenho nenhum controlo no readlines

tambem nao tenho a fonte

tem que ser o passos todos como se fosse manualmente.

Edited by a3deluxe
Posted

Boas,

Com o código seguinte abro o Readfiles.exe e é colocado o cursor sobre o programa.

Como descubro as cordenadas onde esta o botão abrir?

//

Shell("C:\ReadS.exe", AppWinStyle.NormalFocus)

Public Class Form1
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Private Const MOUSEEVENTF_MOVE As Integer = &H1		  ' mouse move
Private Const MOUSEEVENTF_LEFTDOWN As Integer = &H2	  ' left button down
Private Const MOUSEEVENTF_LEFTUP As Integer = &H4		' left button up
Private Const MOUSEEVENTF_RIGHTDOWN As Integer = &H8	 ' right button down
Private Const MOUSEEVENTF_RIGHTUP As Integer = &H10	  ' right button up
Private Const MOUSEEVENTF_MIDDLEDOWN As Integer = &H20   ' middle button down
Private Const MOUSEEVENTF_MIDDLEUP As Integer = &H40	 ' middle button up
Private Const MOUSEEVENTF_WHEEL As Integer = &H800	   ' wheel button rolled
Private Const MOUSEEVENTF_ABSOLUTE As Integer = &H8000   ' absolute move

Private m_Target As New Point(200, 150)

Private Sub btnMoveClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMoveClick.Click
	' Convert the target to absolute screen coordinates.
	Dim pt As Point = Me.PointToScreen(m_Target)

	' mouse_event moves in a coordinate system where
	' (0, 0) is in the upper left corner and
	' (65535,65535) is in the lower right corner.
	' Convert the coordinates.
	Dim screen_bounds As Rectangle = Screen.GetBounds(pt)
	Dim x As Integer = CInt(pt.X * 65535 / screen_bounds.Width)
	Dim y As Integer = CInt(pt.Y * 65535 / screen_bounds.Height)

	' Move the mouse.
	mouse_event( _
		MOUSEEVENTF_ABSOLUTE + _
		MOUSEEVENTF_MOVE, _
		x, y, 0, 0)

	' Click there.
	mouse_event( _
		MOUSEEVENTF_ABSOLUTE Or _
		MOUSEEVENTF_MOVE Or _
		MOUSEEVENTF_LEFTDOWN Or _
		MOUSEEVENTF_LEFTUP, _
		x, y, 0, 0)
End Sub

' Draw an X where the user clicked.
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
	' Get the mouse position.
	Dim pt As Point = MousePosition()

	' Convert to screen coordinates.
	pt = Me.PointToClient(pt)

	Dim gr As Graphics = Me.CreateGraphics()
	gr.DrawLine(Pens.Blue, pt.X - 5, pt.Y - 5, pt.X + 5, pt.Y + 5)
	gr.DrawLine(Pens.Blue, pt.X + 5, pt.Y - 5, pt.X - 5, pt.Y + 5)
End Sub

Depois queria que o cursor fizesse um click sobe o botão ABRIR(onde estão as courdenadas.)

Posteriormente é adicionar o caminho do ficheiro pwd.cod a abrir e a Numericdown.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.