Results 1 to 8 of 8

Thread: Why the forms gets transformed when in game and not restored back when in desktop?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Why the forms gets transformed when in game and not restored back when in desktop?

    I have an application that must works in background of a gamming enviroment.

    The problem by example, I have some window sized like 1000x400,

    continuing with the example, run a game that switch to 800x600 truecolor video mode. Ok?

    now, when the game is closed, all my VB forms are CLIPPED to 800 width visualy.

    why it happens?, what have to do any low resolution games old or new, with VB desktop apps anyway?

    how to fix this issue, is there a way to know using an event when the screen resolution is changed? or I must test screen size each second.

    It is a full resize reflecting it on the width/height properties? or it is like a windows bug or something?

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Why the forms gets transformed when in game and not restored back when in desktop

    Probably a game bug. They are supposed to use a custom Desktop and not change the resolution on the default Desktop.

    If the same thing happens to other programs (Notepad, etc.) I think you're stuck.

  3. #3
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Why the forms gets transformed when in game and not restored back when in desktop

    You could try subclassing your Form and watching for WM_DISPLAYCHANGE messages.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: Why the forms gets transformed when in game and not restored back when in desktop

    But is normal behavior, I mean, by example, you can't create a VB FORM Large than the screen resolution, WHY??????? how can be.!

    if then the screen resolution changes , all forms gets clipped, I mean it is the usual, I always had that problem, in any VB app.

    Atleast in WinXP.

    Only that right now I am tired about that *misbehaviour* and want to fix it in a particular APP for gamers.

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Why the forms gets transformed when in game and not restored back when in desktop

    Quote Originally Posted by Bonnie West View Post
    You could try subclassing your Form and watching for WM_DISPLAYCHANGE messages.
    Or just use the SysInfo Control and its DisplayChanged Event which does the same thing w/o manually subclassing.

  6. #6
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Why the forms gets transformed when in game and not restored back when in desktop

    Code:
    Select Case uMsg
        Case WM_EXITSIZEMOVE
            'Save the Form's newest position and size
    
        Case WM_DISPLAYCHANGE
            'If Form.WindowState = vbNormal Then
            'restore previous position and size,
            'but only if screen dimensions allow
    End Select
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: Why the forms gets transformed when in game and not restored back when in desktop

    Testing, I thinks are more a thing when you are in 1024x768 destop, execute counter strike 1.6, it switch 800x600, then exits sometimes it don't restore th desktop correctly (only the monitor is switch back to 1024x768).

    So it happens sometimes, not always.

    Buy anyway, why when you create & resize VB forms, they are limited to the screen resolution as maximun size?

    OLD Tries: I remember sometime, I was thinking in creating a big BIG in width vb form. And to do an effect like a slider related to the mouse position, so VBform.LEFT must go from = -me.width/2 to me.width/2, was something like that, but impossible to create large vbforms without borders, titlebar etc. that slides/hides from the upper part, and slides horizontally. Dropped the idea by that reason.

    Anyway stupid approach, but again, why a limit?
    Last edited by flyguille; Apr 9th, 2013 at 03:45 PM.

  8. #8
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Why the forms gets transformed when in game and not restored back when in desktop

    Quote Originally Posted by flyguille View Post
    Buy anyway, why when you create & resize VB forms, they are limited to the screen resolution as maximun size?

    ... but again, why a limit?
    From GetSystemMetrics function:

    SM_CXMAXTRACK
    59
    The default maximum width of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message.
    SM_CYMAXTRACK
    60
    The default maximum height of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message.

    From MINMAXINFO structure:

    ptMaxTrackSize
    Type: POINT

    The maximum tracking width (x member) and the maximum tracking height (y member) of the window. This value is based on the size of the virtual screen and can be obtained programmatically from the system metrics SM_CXMAXTRACK and SM_CYMAXTRACK (see the GetSystemMetrics function).
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

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