TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: MARCO ALLARD
from: ALEXANDRE OSTANINE
date: 1997-04-05 20:23:00
subject: Bitmap in OWL?

Marco Allard wrote in a message to All:
 MA> Hello All,
 MA> Can anyone tell me how to use a bitmap in a little program?
 MA> I have to use OWL so it makes it even more difficult, I
 MA> guess... 
 MA> The Question is:  How do I define a bitmap, and how do I use
 MA> it in my program... (the bitmap is for example arcade.bmp
 MA> from c:\windows directory) 
 MA> I know how to do it with a homemade bitmap, but how do I do
 MA> it with an external one (that looks much much better than
 MA> mine)
 MA> Thx in advance,..
 MA> Marco
 MA> --- FMail 1.0g
there is few ways to do it..
. If you don't use  OWL inviroment you (or if you don't want to..)
still can use Windows API. there is enough functions to create,
use and destroy after, functions for it.
Try to finde information in HELP file on those functions names:
CreateCompatibleBitmap,CreateCompatibleDC,GetDC,SelectObject,
BitBlt, StretchBlt,LoadBitmap,(from resource ),
and the most powerfull is CreateDIBSection. It's when you got a
complete control on your bitmap.
And never forger that you still got one incredible tool:  Resourse WorkShop.
But for any cases :
OWL example of Setup and Destroy functions. 
variables : (defined before..)
    HDC BWDC;
    HBITMAP BWinBMP;
    HGDIOBJ LastBitmap;
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
void TMyWindow::SetupWindow()
{
 
  TFrameWindow::SetupWindow()  //(type of the class depends on you 
application)
  const int BMPsizeX = 100;
  const int BMPsizeY = 100;
  HDC WDC=GetDC(HWindow);
  BWDC=CreateCompatibleDC(WDC);
  BWinBMP=CreateCompatibleBitmap(WDC,BMPsizeX,BMPsizeY);
  LastBitmap=SelectObject(BWDC,BWinBMP);
  ReleaseDC(WDC,HWindow);
};
//############################################################################
#
void TMyWindow::EvDestroy()
{
   SelectObject(BWDC,LastBitmap);
   DeleteObject(BWinBMP);
   DeleteDC(BWDC);
   TFrameWindow::EvDestroy();
};
//############################################################################
#
Bye,
  Alexandre 
---
---------------
MA> * Origin: UAPoint 20 - Yeeeehaaaaa ! (2:292/628.20)
* Origin: Just another Selwerd point (2:282/608.74)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.