Can you find the error ! Drawing a button in non client area but caption is not setting to ....

Hello Experts ,
I spent almost 4 hrs today doing this .If anyone can help me ,that
would be hats off !
I wanted to remove all the min,max and close button and later draw my
min max buttons.
Here is what i did

1.Added the styles in the PreCreateWindow.This works and the min ,max
,close are invisible .

2.Added a WN_NCPAINT handler for drawing of buttons ,when I want to
draw my buttons in the non client area but the min ,max ,close buttons
are still visible.


3. When you put a comment to ON_WM_NCPAINT()
min ,max ,close are visible .

Am i missing anything ?Can anyone point my error?

*******STEP1
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	ON_WM_CREATE()
	ON_WM_NCPAINT() //Step 4
END_MESSAGE_MAP()

*******STEP2
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{


	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	// Create a window without min/max buttons or sizable border
    cs.style = WS_VISIBLE | WS_OVERLAPPED  | DS_SETFOREGROUND |
DS_CENTER |
WS_CAPTION ;



	return CFrameWnd::PreCreateWindow(cs);
}

*******STEP4
void CMainFrame::OnNcPaint()
{
	// TODO: Add your message handler code here
	// Do not call CFrameWnd::OnNcPaint() for painting messages

	CWindowDC d(this);

	RECT rc;
	GetWindowRect( &rc);
		BOOL b = d.DrawFrameControl(CRect(760,4,800,23),DFC_CAPTION
,DFCS_CAPTIONCLOSE);
	 b = d.DrawFrameControl(CRect(719,4,759,23),DFC_CAPTION
,DFCS_CAPTIONMIN);
}

0
nicetom786 (68)
5/17/2006 5:51:27 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
606 Views

Similar Articles

[PageSpeed] 37

Hi,

You need to use the following APIs to draw a frame control
and paint the standard window buttons (min, max & close):

	GetDC()
	GetWindowRect()
	GetClientRect()
	GetSystemMetrics()	using SM_CYCAPTION, SM_CYFRAME
	CreateRectRgnIndirect()
	CombineRgn()
	SelectClipRgn()
	DrawFrameControl()

	............................................

	DeleteObject()
	ReleaseDC()

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_4esj.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/getwindowrect.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/getclientrect.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getsystemmetrics.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/regions_8u9g.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/regions_7tf2.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/clipping_2eni.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pantdraw_4b3g.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_1vsk.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_66hv.asp

Hope these suggestions helps,

Kellie.

0
5/17/2006 10:05:43 PM
Reply:

Similar Artilces:

Outlook 0x800ccc0d error when Norton e-mail protect enabled: see hosts
This post is made to help others solve this issue, based on my experience. Symptom: - Outlook works perfectly well when Norton Anti-Virus e-mail protection is disabled - Outlook cannot retrieve incoming messages when NAV e-mail protection is enabled, message being: pop3 server not found, error 0x800ccc0d This symptom, and possible solutions, are exactly the object of Symantec support note: http://service1.symantec.com/SUPPORT/nav.nsf/docid/2000020716064206 Please read this note first ! The object of this post is to add another possible solution to this problem. NAV email protection sets up...

option button
Hi I need some help! I have a column with results from a survey. The results are in text but do have a ranking, e.g. the results can be A,B,C,D or E. I now want to create an option button or similar where I can let the user choose to cap the results so e.g. the maximum result is a B and then all A results should show up as B's. Is this possible? Thanks You'll need a helper column to do this. Try something like this: =IF(B3<=C$1,C$1,B3) B3 is the survey result, C1 is the "Cap" value. HTH, Barb Reinhardt "Andreas" wrote: > Hi > > I need som...

find action on log file
Hello there I want to use outside tool to find who made some update on table in my server I know that there are many tools for this. But can they do it on simple recovery model? Roy Goldhammer (royg@yahoo.com) writes: > I want to use outside tool to find who made some update on table in my > server > > I know that there are many tools for this. But can they do it on simple > recovery model? No. If you are using the simple recovery model, the contents of the log is wasted away everyonce in a while. Well, if the disk area has not been overwritten...

How2 set Defaults for Paragraphs in Pub2003
I have just upgraded to Pub2003. My old Pub2000 had no such feature. My problem is when I cut and paste into the new Pub2003 it automaticly uses a Line Spacing default "After Paragraphs: 9pt" - this whacks out all my old logos and forms when they are copy/pasted in to a new Pub2003 .pub If I open an old (2k) .pub file with Pub2003 the spacing is fine - if figures out the Line Spacing is "After Paragraphs: 0pt" ...

Find and Replace Footnote Numbering
I often have documents where I need to put formatting before or after the footnote number for every footnote, often for hundreds of footnotes...anyone know how I can do this in one shot? I know I can specify ^f in find and replace, but only in the find portion...it gives an error if you put it in replace. ...

Excel button problem
Hi All I have a macro that copies a worksheet in the active workbook and puts it into a new workbook - then formats it and deletes any buttons on the worksheet. On the first click on the button the macro works ok. On the second click, it fails because the all assigned macros on all buttons in the active workbook changed from "mba" to "book1!mba". Book 1 doesn't exists (wasn't opened, wasn't saved, doesn't have the macros). I've never experienced this problem before?? Can anyone help to solve this problem? FYI The macro to do this is c...

WCF Client serialization problem
I posted the problem on another forum, and to prevent duplicate posts, but get as many professionals as possible to look at it, I include the url in this post. Please help! http://stackoverflow.com/questions/2948657/migrating-webclient-to-wcf-wcf-client-serializes-parametername-of-method ...

Is anyone an expert with outlook that I can call on the phone?
How do I share calenders between outlook and my MSN Premier account? Assuming you are using the outlook connector, you need to set the msn account to be the default message store then outlook will use the msn calendar as the default. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LSOFT.COM You can access this...

how to find an item in a list control?
hi all, In a list Control how to find an item. If it is found then the item should be highlighted. how to do this? i wrote the following code but its not working what's wrong in the code? LVFINDINFO info; int nIndex; info.flags = LVFI_PARTIAL|LVFI_STRING; info.psz = (LPCTSTR) str; //fd.m_strEditCtrl; sprintf(st,"%d",m_ListCtrl.GetItemCount()); MessageBox(st,"Count"); for(int i=0;i < m_ListCtrl.GetItemCount();i++) { if((nIndex = m_ListCtrl.FindItem(&info,-1)) == -1 ) { m_ListCtrl.SetItemState(nIndex,LVIS_SELECTED,LVIS_SELECTED); } } thanks and r...

Setting a dynamic range in a formula
Hi, I have a column of numbers and I always want the following arra formula to use the last 12 entries: =(PRODUCT(1+D1:D12/100)-1)*100 Any suggestions? Thanks, Phillycheese -- Phillycheese ----------------------------------------------------------------------- Phillycheese5's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2419 View this thread: http://www.excelforum.com/showthread.php?threadid=37809 Assuming that Column D contains no blanks, try... =(PRODUCT(1+OFFSET(D1,MAX(0,COUNTA(D:D)-12),0,12,1)/100)-1)*100 ...confirmed with CONTROL+SHIFT+ENTER. Hope th...

Error 550 Relaying denied
I get this nearly every time I try to send information using MS Outlook email. Any suggestions? You probably need to turn on authentication to your outgoing server. You can do so on the "Outgoing Server" tab for your mail account. -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgroup to preserve the message thread. *** In news:9cf101c3eacf$a3250cb0$a401280a@phx.gbl, Dick Brenneke wrote: > I get this nearly every time I try to send information > using MS Outlook email. Any suggestions? Th...

Unknown error from CFtpConnection::GetFile()...
Hi all, I'm having intermittent problems with CFtpConnection::GetFile()... 99% of the time GetFile() succeeds but occasionally it fails and returns FALSE with a GetLastError of 0x2EFF (12031) which I can't find documented/defined anywhere... Anyone know what this error means...? Where it is defined...? A bit of searching on on the web seems to suggest; "The connection with the server has been reset." Can anyone confirm this...? Many thanks, Andy. Andrew Kilgore wrote: > Hi all, > > I'm having intermittent problems with CFtpConnection::GetFile()... > 99%...

How to delete a set of rows depending on Value
I have two worksheets Worksheet A 27 Columns 1600 Rows. Worksheet B 1 Column 200 Rows I need Worksheet A to look at each cell in Worksheet B, if a cell exists in Worksheet A, then I need the row deleted... Basically I have a list of Grand list of items to do, then a list of items already completed. I need to now remove all entries in the grand list that have been completed. Is this feasible or should I look at using some Unix script. It sounds like you could use VLOOKUP to find out if the value in B exists on A: http://www.officearticles.com/excel/vlookup_formulas_in_microsoft_excel....

Cannot open Outlook, keep getting Send error report of Microsoft.
We are having problems with Outlook 2003. Everytime we try to open, we get this: Send error report to Microsoft. Any ideas why? All windows and office update have been completed. ...

CSV Files and VLOOKUP error
Does anyone know why VLOOKUP and Compare formulas don't work o information originating from a CSV file? I've tried copying an pasting values only (to leave behind any formatting), but it doesn' help. Through countless tests, I've narrowed it down to the CSV file bein the only possible cause -- Message posted from http://www.ExcelForum.com Hi ajpowers, Just a guess but the imported data may have leading or trailing spaces or are numbers stored as text. You could use the formula =A1=D1 to see if you get a true or false, where A1 is the lookup value and D1 ia the CVS valu...

Uninstall of mappoint has caused errors with excel
Hi, I am running Office 2003 on the terminal server (windows 2003) and had a copy of mappoint as well. This is a mapping program. We ininstalled mappoint which has caused an error message with Excel and other office products. The error says "Cd:\documents and settings\administrator.ocrdc1\application data\microsoft\addins c:\Program files\common files\microsoft shared\geography\mpoai9.dll is not a valid add-in." I then click OK and excel opens up and everything is fine. The problem is that we are using other programs as well such as Quickbooks that export to excel and t...

Document Viewer installer error
I recently ran CHKDSK /F as this was prompted when I attempted to run defrag etc. Since the chkdsk was run, when I turn my PC on, I receive the following message: "document viewier - installed encountered an unexpected error - error code 2908". I click run, the same error just repeats and loops. The only was I can remove it is to end task via task manager. Any ideas how I can correct this error? many thanks ...

how do I add error bars to a 3D chart in excel?
The help states you can only add error bars to data series in 2D area. Is there a way to add them to a 3D chart? Hi, I would not have thought so. Obviously as it is not a built-in option the only way would be a work around perhaps using dummy series. Unfortunately you can create 3d combination charts. Stick with the 2d view. Cheers Andy elahe wrote: > The help states you can only add error bars to data series in 2D area. Is > there a way to add them to a 3D chart? -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info I checked, and error bars are not offered for 3D ch...

Reply To Email after installing CRM Outlook Client
After installing the CRM Outlook Client, when opening an email and selecting REPLY, the current windows looses focus. I know this sounds minor but many of our power users are in the habit of hitting REPLY and typing without even looking at the screen. It is not until they look up do they realize that the window no longer has focus thus everything they thought they typed now has to be retyped. Has anyone seen this and know of a quick fix? Thanks in Advance -- Kenneth Clebak Kenneth Have you resolved this? I have the same problem, and it is VERY annoying. Saira "Kenneth Clebak&...

ERROR: 5.1.2 or other punctuation after the recipient's email address.
I am trying to send a email to a group address I created with 58 addresses in it. When I try to send the email to this group I get the following Error: "5.1.2 or other punctuation after the recipient's email address. " I have gone back to the original contact cards and made sure the addresses were all legal. I have re-created the list, same problem I have re-booted, same thing. Any thoughts out there? Thanks Dunc My wife and I have MBP's and are both running MS Office for Mac's, Entourage 12.2.3. Both of us have messages cued up in the out boxes th...

Error 130
Hope someone can point me in the right direction. OSX 10.63, MacOffice 2008 12.2.4 When I try to connect to the following news server ( that doesn't require a user name or password ) I get the following error when attempting to download the List of Newsgroups: "Too many connections in your class - Could not receive the Newsgroup List - ERROR 130 " Any pointers much appreciated. Using Msnews servers works fine. -- Welsh Gas Remove usual to reply direct. paulatwoodsforddotcodotuk On 4/27/10 10:49 PM, in article 59bb7979.-1@webcrossing.JaKIaxP2ac0, "We...

Terminal Server and GP Settings
Not being a Windows Terminal Server expert by any definition, I have a question for somebody who is. When wanting to have a user profile to store individual dex.ini files, my understanding is that each user would have his own Windows folder under their user folder. Additionally, if you typed SET at a command prompt, the settings for WINDIR would point to that user-specific Windows folder. Is this thinking correct? -- Charles Allen, MVP I think you also have to make certain that the dex.ini does NOT exist in the program install location for GP or it will still look to that. Dwight...

Can I share entities in migration process?
The entities in CRM have only one owning user. If I want=20 who a user see a entity of another user, the entity must=20 be shared with this user.=20 Well, I want migrate entities who must be shared with some=20 users. Exists a way to do it? Thank you for pay attention and sorry my bad english. []'s Vin=EDcius Pitta Lima de Ara=FAjo ...

Can't do adjustment in analytical accounting
I am trying to change an analytical assignmnet through the Edit Analysis. When I try and change it, I receive an error stating "The Code of this Transaction Dimension cannot be adjusted". Has anyone seen this before? I have done similar changes many times, but I don't know why I can't now. Any insight would be helpful. Thanks, KJ Hi KJ What version of Gp are you running? I haveseen this happen in 8 but one of the service packs fixed it. (I think it was SP 4 or 5) Fliehigh "KJ" wrote: > I am trying to change an analytical assignmnet through the Edit >...

I cannot get Outlook to send/receive. Error says object not found
I just installed Outlook2007. I cannot get the send/receive to work. That is when the error says Object not found. If I go to accounts and properties, I run the two tests and they complete fine. What should I try next? Outlook 2007 is the only new program, all the rest are from Office 2003 IMK <IMK@discussions.microsoft.com> wrote: > I just installed Outlook2007. I cannot get the send/receive to work. > That is when the error says Object not found. If I go to accounts and > properties, I run the two tests and they complete fine. What should I > try next? Outlook 2007 is ...