Results 1 to 7 of 7

Thread: Maximaze Notepad

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    I have searched this site for this subject already and found nothing related.

    Anyone knows how to maximize a minimized "notepad"
    Chemically Formulated As:
    Dr. Nitro

  2. #2
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    How about WinApi SetWindowPos?

    Zaf

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Hello Zaf!

    Long time no talk to. I sent you an email the other day but you didnot reply. Anyway, tried that API already and could not get notpad to maximize.

    Pretty sure I am using it right.
    Chemically Formulated As:
    Dr. Nitro

  4. #4
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    Hey Nitro, how goes it?

    Are you opening Notepad or is it already open? If you're opening it just specify maiximized when you open it, this should work no problem. If it is already opened then use the ShowWindow API:
    Code:
    Private Const SW_HIDE As Long = 0
    Private Const SW_SHOWNORMAL As Long = 1
    Private Const SW_SHOWMINIMIZED As Long = 2
    Private Const SW_SHOWMAXIMIZED As Long = 3
    Private Const SW_SHOWNOACTIVATE As Long = 4
    Private Const SW_SHOW As Long = 5
    Private Const SW_MINIMIZE As Long = 6
    Private Const SW_SHOWMINNOACTIVE As Long = 7
    Private Const SW_SHOWNA As Long = 8
    Private Const SW_RESTORE As Long = 9
    Private Const SW_SHOWDEFAULT As Long = 10
    
    Private Declare Function ShowWindow _
                    Lib "user32" _
                    (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Just call ShowWindow with the handle to the instance of Notepad that you want to maximize and the constant SW_SHOWMAXIMIZED.

    If this doesn't work then somebody has messed with you base co-ordinates on your computer. If this is the case then you'll have to use SetWindowPlacement. Let me know if this works or if you need me to elaborate some more.

    Later.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Thanks Zaf and SonGouki(Dan)!

    I appreciate your help.

    Dan, you sure did the job.

    BTW... What does "SetWindowPlacement" do?

    Here is the code for those who needs to maximize a foreign application when it is minimized. Give the credit to SonGouki.

    Code:
    Option Explicit
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    
    Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Private Const SW_HIDE As Long = 0
    Private Const SW_SHOWNORMAL As Long = 1
    Private Const SW_SHOWMINIMIZED As Long = 2
    Private Const SW_SHOWMAXIMIZED As Long = 3
    Private Const SW_SHOWNOACTIVATE As Long = 4
    Private Const SW_SHOW As Long = 5
    Private Const SW_MINIMIZE As Long = 6
    Private Const SW_SHOWMINNOACTIVE As Long = 7
    Private Const SW_SHOWNA As Long = 8
    Private Const SW_RESTORE As Long = 9
    Private Const SW_SHOWDEFAULT As Long = 10
    
    
    Sub Main()
        Dim lng_A As Long
        lng_A = FindWindow("NotePad", vbNullString)
        Call ShowWindow(lng_A, SW_SHOWMAXIMIZED)
    End Sub
    Chemically Formulated As:
    Dr. Nitro

  6. #6
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Hi Nitro, The SetWindowPlacement API is good for controling the movement of the form the Declaration of the WINDOWPLACEMENT structure is a bit wierd in the API Viewer

    instead of
    Code:
    Public Type WINDOWPLACEMENT
            Length As Long
            flags As Long
            showCmd As Long
            ptMinPosition As POINTAPI
            ptMaxPosition As POINTAPI
            rcNormalPosition As Rect
    End Type
    try this

    Code:
    Public Type WINDOWPLACEMENT
            Length As Long             'Don't know what this does
            flags As Long              'I reckon this used a combination of the SWP_ flage that setwindowpos uses but I'm not sure 
            showCmd As Long            'Uses the SW commands, like showwindow
            rcBoundingRect as Rect     'The top left hand corner of the window cannot leave this rectangle when the window is being moved with the mouse
            rcNormalPosition As Rect   'the windows rectangle as with get/set windowrect
    End Type
    I havn't used it too much, it's useful for showing the window and putting it in the right position in one step rather than seing it pop up and then move, it's also good for restricting the position of a window without subclassing.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Like always!

    Thanks again Mr. Sam!
    Chemically Formulated As:
    Dr. Nitro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width