|
Hi Thanks for your suggestion
now my query is if i use GetDlgCtrlID
then kindly suggest me
GetDlgCtrlID(HWND hwndCtl);
what should i pass in hwndCtl(is it dialog box's handle/some thing else).
Regards
Vikas
|
|
|
|
|
Are you sure you want to use GetDlgCtrlID and not GetDlgItem ?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
hi,
MY OBBJECTIVE IS THAT I HAVE A BUTTON IN A WINDOW.
ON CLICK EVENT ON THAT BUTTON I WANT TO SHOW THAT DIALOG FOR WHICH I WANT TO CHANGE THE CAPTION OF BUTTONS(ok,save).
so what procedure should i follow
|
|
|
|
|
Don't yell.
I think the answer has been given to you already, or you mean it doesn't work?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Hi,
i tried GetDlgCtrlID and GetDlgItem in the init of dialog.
but in both cases it returned id as 0(zero).
For save as dialog box the button label is Save and for open dialog it is Open.
so where should i get the corresponding ids of the same.
i have tried
SendMessage((HWND)fileW,(UINT) CDM_SETCONTROLTEXT,IDOK,(LPARAM)(LPCTSTR)'hi');
to set the OK button's labels as Hi but in case of Open/save dialog there is no button which hold's the label as Ok.
Can you suggest me if i am doing wrong?
Rajib
|
|
|
|
|
Try using this: CFileDialog::SetControlText[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
vikas choudhry wrote: GetOpenFileName(ofn);
PostMessage((HWND)fileW,(UINT) CDM_SETCONTROLTEXT,(WPARAM)IDOK,(LPARAM)"hi");
Your other responses explain how to do what you want. The reason what you've tried doesn't work is that GetOpenFileName displays a modal dialog. Your PostMessage call doesn't execute until after the Open box has been displayed and closed.
Judy
Be wary of strong drink. It can make you shoot at tax collectors - and miss.
Lazarus Long, "Time Enough For Love" by Robert A. Heinlein
|
|
|
|
|
Hi all,
I want to set position of my window on top of Taskbar window also..
I have used
::SetWindowPos(hwnd, HWND_TOPMOST, X, Y, cx, cy, SWP_NOSIZE | SWP_SHOWWINDOW | SWP_DRAWFRAME);
this is working fine in case of XP but in vista my window gets overlapped by the TaskBar.
Note: In both XP & Vista I have enabled "Keep the Taskbar on top of all other windows" property of Taskbar.
I want my window tobe work like Task Manager Window.
Please provide some solution to me.
Thanks in advance.
|
|
|
|
|
Try disabling "Always on top" feature of taskbar when your application starts and restore it when your application exits. Check this article[^] about how to do it. Open the article and search for "Taskbar always on top". Hope it will help.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks for your reply,
I have tried this
static HWND hShellWnd = ::FindWindow(_T("Shell_TrayWnd"), NULL);
if(hShellWnd != NULL)
{
::SendMessage(hShellWnd, 0x2b1, 8, 0);
::SendMessage(hShellWnd, 0x581, 1, 0);
::SendMessage(hShellWnd, 0x550, 0, 10001);
::SendMessage(hShellWnd, 0x579, 0, 0);
}
::SetWindowPos(hwnd, HWND_TOPMOST, X, Y, cx, cy, SWP_NOSIZE|SWP_SHOWWINDOW|SWP_DRAWFRAME);
but it won't work,actually I think that "always on top off" code is not working..
|
|
|
|
|
This is a bad idea...
To quote Raymond Chen. "What if another program does this?"
When they close, it will put back the taskbar how it found it, and you'd mysteriously stop working.
Or worse, you'd close first, and mess *their* program up.
Naughty programmer!
Iain.
|
|
|
|
|
I aggree with you,
but I have just tried weather it works or not..
I am also going through the link which you have provided
but couldn't find any solution yet.
|
|
|
|
|
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]
|
|
|
|