a3deluxe Posted August 21, 2013 at 06:50 PM Report #522298 Posted August 21, 2013 at 06:50 PM 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
nelsonr Posted August 21, 2013 at 07:46 PM Report #522309 Posted August 21, 2013 at 07:46 PM O que é que esse readfiles faz?
Andrepereira9 Posted August 21, 2013 at 08:09 PM Report #522314 Posted August 21, 2013 at 08:09 PM Explica-te melhor A informática chegou para resolver problemas que antes não existiam Quem ri por último é porque está conectado a 52 Kbs.
a3deluxe Posted August 21, 2013 at 08:31 PM Author Report #522320 Posted August 21, 2013 at 08:31 PM Readfiles.exe e o programa da imagem e um progrma para ler ficheiros .cod
thoga31 Posted August 21, 2013 at 08:33 PM Report #522323 Posted August 21, 2013 at 08:33 PM Pois, mas continuamos sem perceber o que pretendes. Tens de te explicar melhor. Knowledge is free!
a3deluxe Posted August 21, 2013 at 09:12 PM Author Report #522329 Posted August 21, 2013 at 09:12 PM O numero incerido na numericdown corresponde ao numero da pasta que o Readfiles.exe vai usar para ler o ficheiro pwd.cod
Andrepereira9 Posted August 21, 2013 at 09:15 PM Report #522331 Posted August 21, 2013 at 09:15 PM qualquer coisa como Dim caminho_ficheiro as string = "F:\ler\" + variavel_com_numero_do_numericupdown + "\pwd.cod" A informática chegou para resolver problemas que antes não existiam Quem ri por último é porque está conectado a 52 Kbs.
nelsonr Posted August 21, 2013 at 09:16 PM Report #522332 Posted August 21, 2013 at 09:16 PM 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
a3deluxe Posted August 21, 2013 at 09:20 PM Author Report #522334 Posted August 21, 2013 at 09:20 PM (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 August 21, 2013 at 09:19 PM by a3deluxe
nelsonr Posted August 21, 2013 at 09:30 PM Report #522337 Posted August 21, 2013 at 09:30 PM E esse readfiles não aceita parametros? Tens mesmo de andar a simular cliques? Se for assim não vai ser simples
a3deluxe Posted August 21, 2013 at 09:33 PM Author Report #522338 Posted August 21, 2013 at 09:33 PM nao aceita. que parametros e que poderiam ajudar?
nelsonr Posted August 21, 2013 at 09:34 PM Report #522340 Posted August 21, 2013 at 09:34 PM O nome do ficheiro por exemplo
a3deluxe Posted August 21, 2013 at 09:43 PM Author Report #522341 Posted August 21, 2013 at 09:43 PM o nome do ficheiro ja definido no programa?
a3deluxe Posted August 22, 2013 at 11:10 AM Author Report #522391 Posted August 22, 2013 at 11:10 AM Algum pode dar mais uma ajudinha?
a3deluxe Posted August 23, 2013 at 09:10 AM Author Report #522458 Posted August 23, 2013 at 09:10 AM 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.
a3deluxe Posted August 23, 2013 at 01:08 PM Author Report #522491 Posted August 23, 2013 at 01:08 PM Correcção, ao Clicar no Botão ABRIR do programa Readfiles.exe aprece esta imagem: http://prntscr.com/1mx6pu ele já define o nome do ficheiro e a extensao a abrir, só falta o caminho. O que pode ajudar bastante.
a3deluxe Posted August 27, 2013 at 09:19 PM Author Report #522778 Posted August 27, 2013 at 09:19 PM Alguem para dar uma ajudinha? como posso saber as coordenadas do botao abrir?
thoga31 Posted August 27, 2013 at 10:19 PM Report #522781 Posted August 27, 2013 at 10:19 PM Se começasses a pesquisar um pouco, farias progressos. Button1.Location Knowledge is free!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now