That code is full of win32 api and directX calls, at first glance I can tell you are using directX9 function to handle a texture, surely to use it you should see before the single prototypes of directX (that I don't know, since I don't develop videogame) ... definitely to initialize it you must use init.