|
-
May 8th, 2013, 11:42 PM
#9
Fanatic Member
Re: Automating Programs
just to ease your mind a little bit with win API its really not complicated, the worst part is thinking about how many handles are running in windows which could be millions, dont think like that, as long as you have a handle your good to go.
this is a small app that starts a program inside my own program look how easy it is.
dont forget the declarations
Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Const WM_SYSCOMMAND As Integer = 274
Private Const SC_MAXIMIZE As Integer = 61488
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
proc = Process.Start("IExplore.exe", "http:\\www.google.com -new")
System.Threading.Thread.Sleep(1000)
proc.WaitForInputIdle()
SetParent(proc.MainWindowHandle, Me.TableLayoutPanel1..Handle)
SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
End Sub
just google sendmessage api to get a list of the commands that you can send
Yes!!!
Working from home is so much better than working in an office...
Nothing can beat the combined stress of getting your work done on time whilst
1. one toddler keeps pressing your AVR's power button
2. one baby keeps crying for milk
3. one child keeps running in and out of the house screaming and shouting
4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
5. working at 1 O'clock in the morning because nobody is awake at that time
6. being grossly underpaid for all your hard work

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|