G
Guest
I want to start an app, and at the same time control where it is placed. I
use the following code, but it doesn't seem to work. The MoveWindow call
doesn't move the window. What am I doing wrong? Isn't the shell function
supposed to return the handle to the window? Or is this just a process id
and
am I then supposed to make another call to translate this into a window
handle? Or what else is wrong?
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Sub MoveWindow Lib "User32" (ByVal hWnd As Long, _
ByVal X As Long, ByVal Y As Long, ByVal Width
As Long, _
ByVal Height As Long, ByVal bRepaint As
Boolean)
....
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim cProgram As String = "Notepad.exe"
Dim nHandle As Integer = Shell(cProgram)
MoveWindow(nHandle, 10, 10, 500, 300, True)
End Sub
End Class
Another question: Are there any calls inside the .net framework to support
this?
Any help appreciated
Peter
use the following code, but it doesn't seem to work. The MoveWindow call
doesn't move the window. What am I doing wrong? Isn't the shell function
supposed to return the handle to the window? Or is this just a process id
and
am I then supposed to make another call to translate this into a window
handle? Or what else is wrong?
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Sub MoveWindow Lib "User32" (ByVal hWnd As Long, _
ByVal X As Long, ByVal Y As Long, ByVal Width
As Long, _
ByVal Height As Long, ByVal bRepaint As
Boolean)
....
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim cProgram As String = "Notepad.exe"
Dim nHandle As Integer = Shell(cProgram)
MoveWindow(nHandle, 10, 10, 500, 300, True)
End Sub
End Class
Another question: Are there any calls inside the .net framework to support
this?
Any help appreciated
Peter