News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MAKEINTRESOURCE

Started by FlySky, October 18, 2006, 12:07:19 PM

Previous topic - Next topic

FlySky

Hey there guys,

I am not totally new too assembly but I knocked my head into a problem. I have created nice resource file for my little program. What I want to do is let the program load a bitmap from my resource file and than write that file into any dir on the system.

invoke GetSystemDirectory, addr systemdir, addr dirsize
invoke FindResource,hInstance,ID_BMP,RT_BITMAP
mov hRes,eax
.if hRes==NULL
invoke MessageBoxA,NULL,ADDR errormessage,ADDR errorcap,MB_OK
.endif
invoke LoadResource,NULL,hRes
mov hResourceLoaded,eax
invoke LockResource,hResourceLoaded
mov pResLock,eax
invoke SizeofResource,NULL, hRes
invoke CreateFile,addr NameofBMP,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL

Now when I start my project it says it can't find my resource file what is wrong with my code? It seems 100 % right too me.

The BMP stuff is only for a test I want to get an MP3 written into a directory from my resource file.

But the FindResource API does not support MP3 types. So I was reading about MAKEINTRESOURCE, but I can't figure out how to use that in ASM.

Thanks for the help guys.

FlySky

Hey there guys, I just found out what a dumbass I were. The only problem remaining is it does not write my file.

I have this api
UINT GetSystemDirectory(

    LPTSTR lpBuffer,   // address of buffer for system directory
    UINT uSize    // size of directory buffer
   );   

is it correct to say that my address of buffer = C:\GAMES for example

and the size of the directory = MAX_PATH??

Ehtyar

MAX_PATH is defined in windows.inc, shouldn't be too much trouble to find :U
As for placing an mp3 in resources, use the RT_RCDATA resource type. And it would also be very offensive to some people for you to write an mp3 of all things to the system directory, i would suggest GetTempPath and GetTempFileName.
Any path you have in a varible should be of MAX_PATH size.
ASM does not use the MAKEINTRESOURCE macro, i think you're getting a little confused.
Now i see a second posting here, so ill attach the memplay example. It should show you all you need to know (note: it's not written by me, but i should be able to answer any of your questions about it, if any).

Regards, Ehtyar.

[attachment deleted by admin]

FlySky

Thank you very much Ehtyar, that MAKEINTRESOURCE was confusing me yeah;), I have things working now, thanks for the example.

Ehtyar

As a beginner, it is awfully difficult to filter through all the hll bulls**t you find on msdn. Really the only way of getting through it, is using forums and google.

Glad i could help, Ehtyar.