|
-
Feb 9th, 2002, 12:41 PM
#1
Thread Starter
Lively Member
move a application program window
I am using the API "CreateProcess" to launch the other application program. My program is using this method to launch the same program a few times, but the windows are stacked onto each other and the user may not see there are a few windows opened. I would like to move the window away or make it tile horizontally, how do I do it ?
here is my code;
VB Code:
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As Long, lpThreadAttributes As Long, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Do while loopcount < 6
RetVal = CreateProcess(vbNullString, _
ApplicationName, ByVal 0&, ByVal 0&, _
1&, NORMAL_PRIORITY_CLASS, ByVal 0&, vbNullString, _
startInfo6, processInfo6)
loopcount = loopcount + 1
loop
-
Feb 9th, 2002, 02:55 PM
#2
Frenzied Member
VB Code:
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const SWP_NOSIZE = &H1
Private Sub Form_Load()
SetWindowPos (hwnd of window to move), 0, (new left goes here), (new top goes here), 0, 0, SWP_NOSIZE
End Sub
-
Feb 17th, 2002, 10:49 AM
#3
Thread Starter
Lively Member
By the way, I came across with the Enumeration, could you please breifly explain what is the Enum means and what does this do ? Thanks (Tried search for MSDN, but could not get a clear picture)
-
Feb 26th, 2002, 01:03 PM
#4
Frenzied Member
Well, here's how Enums work.
You basically say:
{Public | Private} Enum name
ConstantName [ = value ]
End Enum
So for example:
Private Enum ConnectionTypes
ConnectionSynchronous = 374
ConnectionAsynchronous = 365
End Enum
Now you can say:
Dim CT AS ConnectionTypes
So when you type CT= you will get a little popup box that lets you choose ConnectionSynchronous or ConnectionAsynchronous.
Now ENUMS can be used other ways as well.
To make A = 1, B = 2, and so on:
Public Enum Alphabet
A
B
C
D
End Enum
Or you can make A = 34, B = 35, etc:
Public Enum Alphabet2
A = 34
B
C
D
E
End Enum
-
Mar 1st, 2002, 04:33 PM
#5
Basically, eumerations just encapsulate constants. For example:
VB Code:
Enum PlanetSize
Earth = 16384
Moon = 2298
Mars = 2576
Sun = 5850435
End Enum
Those are all ugly numbers, and it would be a pain to try to remember them all, right?
So instead of using:
You can simply use
VB Code:
Dim Size As PlanetSize
Result = Size.Earth * Size.Sun
A lot easier to remember, don't you think?
And, since enumerations are encapsulated, you can pass them through subroutines. So let's assume we have a subroutine as follows.
VB Code:
Function ReturnSize(Size1 As PlanetSize, Size2 As PlanetSize) As Long
ReturnSize = Size1 * Size2
End Function
We can easily pass values, that are part of the PlanetSize enumeration, like this:
VB Code:
Result = ReturnSize(Earth, Sun)
-
Mar 4th, 2002, 08:20 PM
#6
Thread Starter
Lively Member
Guys,
This mean a lot more to me. I learnt.
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
|