Loading a texture with D3DCreateTextureFromFile

I've been following a tutorial but he lost me when it got to loading textures so I wound up with this. I've been trying different ways and I've googled but with no luck. Any help would be much appreciated!

The build succeeds but this is still in the output:
1>d3d9.lib : warning LNK4003: invalid library format; library ignored
1>d3d9.lib : warning LNK4003: invalid library format; library ignored


Something about the Project>My window properties>Linker>Input>Additional dependencies.
I've got it set to: d3dx10.lib;d3d10.lib;%(AdditionalDependencies) on all configurations.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#define WIN32_LEAN_AND_MEAN //makes <windows.h> only include more nessecery functions
#include <windows.h> //needed when making a form
#include <d3dx9.h>
#include <d3d9.h>
#include <d3dx9tex.h>

#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

LPDIRECT3D9 gObject = NULL;
LPDIRECT3DDEVICE9 g_d3d_device = NULL;
LPDIRECT3DTEXTURE9 gTexture = NULL;

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); //windowproc

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	WNDCLASSEX WindowClass;

	//window settings
	WindowClass.cbSize = sizeof(WNDCLASSEX);
	WindowClass.style = CS_HREDRAW | CS_VREDRAW;
	WindowClass.lpfnWndProc = WindowProc;
	WindowClass.cbClsExtra = 0;
	WindowClass.cbWndExtra = 0;
	WindowClass.hInstance = hInstance;
	WindowClass.hIcon = 0;
	WindowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
	WindowClass.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
	WindowClass.lpszMenuName = 0;
	WindowClass.lpszClassName = "MyWindowClass";
	WindowClass.hIconSm = 0;

	RegisterClassEx(&WindowClass);

	if (D3DXCreateTextureFromFile(g_d3d_device, "charizard.jpg", &gTexture) != S_OK)
	{

	}
	else
	{
		g_d3d_device->SetTexture(0, gTexture);
	}

	HWND WindHandle = CreateWindowEx(NULL, "MyWindowClass", "Gaming", WS_OVERLAPPEDWINDOW, 0, 0, 300, 500, NULL, NULL, hInstance, NULL); //window handler, options for the window

	ShowWindow(WindHandle, nCmdShow); //shows the window
	UpdateWindow(WindHandle);

	MSG msg;

	while (GetMessage(&msg, NULL, 0, 0)) //checks for queued messages
	{
		TranslateMessage(&msg); //translates them and dispatches them
		DispatchMessage(&msg);
	}
	
	gTexture->Release();

	return (int)msg.wParam;
}

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_DESTROY : PostQuitMessage(0); //checks if you closed the window
		break;
	default : return DefWindowProc(hWnd, message, wParam, lParam); //all other messages are sent back
	}

	return 0;
}
Fixed the linker problems and an unhandled exception but I still can't get it to load the texture.
Topic archived. No new replies allowed.