Hi friends,
Here is a demo program displaying a bitmap from file without using the conventional Win32 resource system.
Here is another version using my CreateBmpFromMem function.
hBitmap=CreateBmpFromMem(hwnd,pBitmap);
Sorry I forgot to login, the guest was me :)
The DC created by CreateBmpFromMem was not released at the exit of the application - bug fixed.
CreateBmpFromMem function translated to POASM
Hallo Vortex!
I would like to learn, howto include asm files in an Pelles C projekt. So I played a little with your example. I have removed the depandencies from other crts.
I get the following error while building the project:
Building Bmpfile.obj.
Building BmpMem.obj.
*** Error: -W0 -Cu -Fo"E:\c\src\bmp\output\BmpMem.obj" "E:\c\src\bmp\BmpMem.asm"
*** Error: file not found.
Done.
Shouldn't there be 'poasm' in front of the command line?
Is the ide able at all to compile the asm file automatically?
czerny
Edit: I found it!
The make macro AS was empty and the ASFLAGS -W0 and -Cu were wrong.
May be you have used an other assembler? What should the above switches do?
Another question!
the file 'BmpMem.obj' is created in the output directory, like other obj-files.
But ...
Building Bmpfromfile.exe.
POLINK: fatal error: File not found: 'BmpMem.obj'.
*** Error code: 1 ***
Done.
If I copy the file in the project root directory, I get ...
Building Bmpfromfile.exe.
POLINK: error: Symbol '_CreateBmpFromMem@12' is multiply defined: 'BmpMem.obj' and 'E:\c\src\bmp\output\BmpMem.obj'.
*** Error code: 1 ***
Done.
Thats funny! In the first step it couldn't find it at all. Now it finds it twice!
Is it possible to solve this puzzle without expanding the lib path?
czerny
Hi czerny,
Here is the project updated with Pelles C V7. Removing the assembly module from the library and object files line solved the problem. Now, the assembly code is a member of the project files. It's assembled with Poasm. The original example from 2006 has probably an outdated .ppj file.
Thank you!
Hi czerny,
Rewriting CreateBmpFromMem in C :
HBITMAP __stdcall CreateBmpFromMem( HWND hwind , LPVOID pImg , HDC* tempDC)
{
HDC hdc;
char *bmpheader = (char *)pImg + sizeof(BITMAPFILEHEADER);
LPVOID lpbInit = (LPVOID)((int)pImg + ((LPBITMAPFILEHEADER)pImg)->bfOffBits) ;
hdc=GetDC(hwind);
*tempDC=hdc;
return (CreateDIBitmap(hdc,
(LPBITMAPINFOHEADER)bmpheader,
CBM_INIT,lpbInit,
(LPBITMAPINFO)bmpheader,
DIB_RGB_COLORS));
}