Welcome to Dream.In.Code
Become a VB Expert!

Join 137,208 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,290 people online right now. Registration is fast and FREE... Join Now!




Unable to load bitmap in directx8

 
Reply to this topicStart new topic

Unable to load bitmap in directx8

giuseppe105
16 Jul, 2008 - 08:38 AM
Post #1

New D.I.C Head
*

Joined: 15 May, 2008
Posts: 24


My Contributions
Aright guys I found a 400 page ebook that teaches you how to make your very own RPG in vb6 using directx8 it told me to get sp6 for vb6 and to get the directx8SDK I have both of them installed but when I run the program to load an image on the screen I get a local error and it displays "Critical error in LoadSurface!" there is no way of debugging this because if I take the error handler away vb just crashes instantly.

Here is the code for the LoadSurface Function
CODE
Private Function LoadSurface( _
ByVal filename As String, _
ByVal width As Long, _
ByVal height As Long) _
As Direct3DSurface8
On Local Error GoTo fatal_error
Dim surf As Direct3DSurface8
'return error by default
Set LoadSurface = Nothing
'create the new surface
Set surf = d3ddev.CreateImageSurface(width, height, dispmode.Format)
If surf Is Nothing Then
MsgBox ("Error creating surface!")
Exit Function
End If
fatal_error:
MsgBox ("Critical error in LoadSurface!")
Shutdown
End Function

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Unable To Load Bitmap In Directx8
16 Jul, 2008 - 08:55 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,004



Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Since you have your own error message in theire we have no way of knowing what the real error message is, thus making it impossible for us to determine a fix. To get the true error message change your fatal_error block to this


vb

fatal_error:
MsgBox ("Error: " & Err.Number & vbcrlf & "Description: " & Err.Description)



This will give you both the error number, and the actual error description that occurred smile.gif
User is online!Profile CardPM
+Quote Post

giuseppe105
RE: Unable To Load Bitmap In Directx8
16 Jul, 2008 - 09:41 AM
Post #3

New D.I.C Head
*

Joined: 15 May, 2008
Posts: 24


My Contributions
Thank you for the help but I put the code in and when I run the program I get

Error: 0
Description:

nothing more besides a "ok" button
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Unable To Load Bitmap In Directx8
16 Jul, 2008 - 09:47 AM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,004



Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Where did you find this tutorial? An error number of 0 (zero) means no error occurred
User is online!Profile CardPM
+Quote Post

giuseppe105
RE: Unable To Load Bitmap In Directx8
16 Jul, 2008 - 10:10 AM
Post #5

New D.I.C Head
*

Joined: 15 May, 2008
Posts: 24


My Contributions
I found it on scribd. I don't know if this is my main problem I didn't want to say anything because people might just jump the gun like I do. A long time ago maybe a year I wanted to play gears of war on my pc and it said I needed a newer graphics driver for my card but my card was at its last version since its old ati only lets a certain card get to a certain version my graphics card it sposto run at 6.4 version but I did some haxin on my card and I managed to get 8.4 on it my display went all wonky and i had weeks of problems when i plug my graphics card into a pc now it automatically loads up 8.4 drivers i have no clue what i did but now i cant play most games and i get alot of directX errors not only in programing but playing games. I have no clue of how to get 6.4 on my graphics card its not as simple as installing the drivers...

so what im thinking is that I did this to my card and now I broke alot of stuff and i get thease funky errors like the one we have here when installing carbon {I have played it on my pc with this graphics card} I get this funky error telling me I need directx0 or better and it dosent even install.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Unable To Load Bitmap In Directx8
16 Jul, 2008 - 10:19 AM
Post #6

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,004



Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
This indeed sounds like a hardware issue. It sounds as if your card no longer likes DirectX. When you said an error of zero was returned that let me know that this isn't an error with the code, it truly sounds like an issue with your card.
User is online!Profile CardPM
+Quote Post

giuseppe105
RE: Unable To Load Bitmap In Directx8
16 Jul, 2008 - 10:26 AM
Post #7

New D.I.C Head
*

Joined: 15 May, 2008
Posts: 24


My Contributions
you wouldn't happen to know a way of fixing my card or know someone who could help me fix my card would you?

And would you mind helping me with a previous topic I made yesterday ill give a link here its not a project its just a side thing I want to do I would appreciate it if you could help me on that.... thank you for the help biggrin.gif

RECT collision

This post has been edited by giuseppe105: 16 Jul, 2008 - 10:31 AM
User is offlineProfile CardPM
+Quote Post

Zeldo
RE: Unable To Load Bitmap In Directx8
18 Aug, 2008 - 10:02 AM
Post #8

New D.I.C Head
*

Joined: 18 Aug, 2008
Posts: 2

I thought I would like to point out that it isn't his hardware, but infact is his code

CODE
Private Function LoadSurface( _
ByVal filename As String, _
ByVal width As Long, _
ByVal height As Long) _
As Direct3DSurface8
On Local Error GoTo fatal_error
Dim surf As Direct3DSurface8
'return error by default
Set LoadSurface = Nothing
'create the new surface
Set surf = d3ddev.CreateImageSurface(width, height, dispmode.Format)
If surf Is Nothing Then
MsgBox ("Error creating surface!")
Exit Function
End If
exit function '---This is what I added, There was nothing to stop the function from executing the code, which results in a Err 0
fatal_error:
MsgBox ("Critical error in LoadSurface!")
Shutdown
End Function


That should work.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 01:06PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month