Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

Chen XuNuo

@Chen XuNuo
About
Posts
86
Topics
26
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to use GetBitmapBits( ) correctly
    C Chen XuNuo

    I want to save a 24 bit bitmap's RGB data as a file.I firstly import it to resource editor. void CReadView::OnDraw(CDC* pDC) { CReadDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here int i,j; int counter=0; BYTE data[640*480*3]; CBitmap bmp; bmp.LoadBitmap(IDB_BITMAP1); bmp.GetBitmapBits(640*480*3,data); BITMAP bitmap; bmp.GetBitmap(&bitmap); for(i=0;i<bitmap.bmHeight;i++) for(j=0;j<bitmap.bmWidth;j++) { pDC->SetPixel(j,i, RGB(data[counter],data[counter+1],data[counter+2])); counter+=3; } } The result is not correct.:confused:

    C / C++ / MFC c++ graphics tutorial learning

  • How to end a thread
    C Chen XuNuo

    Thank you very much.The problem has been solved. :rose: :)

    C / C++ / MFC tutorial question

  • How to end a thread
    C Chen XuNuo

    I am going to be crazy..X| The problem still haven't been solved. UINT BulletGo(LPVOID pParam) { CBullet* bullet=(CBullet*)pParam; while(TRUE) { switch(bullet->GetDirection()) { case UP: bullet->GoUp(); break; case DOWN: bullet->GoDown(); break; case LEFT: bullet->GoLeft(); break; case RIGHT: bullet->GoRight(); break; } if(!bullet->m_bCanGo) break; else bullet->MoveWindow(bullet->GetPosition().x,bullet->GetPosition().y, bullet->GetThisRect().Height(),bullet->GetThisRect().Width()); Sleep(30); } return 0; } BOOL CBullet::GoDown() { if(m_rtParent.bottom==0) GetParent()->GetClientRect(&m_rtParent); if((m_ptPosition.y+m_rtThis.Height())<m_rtParent.bottom) { m_ptPosition.y+=6; m_bCanGo=TRUE; return TRUE; } else { m_bCreated=FALSE; m_bCanGo=FALSE; while( ::WaitForSingleObject(m_pThread->m_hThread,1) == WAIT_TIMEOUT) { Sleep(1); } delete m_pThread; this->DestroyWindow(); return FALSE; } } I destroy the window after ending the thread. Is the judgement: ::WaitForSingleObject(m_pThread->m_hThread,1) == WAIT_TIMEOUT right?If it is right,where is the problem.. :((

    C / C++ / MFC tutorial question

  • How to end a thread
    C Chen XuNuo

    I have found the error:I can't end the thread after destorying the window,right? ;P

    C / C++ / MFC tutorial question

  • How to end a thread
    C Chen XuNuo

    I set a breakpoint on "return 0" in the thread function.When the bullet hit the bottom of client rect,the appliction jump to the breakpoint,and I step over,the debugger doesn't pop up error dialog until execute to the line AfxEndThread(nResult) in function UINT APIENTRY _AfxThreadEntry(void* pParam). How do you think the two methods of conrol the enemies and bullets that one use threads and the other use timer in class?Which waste more CPU resource?

    C / C++ / MFC tutorial question

  • How to end a thread
    C Chen XuNuo

    Mmmm...I think if I draw the 'entities' with DC,I think the application would take large CPU resource,so I do it in thread.And I think using thread to control the enemies and the bullets easier. I will try you advice, thank you~

    C / C++ / MFC tutorial question

  • How to end a thread
    C Chen XuNuo

    Thank you for you advice.But it helps nothing to the problem... :sigh:

    C / C++ / MFC tutorial question

  • How to end a thread
    C Chen XuNuo

    The application pops up a dialog about error saying that Debug Assertion Failed! Program : D:\Code\TankGame\Debug\TankGame.exe File : wincore.cpp Line : 304 ......

    C / C++ / MFC tutorial question

  • How to end a thread
    C Chen XuNuo

    I am doing a TankGame program,and I write a CBullet class.I write a thread function to make it move when it is created: UINT BulletGo(LPVOID pParam) { CBullet* bullet=(CBullet*)pParam; while(TRUE) { switch(bullet->m_bCanGo.GetDirection()) { case UP: bullet->GoUp(); break; case DOWN: bullet->GoDown(); break; case LEFT: bullet->GoLeft(); break; case RIGHT: bullet->GoRight(); break; } if(!bullet->m_bCanGo) break; else bullet->MoveWindow(bullet->GetPosition().x, bullet->GetPosition().y, bullet->GetThisRect().Height(), bullet->GetThisRec().Width()); Sleep(30); } return 0; } int CBullet::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CStatic::OnCreate(lpCreateStruct) == -1) return -1; m_bCanGo=TRUE; m_pThread=AfxBeginThread(BulletGo,this); //begin thread return 0; } BOOL CBullet::GoDown() { if((m_ptPosition.y+m_rtThis.Height())>m_rtParent.bottom) { m_ptPosition.y+=2; m_bCanGo=TRUE; return TRUE; } else { this->DestroyWindow(); m_bCreated=FALSE; m_bCanGo=FALSE; return FALSE; } } When the bullet go down and hit the bottom of client rect the program apprear errors.Why...Don't the "break" in the BulletGo() end the thread?

    C / C++ / MFC tutorial question

  • BattleTank Game
    C Chen XuNuo

    I am doing a program which is BattleTank Game(I believe most people here have played it before:)).I want to ask that how the maps are impremented?How to do with the tile when I shoot bullets to the it? Appreciating your hints~

    IT & Infrastructure game-dev tutorial question

  • Small question
    C Chen XuNuo

    The computer I am using havn't been installed MSDN.I want to know that how to use CreatePolygonRgn(CONST POINT*,int,int).Could somebody send the information about the function in MSDN?Thank you. And is the function PtInRgn exist?I want to use the both function to judge if a point in a polygon region. Thanks for your help.

    C / C++ / MFC question help tutorial

  • About realize the function of selecting discretioal image
    C Chen XuNuo

    But the area is not a regular one... X|

    C / C++ / MFC graphics question

  • About realize the function of selecting discretioal image
    C Chen XuNuo

    But the section was selected by the mouse,so the section is not a rect.

    C / C++ / MFC graphics question

  • About realize the function of selecting discretioal image
    C Chen XuNuo

    Yes,I want to cut the section I select from the image.

    C / C++ / MFC graphics question

  • About realize the function of selecting discretioal image
    C Chen XuNuo

    In Windows' Drawing Tool,there is a funtion that is we can select the discretioal part of the image.How can it realize? Have I make a clear expression?;P I appreciate your hint.

    C / C++ / MFC graphics question

  • Where can I get msdn?
    C Chen XuNuo

    Hoho..Thanks a lot.What John said amazing me just now.:-D

    C / C++ / MFC question workspace

  • Where can I get msdn?
    C Chen XuNuo

    Where can I download msdn?What I downloaded can't be setup at all..:(( Thanks~

    C / C++ / MFC question workspace

  • Cut a bitmap under GDI+
    C Chen XuNuo

    I am not so familiar with GDI+,so I don't know that the code your provided can wheather achieve my purpose definitely.What I mean is the region in the bitmap is not necessarily a rect,it is mainly region that I draw with mouse.So it is a irregular region.Could you get it?;P

    C / C++ / MFC graphics question winforms

  • Cut a bitmap under GDI+
    C Chen XuNuo

    I want to cut a bitmap and save the selection I cut what is anomalistic under GDI+.Is there any program that I can refer to? Thanks.

    C / C++ / MFC graphics question winforms

  • Is there any technology for curing myopia?
    C Chen XuNuo

    Thanks,my English is not good enough,but I will work hard to improve it.:) Do someone know that in China there are many technologies for curing short sight,such as through looking at light in different frequency,tradional Chinese Medicine,but not effective to everybody.So I want to know that is there any new technologies for curing short sight.;)

    The Lounge question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups