|
Hi,
I have property sheet wizard application and I am repaining its title bar and creating new minimize and close button on title bar. The following codes are doing things ok. but when i try to right click on task bar button( applications task bar button - close/minimize application from system menu) minimize and close button is not repinted as expected. The codes are
void CSamplePaintSheet::OnNcPaint()
{
CWindowDC dc( this );
ModifyStyle(NULL,WS_SYSMENU|WS_MINIMIZEBOX);
Default();
ReDrawCaptionBar( &dc );
ReleaseDC( &dc );
}
BOOL CSamplePaintSheet::OnNcActivate( BOOL bActivate )
{
OnNcPaint();
return TRUE;
}
void CSamplePaintSheet::ReDrawCaptionBar(CDC *pDC )
{
CRect rc;
this->GetWindowRect( rc );
ScreenToClient( rc );
rcCap = rc;
rcCap.bottom = ::GetSystemMetrics( SM_CYCAPTION ) +
::GetSystemMetrics( SM_CYFIXEDFRAME );
rcCap.right += ::GetSystemMetrics( SM_CXFIXEDFRAME );
CString szTitle(_T("Sample Paint Application"));
SetWindowTextW( szTitle );
CBrush brSolid( CLR_GRAY );
pDC->FillRect( &rcCap, &brSolid );
CRect rcLeft( rc );
rcLeft.top = rcCap.bottom;
rcLeft.right = ::GetSystemMetrics( SM_CXFIXEDFRAME );
rcLeft.bottom = rc.Height();
pDC->FillRect( &rcLeft, &brSolid );
CRect rcRight( rc );
rcRight.left = rcCap.right - ::GetSystemMetrics( SM_CXFIXEDFRAME );
rcRight.top = rcLeft.top;
rcRight.right = rcCap.right;
rcRight.bottom = rcLeft.bottom;
pDC->FillRect( &rcRight, &brSolid );
CRect rcBottom( rc );
rcBottom.left = rcLeft.left;
rcBottom.top = rcRight.bottom - ::GetSystemMetrics(SM_CYFIXEDFRAME) -
nBottomBorderHeight;
rcBottom.right = rc.Width();
rcBottom.bottom = rcRight.bottom;
pDC->FillRect( &rcBottom, &brSolid );
CSize sizeText = pDC->GetTextExtent( szTitle );
int nCy = HIWORD( ::GetDialogBaseUnits() );
rcText = rcCap;
rcText.left = ::GetSystemMetrics( SM_CYFIXEDFRAME );
rcText.right = rcText.left + ( sizeText.cx );
rcText.top = (rcCap.bottom - (nCy + 1))/2;
rcText.bottom = rcText.top + nCy + 1;
pDC->SetBkMode( TRANSPARENT );
pDC->DrawText( szTitle, rcText, DT_LEFT | DT_SINGLELINE );
rcBtClose = rc;
rcBtClose.top = ::GetSystemMetrics( SM_CYFIXEDFRAME )+ 3;
rcBtClose.right = rcBottom.right - ::GetSystemMetrics( SM_CXFIXEDFRAME );
rcBtClose.left = rcBtClose.right - ::GetSystemMetrics( SM_CXSIZE ) + 8;
rcBtClose.bottom = ::GetSystemMetrics( SM_CYSIZE )- 3;
if( bBtClose )
{
pDC->DrawFrameControl
(rcBtClose,DFC_CAPTION,DFCS_CAPTIONCLOSE|DFCS_HOT );
}
else
{
pDC->DrawFrameControl
(rcBtClose,DFC_CAPTION,DFCS_CAPTIONCLOSE|DFCS_INACTIVE );
}
rcBtMin = rcBtClose;
rcBtMin.left = rcBtClose.left - rcBtClose.Width() -
::GetSystemMetrics( SM_CXFIXEDFRAME );
rcBtMin.right = rcBtMin.left + rcBtClose.Width();
pDC->DrawFrameControl(rcBtMin,DFC_CAPTION,DFCS_CAPTIONMIN|DFCS_HOT );
}
void CSamplePaintSheet::OnSysCommand( UINT nID, LPARAM lParam )
{
CDC *pDC = GetWindowDC();
ReDrawCaptionBar( pDC );
ReleaseDC( pDC );
CDialog::OnSysCommand( nID, lParam );
}
|
|
|
|
|
Re draw it in WM_ACTIVATE
|
|
|
|
|
i have a problem with two images.suppose,3 circles comes one inside the other.like that,2 images are there.(image1 has 3 circles,and image2 has 3 circles one inside the other.)i want to compare the two images and to find whether the first image is same as that of second??
|
|
|
|
|
Refer this[^] article by PJ Arends .
Prasad
MS MVP - VC++
|
|
|
|
|
if you want to compare two images a way is that isnt very good you can use of CImage class you make two loops for height and width and use of GetPixel for check color of pixel on each images but this way is a problem and its slow but I think on the codeproject is other ways.
|
|
|
|
|
Hi,
Can you help me how to "synchronize" .NET DateTime.Tick and C++ time (CTime, LPSYSTEMTIME, t_time doesn't matter which one) . I need to write certain time to file (using .NET C# -> write Ticks value) and than read it in C++ == create time structure (constructor with !same! ticks or something...) . I'm using old VS 6 C++ !!!
thanx
|
|
|
|
|
Please help me. I'm looking for DFP and Newton optimization methods. They may be written in C, Java or C++. And I don't want Newton Raphson method.
|
|
|
|
|
Hi
I am trying the change the default font of the menu.
I have used code from http://www.codeproject.com/menu/menuch.asp.
In the App file,there are AppendMenu(),DrawItem() overriden functions.
Under drawItem(),I have written the code to change the default
font of the Menu.I have declared objects like m_FileMenu, m_EditMenu
of type App class in the Mainframe header file and through these variables
I have called AppendMenu() from within the constructor of Mainframe class.
Like m_FileMenu.CreatePopupMenu();
m_FileMenu.AppendMenu(MF_ENABLED,ID_MYFILE_NEW,"&New\tCtrl+N");
m_FileMenu.AppendMenu(MF_ENABLED,ID_FILE_OPEN,"&Open\tCtrl+O");
Similarly, I have called AppendMenu()for m_EditMenu object also.
Next,Under CreateMenu()which has been called from OnCreate handler,I have
taken the pointer of CMenu through GetMenu(), and all the default items of
menu have been removed through RemoveMenu().
Like pMenu->RemoveMenu(0,MF_BYPOSITION);
Then,through that CMenu pointer,I have called InsertMenu() through which all
the appended items are getting inserted in the menu.
Like
pMenu->InsertMenu(0,MF_BYPOSITION|MF_POPUP,
(UINT)m_FileMenu.m_hMenu,"&File");
pMenu->InsertMenu(1,MF_BYPOSITION|MF_POPUP,
(UINT)m_EditMenu.m_hMenu,"&Edit");
Now,the problem is that although the font of all the submenu items are getting changed as per my given font in the drawitem(), but the font of menu items like "File" and "Edit" are not getting changed.
If possible Can you please tell me what could be the reason behind it and what should I do to solve it?
-- modified at 5:23 Monday 23rd April, 2007
With Regards
Neeraj Sinha
Netstudio
Pune
|
|
|
|
|
Menu will be drawn as per the system font settings.
You can try with Owner-Drawn menu
Search CP to find more articles on it.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Thanks for your reply
I have tried with Owner-Drawn menu.The menu items font didn't change.Only the submenu items font got changed.I have used code from the CP itself:
http://www.codeproject.com/menu/menuch.asp.
With Regards
Neeraj Sinha
Netstudio
Pune
|
|
|
|
|
I made one dialog box in VS2005(mfc) it is not running in Vist(OS) system, is there any way to run mfc application in vista?
|
|
|
|
|
Please refer this[^].
Regards,
Paresh.
|
|
|
|
|
Dear sir
Thank you for your replay
But i am getting earror is "application has filed to start because its side-by-side configaration is incorrect................."
I am checking my (MFC)application in "Vist home basic"
|
|
|
|
|
mahe_uma wrote: application has filed to start because its side-by-side configaration is incorrect
You need to install the MFC 8 DLLs, vcredist_x86.exe.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
|
|
|
|
|
dear sir
thank you for you replay
already i installed vcredist_x86.exe still i got this problem i think Actually problem is in VS2007
thank you
|
|
|
|
|
Hi friends,
how to get the system date and time in visualc++??
i know we need to use ctime include file..
but afterthat how to get??
any example code ??
waiting for your valuable reply..
with regards,
karthi..
|
|
|
|
|
CTime::GetCurrentTime
--
======
Arman
|
|
|
|
|
Hi,
You can use Win32 API's GetSystemTime()/GetLocalTime()..
Here is the sample code..
SYSTEMTIME st;
GetLocalTime(&st);
Cheers,
Suresh
|
|
|
|
|
mkmut wrote: how to get the system date and time in visualc++??
Use GetLocalTime API.
|
|
|
|
|
Please refer below code.
CTime time = CTime::GetCurrentTime();<br />
<br />
int day = time.GetDay();
int month = time.GetMonth();
int yearlong = time.GetYear();
<br />
int hour24 = time.GetHour();
int min = time.GetMinute();
int sec = time.GetSecond();
Regards,
Paresh.
|
|
|
|
|
|
I want to check whether the system, in which my application will run is connected in Network or not? How can I do that?
|
|
|
|
|
Aryan S wrote: I want to check whether the system, in which my application will run is connected in Network or not
Use...
IsNetworkAlive
|
|
|
|
|
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi ! I want to development a file system filter driver, in VC++. Can it be developed using DDK kit? or I will have to purchase the IFS kit? Plz specify what needs to be installed for file system filter development? Would be the DDK enough? Can I develop it in VC++ using the DDK?
|
|
|
|