Click to See Complete Forum and Search --> : DX7 surfaces again :)
Artem
Mar 5th, 2001, 04:54 PM
When I am trying to create a surface with width more that 640 pixels, my program crashes. The height, however, does not crash my app even at 1024 pixels. The screen resolution is 640x480 pixels. Is there a limitation on how wide a surface could be? What can I do if I need to create, let's say, 800x600 surface?
Sastraxi
Mar 5th, 2001, 07:46 PM
Make sure you set it to be an OFFSCREEN PLAIN! :P
Heehehe! I am insane!
Sorry, I just got a sugar rush... :)
Yeah, thats probably it or there's a limitation, in which case you would want to divide the pic up, or make a picbox and grab the hDC to make a surface
drewski
Mar 5th, 2001, 07:51 PM
post some code so we can see it. you should be able to create surfaces that are much larger than 640x480. i do this in the map editor for my rpg. i have surfaces that are up to 4800x4800. somethings probably wrong with the code so post it here.
Drewski
Artem
Mar 6th, 2001, 03:21 PM
Here's the code that I use to create a surface from a file:
Public Sub LoadSurface(srfSurface As DirectDrawSurface7, strFileName As String, lWidth As Long, lHeight As Long)
On Local Error Resume Next
Dim ddGeneric As DDSURFACEDESC2
With ddGeneric
.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
.lWidth = lWidth ' <-- "invalid procedure call or argument", when 'lWidth is larger than 640
.lHeight = lHeight
End With
Set srfSurface = dd.CreateSurfaceFromFile(strFileName, ddGeneric)
If Err Then: Call EndIt
End Sub
drewski
Mar 7th, 2001, 12:05 AM
hey i think i might know your problem. make sure when you are setting the height and width of the surface that neither of them are equal to zero. this has happened to me before and it makes sense to have the height and width more than zero or else you wouldnt really have a surface.
if this doesnt fix your problem then i'm stumped. you could try asking Fox, Kedaman, or maybe Young Buck. these people seem to know what they are doing in this area. theres a few others out there just i cant recall their names.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.