|
Hi ,
I need to bitblt some polygon - not rectangle
( i have it as CRgn ).
Probably there's somewhere modified BitBlt function that looks similar to that
[ccode]
BOOL BitBltRegion(
CDC* pDestDC,
int ptVertex[0].x ,
int ptVertex[0].y ,
CDC* pSrcDC,
CRgn reg,
DWORD dwRop );
[/ccode]
or somebody can give me a hint to write it myself
I'd very happy to know , or probably there's
another way ( masks ? )
Thank You
in advance
|
|
|
|
|
I think what you might want to do is create a polygonal region equivalent to the polygon you want to blit, then select that region as the clipping region of your destination device context.
If you blit the rectangle containing the polygon at the right coordinates after this clip region is set, it should to the trick. See CDC::SelectClipRgn.
|
|
|
|
|
Thank You , Tim , works great !
Just not to forget restore original clipping region after that ..
|
|
|
|
|
By the way , does it mean that if I want to work with DCs like with
layers , when u don't see some parts of picture under
topmost layer ( DC ) , u should do the same - use SelectClipRgn ?
|
|
|
|
|
Hmmm... don't know if I'd go that far - if you have a background DC that holds the entire screen, I'd just draw it on to that and blit a rectangle of whatever has changed to the screen DC.
If you have layers, maybe I'd still combine them in the background before blitting.
I posted a new article here that plays with this kind of stuff, but I'm not a games programmer so mine isn't going to be the best advice - I'm just trying to explore the mechanics at this stage.
|
|
|
|
|
I have an MFC CSocket application in Win 95. During runtime when I send data through the socket an ASSERT fails in the file sockcore.cpp at line 755, which reads:
ASSERT(m_hSocket == INVALID_SOCKET || CAsyncSocket::FromHandle(m_hSocket) != NULL);
When I ignore the error my data arrives just fine at the other end of the connection. Where does this error come from and how do I suppress it?
Thank you
LP
LP
|
|
|
|
|
Hi folx!
Does anybody know a way to adjust the line length in the debugging output window of vc6?
thnx a lot.
(Best Regards,)
Patrick Hoffmann
-------------------------------------------------------------------------------
Technical and Operations Manager, System Analyst, Software Architect
PGP: http://www.novacom.net/pgp/PatrickHoffmann.asc
-------------------------------------------------------------------------------
veturo, der kostenlose NOVACOM Routenplaner für Europa... http://www.veturo.de
--------------------------------------------+-----------------------------
|
|
|
|
|
Hi all,
I have question about data types ...
I want to know, does UINT variable is equal with long variable ? I mean is size ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
|
|
A UINT is absolutely not the same as a long. They're the same size, 4 bytes, but UINT is unsigned, whereas long is signed.
Also, the sizes may change in future versions of the compiler.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
His question was whether or not they (a UINT and a long) were the same size.
Yes, they are the same size (in our 32-bit world of VC6).
They were not the same size as a long in 16-bit, but who does 16-bit any more?
|
|
|
|
|
UINT is defined as unsigned int. The int type is different on different machine types. On Windows 32 bit it is 32 bits wide. long is well defined as a 32-Bit signed value on all machines. So int is not long! and UINT equals a unsigned long on a 32-Bit architecture. So on such a machine long equals UINT in that way, that both uses 32 bit (4 bytes). But long uses the highest bit for the +/- sign instead of UINT that has no sign.
(Best Regards,)
Patrick Hoffmann
-------------------------------------------------------------------------------
Technical and Operations Manager, System Analyst, Software Architect
PGP: http://www.novacom.net/pgp/PatrickHoffmann.asc
-------------------------------------------------------------------------------
veturo, der kostenlose NOVACOM Routenplaner für Europa... http://www.veturo.de
--------------------------------------------------------------------------
|
|
|
|
|
Thanks for your reply ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
I like to know how can I use the function:
OpenDocumentFile(FileName) in my CView class.
I have a bunch of files, and I like to use this function to open the files.
and each file has to be in a new document.
Thanks
Ehsan Behboudi
|
|
|
|
|
You can use AfxGetApp()->OpenDocumentFile( "filename.ext" );
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Thanks for you reply,,
the filePathName that I pass to the OpenDocumentFile( FilePathName)
is a Bitmap,
it opens an epmty document,, Can you have a look at my code Please..
Thanks
//My application is MDI, and I store a bunch of bitmap pathNames in the
// first docuemnt, pFirstDoc is a pointer to that document.
pApp->OpenDocumentFile(pFirstDoc->m_filePathArray.GetAt(0));
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
// or CMDIChildWnd *pChild = pFrame->MDIGetActive();
// Get the active view attached to the active MDI child
// window.
CTurboMechView *pView = (CTurboMechView *) pChild->GetActiveView();
pView->LoadBitmap(pFirstDoc->m_filePathArray.GetAt(0));
pView->OnPaint();
Any ideas???
Thanks
Ehsan Behboudi
|
|
|
|
|
What is the problem that you are experiencing?
BTW: Just curious;
> pApp->OpenDocumentFile(pFirstDoc->m_filePathArray.GetAt(0));
[snip]
> pView->LoadBitmap(pFirstDoc->m_filePathArray.GetAt(0));
Why load the bitmap twice? Maybe I dont understand what your doing, but when you call OpenDocumentFile does this not load the bitmap in your document?
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
When I call OpenDocumentFile, it only opens a blank document.
It doesn't display the bitmap.
but when I load it with my pointer to CView, it still won't display the bitmap.
any ideas?
Ehsan Behboudi
|
|
|
|
|
Hmmm... I think I'd have to take a look at what your view is doing. When you call LoadBitmap, I'm guessing the information is stored in the view, what does your painting(WM_PAINT) look like?
It sounds to me like your using the same doc/view pair the first one, and all the rest. Is this correct? If thats the way your doing it, you might consider just attaching a new view to the original document and loading the bitmap from there.
Sorry if I'm rambling... I'm not realy sure what it is your tring to do.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Thanks for replying
this is the whole deal,,
void CTurboMechView::OnToolsNewDocuemnt()
{
// TODO: Add your command handler code here
CWinApp* pApp = AfxGetApp();
CTurboMechDoc *pFirstDoc= GetFirstDocument();
pApp->OpenDocumentFile(pFirstDoc->m_filePathArray.GetAt(0));
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
//CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CMDIChildWnd *pChild = pFrame->MDIGetActive();
// Get the active view attached to the active MDI child
// window.
CTurboMechView *pView = (CTurboMechView *) pChild->GetActiveView();
pView->LoadBitmap(pFirstDoc->m_filePathArray.GetAt(0));
pView->OnPaint();
// so up there, I loaded the bitmap in the new View, but it still doesn't show it... weird !!!
}
This my OnPaint()
void CTurboMechView::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect lrec;
CTurboMechDoc* pDoc=GetDocument();
if(pDoc->m_sBitmap !="" /*&& showstate==TRUE*/)
{
ShowBitmap(&dc,lrec);
}
OnDraw(&dc);
// Do not call CScrollView::OnPaint() for painting messages
}
void CTurboMechView::LoadBitmap(CString file)
{
CTurboMechDoc* pDoc = GetDocument();
if(file!="")
{
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
if (hBitmap)
{
// Delete the current bitmap
if (m_bmpBitmap.DeleteObject())
{
m_bmpBitmap.Detach();
}
// Attach the currently loaded bitmap to the bitmap object
m_bmpBitmap.Attach(hBitmap);
}
Invalidate(FALSE); // you may change this to False
//NOTE:IMPORTANT I moved this showstate inside the if
}
}
void CTurboMechView::ShowBitmap(CDC *pdc, CRect trect)
{
BITMAP bm;
CDC dcMem;
CRect lRect=trect;
// Get the loaded bitmap
m_bmpBitmap.GetBitmap(&bm);
// Create a device context to load the bitmap into
dcMem.CreateCompatibleDC(pdc);
// Select the bitmap into the compatible device context
CBitmap* pOldBitmap = (CBitmap*)dcMem.SelectObject(m_bmpBitmap);
lRect.NormalizeRect();
width=bm.bmWidth;
height=bm.bmHeight;
pdc->StretchBlt(0, 0, width*2.28, height*2.28, &dcMem, 0, 0, 255, 255, SRCCOPY);
}
Ehsan Behboudi
|
|
|
|
|
hello
I have a trouble with Sending WM_VSCROLL/WM_HSCROLL message to a ListView
I send WM_XSCROLL to a control for scrolling the control
when i use
::SendMessage(hWnd, WM_HSCROLL, SB_LINELEFT, NULL);
it worked if hWnd is a CEdit handle or CListView handle.
this is send to a CEdit ctrl to scroll the window it works(picture)
this is send to a CListView to scroll the listview it works(picture)
BUT
when i send the drag scroll message to a listview ,it doesn't work
I use :
::SendMessage(hWnd, WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nPos) , NULL);
when the windows is a CEdit it works
it works(picture)
BUT when the windows is a CListView
it doesn't work(picture)
I use SPY++ finding the window have received the messages I sended
what's wrong??
HELP HELP
Leadream
I am Bruce
|
|
|
|
|
hello
I have a trouble with Sending WM_VSCROLL/WM_HSCROLL message to a ListView
I send WM_XSCROLL to a control for scrolling the control
when i use
::SendMessage(hWnd, WM_HSCROLL, SB_LINELEFT, NULL);
it worked if hWnd is a CEdit handle or CListView handle.
this is send to a CEdit ctrl to scroll the window it works(picture)
this is send to a CListView to scroll the listview it works(picture)
BUT
when i send the drag scroll message to a listview ,it doesn't work
I use :
::SendMessage(hWnd, WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nPos) , NULL);
when the windows is a CEdit it works
it works(picture)
BUT when the windows is a CListView
it doesn't work(picture)
I use SPY++ finding the window have received the messages I sended
what's wrong??
HELP HELP
Leadream
I am Bruce
|
|
|
|
|
hey, does anyone know how to delete a cookie in the temporary internet files folder? because they dont seem to act as files, i couldn't remove one with DeleteFile()
Thanks
Ku
|
|
|
|
|
Does anybody have any adice about learning MFC... I seem to have a hit a bit of a dead end lateley. Im using it lots but sometimes make stupid mistakes and cant realise how to do something. I understand the principles of most things, and quite a bit about messages etc but when I want to actually do something in code I always have so many problems working out the documentation etc an getting it to work. Ive been using the debugger more but 9 times out of 10 it drops us into the guts of MFC where its difficult to have a clue whats going on.... any advice appreciated!
|
|
|
|