a question about CreateTextureFromFileInMemory()

liulhack
06-22-2008, 12:32 AM
I want to use CreateTextureFromFileInMemory() to load a picture data.
so I do it like this:
---------------------------------
Dim tex as Direct3Dtexture8,data() as Byte,size as long
dim fn as long
…… ……
fn=FreeFile
open "test.png" for Binary as #fn
size=LOF(fn)
redim data(size-1)
Get #fn,,data()
Close #fn
set tex=m_D3dx.CreateTextureFromFileInMemory(m_Dev,data(0),size)
'But the line which includes CreateTextureFromFileInMemory tells me Automation-error
'please tell me why I am wrong and how to do it with vb6

DaftasBrush
06-22-2008, 04:40 AM
Hi there, and welcome....

The code you've posted "looks" OK.. so a few questions.

i) What Automation Error number is it giving you?
and / or
Check out this (http://www.xtremevbtalk.com/showpost.php?p=1142302&postcount=6).. useful for interpretting those nasty numbers.

ii) Have you stuck in a break point and checked that it's loading the data correctly?
Just before you run the CreateTexture line..
What is Size = ?
Does Data() have data in it?

iii) As a test... try using CreateTexturefromFile instead?
Does that work?

Let us know...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum