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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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....

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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
ShowWindow PrevHndl, SW_MAXIMIZE


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.