|
Aescleal wrote: several surreal elements
The Salvador Dali of C++. Who knows, this code might be worth a fortune in, say, a 100 years?
|
|
|
|
|
There's a chance for some stuff I wrote years ago then! Does infinite looping make me Escher?
|
|
|
|
|
Pls send me a copy urgentzly, and I'll add it to the inheritance for my son!
|
|
|
|
|
I did black box testing, now does it make me like Picasso?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I think I would be less artist and more of an Alan Turing myself. Some of the algorithms I wrote required infinite computational power...
|
|
|
|
|
And 'infinite computational power' carefully sidesteps your algorithms...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hehe, you're quite right
|
|
|
|
|
How can i create word editor in c++?
Please Help me.
|
|
|
|
|
Have a look at the WordPad sample.
|
|
|
|
|
Hi All,
I am using a function foo() in "a.cpp" in Proj.lib
The function extern foo() is decalred in "b.h" in Proj.lib.
The extern foo() is defined in c.cpp in another Sample.dll
I am getting LNK2001:unresolved external symbol foo in a.obj..
How can i solve this ....
Thanks,
Hari
|
|
|
|
|
Put the name of the lib file corresponding to the library in which foo is defined in Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies .
|
|
|
|
|
Thats done ... i have added the lib in the Proj settings...
|
|
|
|
|
I have made that Proj setting changes and its still not working...
|
|
|
|
|
is the function being exported ? with __declspec(dllexport) ?
|
|
|
|
|
Yes i have used DLLExport and the issue is solved .. Thanks
|
|
|
|
|
hi everyone. i want to create a window which can zoom out from the center,but the window swung when i use MoveWindow/SetWindowPos to reposition and resize the window.
it was just like the situation below.
1:____[--]____ (original place)
2:___[--]_____ (rePosition) the right side of the window has gone astern
3:___[----]___ (reSize)
4:__[----]____ (rePosition)
5:__[------]__ (reSize)
6:_[------]___ (rePosition)
7:_[--------]_ (final place)
does anyone has the solution about that?
code as below.
void CWindowAnimateDlg::DrawBackground()
{
CDC* dc=this->GetWindowDC();
HDC hdcMemory=CreateCompatibleDC(dc->GetSafeHdc());
CRect rct;
GetWindowRect(&rct);
BITMAPINFO bmih;
ZeroMemory( &bmih, sizeof( BITMAPINFO ) );
bmih.bmiHeader.biSize = sizeof (BITMAPINFOHEADER) ;
bmih.bmiHeader.biWidth = rct.Width() ;
bmih.bmiHeader.biHeight = rct.Height() ;
bmih.bmiHeader.biPlanes = 1 ;
bmih.bmiHeader.biBitCount = 32;
bmih.bmiHeader.biCompression = BI_RGB ;
bmih.bmiHeader.biSizeImage = 0 ;
bmih.bmiHeader.biXPelsPerMeter = 0 ;
bmih.bmiHeader.biYPelsPerMeter = 0 ;
bmih.bmiHeader.biClrUsed = 0 ;
bmih.bmiHeader.biClrImportant = 0 ;
HBITMAP hBitMap;
hBitMap = CreateDIBSection (NULL, &bmih, 0, NULL, NULL, 0) ;
HBITMAP oldBitmap=(HBITMAP)SelectObject(hdcMemory,hBitMap);
Graphics gpc(hdcMemory);
gpc.SetCompositingMode(CompositingModeSourceCopy);
DWORD dwExStyle=GetWindowLong(m_hWnd,GWL_EXSTYLE);
SetWindowLongA(m_hWnd,GWL_EXSTYLE,dwExStyle|WS_EX_LAYERED);
HDC hdcScreen=::GetDC(m_hWnd);
CDC cdc;
cdc.Attach(hdcScreen);
CDC cdc2;
cdc2.Attach(hdcMemory);
if(m_bkImage)
{
gpc.DrawImage(
m_bkImage,
Rect(0,0,rct.Width(),rct.Height()),
0,0,m_bkImage->GetWidth(),m_bkImage->GetHeight(),
UnitPixel
);
}
POINT ptWinPos={rct.left,rct.top};
POINT ptSrc={0,0};
SIZE sizeWindow={rct.Width(),rct.Height()};
BLENDFUNCTION blend;
blend.BlendOp=0;
blend.BlendFlags=0;
blend.AlphaFormat=AC_SRC_ALPHA;
blend.SourceConstantAlpha=255;
UpdateLayeredWindow( &cdc,&ptWinPos,
&sizeWindow,&cdc2,&ptSrc,0,&blend,ULW_ALPHA);
::SelectObject(hdcMemory,oldBitmap);
ReleaseDC(dc);
gpc.ReleaseHDC(hdcMemory);
::ReleaseDC(m_hWnd,hdcScreen);
DeleteObject(hBitMap);
DeleteDC(hdcMemory);
hdcMemory=NULL;
}
void CWindowAnimateDlg::OnTimer(UINT_PTR nIDEvent)
{
switch(nIDEvent)
{
case 1:
{
CRect rect;
GetWindowRect(&rect);
CRect nRect;
int l,t,r,b;
l=m_targetRect.left-rect.left;
t=m_targetRect.top-rect.top;
r=m_targetRect.right-rect.right;
b=m_targetRect.bottom-rect.bottom;
nRect.SetRect(
rect.left+(l>0?l/5+1:l/5-1),
rect.top+(t>0?t/5+1:t/5-1),
rect.right+(r>0?r/5+1:r/5-1),
rect.bottom+(b>0?b/5+1:b/5-1)
);
if(
abs(l)<2&&
abs(t)<2&&
abs(r)<2&&
abs(b)<2
)
{
KillTimer(1);
MoveWindow(&m_targetRect);
break;
}
MoveWindow(&nRect);
}
}
CDialog::OnTimer(nIDEvent);
}
void CWindowAnimateDlg::OnWindowPosChanged(WINDOWPOS* lpwndpos)
{
CDialog::OnWindowPosChanged(lpwndpos);
if(!(lpwndpos->flags&SWP_NOSIZE))
DrawBackground();
}
void CWindowAnimateDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
if(m_state==1)
{
m_state=2;
m_targetRect.SetRect(550,300,650,400);
SetTimer(1,30,NULL);
}
else if(m_state==2)
{
m_state=1;
m_targetRect.SetRect(150,150,950,550);
SetTimer(1,30,NULL);
}
CDialog::OnLButtonDown(nFlags, point);
}
|
|
|
|
|
|
thanks for your reply.
but, AnimateWindow does not help i think.
i want to move the window from one Rect to another Rect smoothly.
|
|
|
|
|
and, why SetWindowPos make the window 'resize' and 'reposition' seperetely?
does anybody know?
thank you.
|
|
|
|
|
I guess it is because reposition and size lead both to a repaint of the window. You could use validaterect() or validatewindowrgn() (these are GDI-functions, look for GDI+ equivalents) after reposition so windows believes there's no need to repaint. Then repainting only occurs after size showing the reposition also.
Hope this will work...
|
|
|
|
|
|
it seems did not work with the solution below .
|
|
|
|
|
Hi,
I have used the code below to draw rotated text using DrawText.
//Draw rotated text
double Escapement = -401;
CString str = "Hello World";
CFont newFont;
newFont.CreateFont(24, 0, Escapement, Escapement, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
CFont* pFont = pDC->SelectObject(&newFont);
// draw the text
CSize TextSize = pDC->GetTextExtent(str);
CRect rect(0,0,TextSize.cx, TextSize.cy);
pDC->DrawText(str, str.GetLength(), rect, DT_CENTER);
Text is diplayed fine for non-rotated text. But for rotated text(ie, with Escapemnt != 0), the text appears to be clipped or sometimes not displayed at all. This is because the rect value is too restrictive for rotated text.
Please can someone help me to deduce the rect value correctly for rotated texts?
Regards
Mary
|
|
|
|
|
you might try using DrawText with the DT_CALCRECT flag
|
|
|
|
|
Yes I tried using DT_CALCRECT. But that isn't giving me a rotated rectangle.
|
|
|
|
|