|
maybe it is some helpful to you
CPaintDC dc(this);
HDC hdc=CreateCompatibleDC(GetDC()->m_hDC);
int iWidth = GetSystemMetrics (SM_CXSCREEN) / 10;
int iHeight = GetSystemMetrics (SM_CYSCREEN) / 10;
HBITMAP hBit=CreateCompatibleBitmap(GetDC()->m_hDC,iWidth,iHeight );
SelectObject(hdc,hBit);
...
...
BitBlt(dc.m_hDC,0,0,iWidth,iHeight ,hdc,0,0,SRCCOPY);
|
|
|
|
|
if you want to show picture in the Dialog you can use
CImage m_Image;
m_Image.Load("c:\\picture.bmp");
OnPaint()
{
CPaintDC dc(this); // device context for painting
m_Image.BitBlt(dc.m_hDC,CRect(0,0,800,600),CPoint(0,0));
}
....else...........
HBITMAP hBit;
HDC hdc;
hdc=CreateCompatibleDC(GetDC()->m_hDC);
int iWidth = GetSystemMetrics (SM_CXSCREEN) / 10;
int iHeight = GetSystemMetrics (SM_CYSCREEN) / 10;
//hBit=CreateCompatibleBitmap(GetDC()->m_hDC,iWidth,iHeight );
HBITMAP hBit = (HBITMAP)::LoadImage(NULL,"c:\\picture.bmp",IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
SelectObject(hdc,hBit);
OnPaint()
{
CPaintDC dc(this); // device context for painting
BitBlt(dc.m_hDC,0,0,800,600,hdc,0,0,SRCCOPY);
}
maybe it is some helpful to you
|
|
|
|
|
Thank you for your reply so far. I just wanted to take the chance to explain my problem a bit further. I am trying to write a bitmap in memory. I just have an array of RGB values and am creating the CBitmap using CBitmap::CreateBitmap(width, height, 1, 32, imagedata). And it does work when I first select a file and read in the imagedata. However then when I select a new file (testing what happens if a user changes his mind for eample) and it then does not work. Why would the function SelectObject not change the current bitmap and just completely break down?
|
|
|
|
|
I update my vs2003 project to 2005, and then build it, got an error lnk2001 error LNK2001: unresolved external symbol "struct std::_DebugHeapTag_t const std::_DebugHeapTag" (?_DebugHeapTag@std@@3U_DebugHeapTag_t@1@B) globalchecker.lib
but I did not know why this happened. globalchecker.lib is successfully export by another project just with some warnings, and the globalchecker may use boost_1_33_1, I can not find any solution on google, any one knows?
Thanks!
Dilly
|
|
|
|
|
In the project properties, did you specify to link with that library ?
|
|
|
|
|
Oh, yes, I linked it.
Linker->command line contains "..\bind\common.lib" "..\bind\globalchecker.lib"
Dilly
|
|
|
|
|
Let me guess... You're project uses a static lib that was compiled in VS2003.
|
|
|
|
|
The globalchecker.lib was built by 2005 too.
I have try several method in msdn with LNK2001, but not worked.
Dilly
|
|
|
|
|
I installed both 2003 and 2005 in my computer.
I guess some envriment variable has been set ambiguously.
Dilly
|
|
|
|
|
I think you are right, I find another .lib file built by 2003 which the project need to use.
Thanks a lot.
Dilly
|
|
|
|
|
Hi,
I have taken dialog based application.When i run the application the dialog is displayed in default color.I want to change the Background color of the dialog to RED color .
thanks in before
jamesrocky
|
|
|
|
|
Handle WM_ERASEBKGND .
BOOL CDlg::OnEraseBkgnd(CDC* pDC)
{
CBrush backBrush(RGB(255, 0, 0));
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
CRect rect;
pDC->GetClipBox(&rect);
pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
PATCOPY);
pDC->SelectObject(pOldBrush);
return TRUE;
}
Nibu thomas
Software Developer
|
|
|
|
|
Sorry its not working, can be more clear..
thanks in before
Jamesrocky
|
|
|
|
|
Add a message map entry
BEGIN_MESSAGE_MAP(...,...)
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()
//just add the rest of the code here...
Nibu thomas
Software Developer
|
|
|
|
|
I think you can use WM_CTLCOLOR and declare a variable CBrush
|
|
|
|
|
You can call the SetDialogBkColor() . You can have a look at this.[^]
Thanks,
Vini
|
|
|
|
|
Hi
USe this in WM_CTLCOLOR
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
hbr = CreateSolidBrush(RGB(134,179,174));
pDC->SetBkColor(RGB(255,0,255)); // Pass the RGB of RED color
return hbr;
Cheers
"Peace of mind through Technology"
|
|
|
|
|
Hello, everyone!
I encounter a strange question.
I defined a singleton class like this:
static CMySocket& GetMySocket();
CMySocket& CMySocket::GetMySocket()
{
static CMySocket temp;
return temp;
}
In single thread, it works properly, but in Multi-thread, (I can ensure
in main thread, invoke CMySocket::GetMySocket first), when invoke GetMySocket
I get different instance , who can tell me , why?
Thanks a lot and best regards.
|
|
|
|
|
As i recall u need to declare a certain macro for a singleton class both when using it in a single threaded and apartment. try to look in the MSDN for DECLARE_CLASSFACTORY_SINGLETON macro.
hope this helps you
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote: try to look in the MSDN for DECLARE_CLASSFACTORY_SINGLETON macro.
that use to make COM Class SingleTon!
|
|
|
|
|
right!
if he isn't using COM, i suggest he use a protection (critical section) because if in multithreaded application both threads recquire an instance to the class, one should acquire a real one while the other acquire a false one.....
hope this helps
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
hi all,
is there a simple way to get as an input an english string i.e. "hello world" and then result a translated string say in russian/chinees/hebrew?
What I am looking for is that component for translating....? i know there are many programs that translates complete sites...just wondering what those program use?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote: i know there are many programs that translates complete sites...just wondering what those program use?
I very large word list!
Did you ever download one of those Translation applications? Didn't you ever wonder why it was so large?
If you are thinking of creating such a program there are many resources scattered over the internet. Try searching for word list and open source dictionaries. I recently developed an English/Chinese dictionary for a new PDA company in China. I used the open source CEDICT, with a few modifications I managed to create a reasonable app with 'enough' words at just under 3mb.
|
|
|
|
|
thanks for the reply.
i will search for word list as you suggested, chinese is very popular hopefully i will find my lingo as well
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hello everyone,
I have some questions about the keyword "__cdecl",
1. What is the function of this keyword? I read through the MSDN document, but still confused. Could anyone give me some brief and clear descriptions which are better than Microsoft?
2. If I am porting the source codes from Windows to Linux, does on Linux platform exist similar (or the same) keyword like __cdecl? How should I port source codes which has __cdecl keyword?
thanks in advance,
George
|
|
|
|