Results 1 to 6 of 6

Thread: Screen Resize Issues

  1. #1

    Thread Starter
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349

    Screen Resize Issues

    Hey Guys,
    I got some code from this forum to resize the screen to a specific size that i specify. I have attached the .bas file for your perusal. My problem is that i need the code to resize the screen to 1024x768 if the current size is smaller. The program is supposed to either resize the screen or abort execution if it cannot. This is the code i use to do it
    VB Code:
    1. Public Sub ResizeScreenTo1024()
    2.     Dim r As Integer
    3.    
    4.     'try to set the screen res here
    5.     'get the screen resolution and color depth
    6.     originalResolution = GetScreenResolution()
    7.     originalDepth = GetAvailableColours()
    8.    
    9.     xOriginalWidth = GetCurrentXSetting
    10.     yOriginalWidth = GetCurrentYSetting
    11.    
    12.     'try to change the resolution to 1024 x 768 with 32,24,16,8,4 until success
    13.     If (xOriginalWidth < 1024) And (yOriginalWidth < 768) Then
    14.         Call ChangeScreenSettings(1024, 768, 32)
    15.         If changeSuccessful = False Then
    16.             '32 failed, try 24
    17.             Call ChangeScreenSettings(1024, 768, 24)
    18.             If changeSuccessful = False Then
    19.                 '24 failed, try 16
    20.                 Call ChangeScreenSettings(1024, 768, 16)
    21.                 If changeSuccessful = False Then
    22.                     '16 failed, try 8
    23.                     Call ChangeScreenSettings(1024, 768, 8)
    24.                     If changeSuccessful = False Then
    25.                         '8 failed, try 4
    26.                         Call ChangeScreenSettings(1024, 768, 4)
    27.                         If changeSuccessful = False Then
    28.                             r = MsgBox("Your computer cannot operate this software.", vbCritical, "VideoVision 1.0")
    29.                         End If
    30.                     End If
    31.                 End If
    32.             End If
    33.         End If
    34.     End If
    35. End Sub

    Now what actually happens is that on some computers the screen doesn't actually change size, but the program begins execution, when it should abort. Also on some computers, the screen sometimes resizes and sometimes doesn't. Is it possible that this code is the cause of this? Or is it more likely to be an individual computer issue? If so, is there some more dynamic code to resize the screen of these computers?

    Hoping someone can help,

    Regards
    Attached Files Attached Files
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Hiya Blinky,

    I don't know what your ChangeScreenSettings() bit is, but you normally have to call on the EnumDisplaySettings() API call to tell which display modes the monitor supports before you attempt to change it.

    I've written a little module which might help you with this one & attached it below. The useage is like this :
    VB Code:
    1. Private Sub Form_Load()
    2.     ChangeScreenResolution "1024x768"
    3. End Sub
    Attached Files Attached Files

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    alex,
    I don't know if you actually looked at my bas file, but if you did you would see that it does use EnumDisplaySettings like you suggest it should. ChangeScreenSettings() is a function defined in my bas file to do exactly the same thing your code is supposed to do. What my real problem is, is that this code works 90% of the time without a problem, but on some computers it doesn't work at all - ie, the screen doesn't resize at all, but the program starts, when the calls to ChangeScreenSettings should not have set the changeSuccessful flag to True and therefore the final Else statement executed and the program aborted.

    So what is happening is this: The program is trying to change the size of the users screen. Somewhere down the path of attempts at colour depths, the change is flagged as successful and the program happily continues executing. But, the actual resizing of the screen has not taken place. Is it possible that these computers do not support any of these colour depths, but do support the resolution? Is it possible that the change is flagged as successful before the actual change takes place and that the change is actually a failure?

    Like i said, the code works perfectly in 90% of the computers it is run on, it is just some systems that have the problem. I develop on WinXP and the client systems that are having the problem are mainly Win98.

    Thanx for everyone's help.
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    ah, sorry, I completely missed your module there, I only looked at the code on the screen!

    I wouldn't have thought the windows version should make adifference as the api calls are for win95+ and winnt3.5+.

    Have you got a win 9x pc with vb on. I'm wondering if you compiled the exe & made the setup on this platform whether it'd work (just as an idea).

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5

    Thread Starter
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    I didn't think that the API's were very different at all my self, which is precisely why i didn't really worry about compatability with other OS's. I might try your idea of compiling on a Win98 system though, i know i should do testing on all platforms to check, but we don't actually have that many computers to test on here, and they are all WinXP.

    But, is it possible that it is a setup issue with the target computers and not the code itself? What i mean is that some of the target computers are Win98 and don't have a problem and others do and are also Win98. All i know is that WinXP works perfectly, so could it be a thing about Win98 1st edition versus 2nd edition?

    If anyone knows anything that might help,

    thanx in advance.
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  6. #6
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    To be honest I don't know, I think I've used that code in the past on nt & 98 without problems. Normally, Ms try to write their dll functions reasonably the same when they bring out a new os, so in theory any code we call (i.e. using the win32 api calls) are the same.

    Another issue could be the drivers I gess - if their graphics cards aren't installed properly, setup with the default vga drivers on have their irq / memory hardware conflicting, that's just another idea you might want to check if you have access to their machines.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

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