Link to home
Start Free TrialLog in
Avatar of b_harpal
b_harpal

asked on

bitmpas loading..using SetTimer..

hi,
i want to load  10 bitmaps.At the same position these bitmaps should come one after the other ..using SetTimer.it should form a loop.Bitmaps
are displayed full window..
Avatar of hiap_ho
hiap_ho

define a timer
#define IDC_TIMER   1000

define a message map
afx_msg void OnTimer(bla bla bla)

then make your function in OnTimer

In your main application use SetTimer(blablabla) <--- to set how long you want to wait before loading the next function.

More detailed explaination could be found in http://devcentral.iftech.com/Learning/tutorials/mfc-win32/vc6mfc/5.asp


ASKER CERTIFIED SOLUTION
Avatar of krisp
krisp

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of b_harpal

ASKER

hi Krisp,

  thanks for your answer.But somehow iam still not able to implement it fully.It's giving problems in the OnPaint() function.It would be kind of u if u can give the full code so that i can cross-check it & solve my problem. Your answer helped me solve 95% of my problem..
waiting for reply..

cheers..
Why don't you try the following code to draw the bitmap. Hope it will help :
width = the width of your screen in pixels
height = the height of your screen in pixels

      CBitmap cbmp;
      cbmp.LoadBitmap(IDB_BITMAP);
      HBITMAP Bmp;
      Bmp=(HBITMAP)cbmp;
      
      BITMAP bm;
      GetObject(Bmp, sizeof(bm), &bm);
      CPaintDC dc(this);
      HDC memdc = CreateCompatibleDC(NULL);
      HBITMAP h = (HBITMAP)SelectObject(memdc, Bmp);
      StrectchBlt(dc,0,0,bm.bmWidth,bm.bmHeight,memdc,0,0,width,height,SRCCOPY);  
      SelectObject(memdc, h);

I don't have any intention to cross krips, just trying to help, krips I hope you don't mind.
Hi b_harpal,

In the OnPaint() function, I used the following


CPaintDC dc(this);
int width = 150;
int hieght = 150;
int width1 = 0;
int hieght1 = 0;
HDC hMemDC = ::CreateCompatibleDC(NULL);
      SelectObject(hMemDC, hbitmap);
::StretchBlt(dc.m_hDC, 0, 0, width, hieght, hMemDC, width1, hieght1, 250,250, SRCCOPY);
::DeleteDC(hMemDC);
::DeleteObject(hbitmap);

If u want to increase the size, increase the values of width and hieght.

If u still have any problems,please be specific in ur problem(what error u r gettin?)and please do send queries if u have.

cheers.
hi krisp,
  ur simply expert..thanks.but i think u can help me much more.
iam making a HP-UX tutor as final year project.so please help me..i had to use animations,sounds..etc.it would be great help and kind of u if u could help me in some way..like providing me some links..hope u reply....if required u can mail me at bharpal@yahoo.com..once again thanks for ur support.

cheers
harpal
hi krisp,

this is my first time...i think there's some problem..it is showing 3 pts instead of 30..so please..check it out.
harpal