Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

How to move/resize window using API?
[ All Languages » VB »  Shell]

Total Hit ( 5019)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
Private Const SWP_SHOWWINDOW = &H40
Private Const SW_HIDE = 0
Private Const SW_RESTORE = 9
Private Declare Function ShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
    ByVal lpFile As String, ByVal lpParameters As String, _
    ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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 Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_Load()
  Dim lngDesktop As Long, lngWidth As Long, retVal As Long
  lngDesktop = GetDesktopWindow
  retVal = ShellExecute(lngDesktop, vbNullString, "NOTEPAD.EXE", _
      vbNullString, "C:\", SW_RESTORE)
  If retVal < 0 Or retVal > 32 Then
    Sleep 100                     ' give time for window to be created
    retVal = FindWindow(vbNullString, "Untitled - Notepad")
    If retVal Then
      lngWidth = Screen.Width \ Screen.TwipsPerPixelX \ 2
      SetWindowPos retVal, Me.hwnd, lngWidth, 0, lngWidth, _
          Screen.Height \ Screen.TwipsPerPixelY, SWP_SHOWWINDOW
    End If
  End If
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.