|
It took me a bit of digging, as some terminology can be a bit odd...
But you might want to let explorer do most of the work for you, by writing your program as a "Desk Band".
Have a look at the following msdn article, and scroll down aways until you get to the desk band section.
http://msdn.microsoft.com/en-us/library/cc144099(VS.85).aspx[^]
I'd also look at Michael Dunn's shell programming articles - possibly the best articles since "How to slice bread using only your debugger".
Iain.
|
|
|
|
|
Hi, Is there any ways for me to add a check marks or icon into the submenu?
I'm currently creating owner draw menu.
So far, I only able to print out the text into the submenu... I failed to put the check mark/icon into it.. Any help will be appreciated
Currently all my drawing are done at:
DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
}
Regards,
KH
good
|
|
|
|
|
What problem are you facing in drawing the icon? You can use DrawIconEx[^] and pass in the DC from the DRAWITEMSTRUCT.
|
|
|
|
|
because i currently put some code inside ::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
CDC* pDC; //i used this to draw a rect to the menu
CRect rect;
rect.left=lpDrawItemStruct->rcItem.left;
rect.top=lpDrawItemStruct->rcItem.top + 2;
rect.right=lpDrawItemStruct->rcItem.right;
rect.bottom=lpDrawItemStruct->rcItem.bottom + 2
//str is a string which i want to output : eg -> Open\tCtrl+O
pDC->DrawText (str,rectt,nFormat); //this will draw text into the menu/submenu
What i want now is i want to make a checkmark/icon on the left side of the Text.
I'm not sure on how to draw it on the left side of the text
good
|
|
|
|
|
Shift the rectangle by the icon dimensions, say 16 pixels to the right, then draw the text there. Now draw the icon at the original position.
CRect rect;
rect.left=lpDrawItemStruct->rcItem.left;
rect.top=lpDrawItemStruct->rcItem.top + 2;
rect.right=lpDrawItemStruct->rcItem.right;
rect.bottom=lpDrawItemStruct->rcItem.bottom + 2;
rect.OffsetRect(16, 0);
pDC->DrawText (str,rectt,nFormat);
You can load standard images such as check mark etc. using LoadBitmap[^]
|
|
|
|
|
thanks ! ^^ got it worked out
good
|
|
|
|
|
Yesterday I pointed you at an article which is a super reference on this stuff.
After a bit of digging, I found how Bruno does it...
Not quite as trivial as I thought, but the info is there.
Iain.
void CNewMenu::DrawSpecialChar(CDC* pDC, LPCRECT pRect, TCHAR Sign, BOOL bBold)
{
CFont MyFont;
LOGFONT logfont;
CRect rect(pRect) ;
rect.DeflateRect(2,2);
logfont.lfHeight = -rect.Height();
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
logfont.lfWeight = (bBold) ? FW_BOLD:FW_NORMAL;
logfont.lfItalic = FALSE;
logfont.lfUnderline = FALSE;
logfont.lfStrikeOut = FALSE;
logfont.lfCharSet = DEFAULT_CHARSET;
logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
logfont.lfQuality = DEFAULT_QUALITY;
logfont.lfPitchAndFamily = DEFAULT_PITCH;
_tcscpy(logfont.lfFaceName,_T("Marlett"));
MyFont.CreateFontIndirect (&logfont);
CFont* pOldFont = pDC->SelectObject (&MyFont);
int OldMode = pDC->SetBkMode(TRANSPARENT);
pDC->DrawText (&Sign,1,rect,DT_CENTER|DT_SINGLELINE);
pDC->SetBkMode(OldMode);
pDC->SelectObject(pOldFont);
}
|
|
|
|
|
Hi Iain, Thanks for your reply.
But what u showed are the example of change the font as well as its itallic/bold and draw the text based on the fonts
Correct if i'm wrong towards the code you're trying to show
Regards,
KH
good
|
|
|
|
|
karhong wrote: Correct if i'm wrong
It'll be a pleasure. (cue evil laugh)
What is does is to temporarily change the font to Marlett, and then draw one of the characters in a particular place. It is then a good citizen and restores the font to it's previous state. If this is not clear, learn it fast, as you should be doing the same whenever you change the state of a DC.
Out of curiosity, I loaded Marlett into charmap. It's a not-real font, with lots of useful characters, like the min / max / etc bits that windows uses in the top right of your windows. Etc. One of those characters (look at the comments in the pasted code) is a check mark / tick.
Cunning Mr Podetti!
Iain.
|
|
|
|
|
Marlett is not a standard Windows font on all Microsoft operating systems and may not exist on the client computer. I would not recommend this hackish way of drawing a checkmark at all.
Standard Window Fonts[^]
Best Wishes,
-David Delaune
|
|
|
|
|
How did you try?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
|
Do you know about Google?
Do you know about forum posting guidelines?
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]
|
|
|
|
|
hey i know google v well, ok?
i dont have any idea abt forum posting guidelines.
i posted this question so that i may get some demo or samples from codeproject.
anyway thanks
|
|
|
|
|
hemannu wrote: hey i know google v well, ok?
Then you may take advantage of it, OK?
hemannu wrote: i dont have any idea abt forum posting guidelines.
This is bad, please read Chris Maunder's How to get an answer to your question^.
hemannu wrote: i posted this question so that i may get some demo or samples from codeproject.
The CodeProject 's article search engine is another valuable resource you should be aware of.
hemannu wrote: anyway thanks
Anyway, you're welcome.
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]
|
|
|
|
|
Sounds like a PHP thing.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
How to unselect a row in list control by using the code to control?
How to write the code to unselect a row in list control?
|
|
|
|
|
select or unselect?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
unselect the selected item (by clicking the item) in list control
My list control is fullrowselect(must use the attribute) and I set certain columns to be colorful background by using the color dialog.
If I select the color in the color dialog, and then the item will be automatically selected. I cannot see the color of the select item, becuase the item is selected and shows in hightlught. So I want to unselect the item after I select the color.
|
|
|
|
|
Please check this thread[^].
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
Bravo!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi All,
Im having sam.txt file in my Tomcat path.I need to download this file throw IE or Mozilla Firefox using MFC.
URL is:
http://localhost:8080/sample/Upload_Files/sam.txt
I dont know how to open throw MFC.
Pls Help me...........
Thanks & Regards,
Anitha
modified on Wednesday, December 17, 2008 2:12 AM
|
|
|
|
|
I'm not sure if I got you right, but something like this will launch the page in your default browser:
ShellExecute(NULL, NULL, "http://localhost:8080/sample/Upload_Files/sam.txt", NULL, NULL, SW_SHOWNORMAL); Note that you don't need MFC for this - see ShellExecute[^] at MSDN.
|
|
|
|
|
Hi,
I need to download this file.
|
|
|
|