Window resizing problems.

I have a VB6 app which queries an Oracle database, then links through to various other non VB applications with the data it has retrieved.  It links to another VB6 app, a lotus notes app and an Attachmate Extra! session.

The problem I have is that the Notes and Attachmate windows do not resize properly once linked to.  They will only take up three quarters of the screen and it is then impossible to maximise the window properly.

Below is some code to link to the Attachmate session.

   PrevHndl = FindWindow(vbNullString, sWindow)

   'Check for success.
    If PrevHndl <> 0 Then
        ' Move window
        MoveWindow PrevHndl, x, y, nWidth, nHeight, 1
        'Activate the application.
        result = SetForegroundWindow(PrevHndl)
    End If

    ShowWindow PrevHndl, 1

If objEuroSAP Is Nothing Then
        res = EnumWindows(AddressOf pfCallBack_EnumWindows, 0&)
        On Error Resume Next
        Set objEuroSAP = GetObject("c:\my documents\attachmate\" & Trim(gsSAPUser) & ".edp")
End If

Any ideas anyone?

Who is Participating?
LewyConnect With a Mentor Commented:
ShowWindow PrevHndl, SW_MAXIMIZE

deljonesAuthor Commented:
By the way, this does not happen on every PC that it is installed on......
Try doing a:

ShowWindow PrevHndl, 3

directly after the first call to ShowWindow. It should maximize the window properly.
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Hi ,
Why don't you try and set the resolution to the required one by calling APIs. Like you said, they run on some PCs. Check the resolution on those PCs and try....

deepakq: If I had to use a program that forced my screen-resolution to something else then what I set it to, it wouldn't survive my hard-disk any longer than the time it would cost you to say: "What do you want to uninstall today". Having your program force-change *any* user-settings can be considered the worst kind of programming that exists (unless it's a tool designed specifically to do that).

deljonesAuthor Commented:
Thanks for your comments.

As you say Jeremy, I can't really change the resolution of people's screens.  It is up to them.

I need the application to start 'Restored', as I still need to see my host application after the linked application is launched, so I can't really use your ShowWindow code.

I think it may be something to do with the 'Office Shortcut Bar' that is standard within my company.

deljonesAuthor Commented:
I have noticed if the Microsoft Office shortcut bar if on the left hand side of the screen, then the problem happens (but still not all the time).  If you move the shortcut bar from the side to the middle of the screen, then it seems to correct the problem.

Has anyone else encountered this?  Is there a way in code to correct this?


deljonesAuthor Commented:
Has anyone encountered problems with screens when maximised not taking up a full screen?  Possibly in conjuntion with the Microsoft Office Shortcut Bar.

Any ideas gratefully received.

deljonesAuthor Commented:
Adjusted points to 400
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.