|
Got my 5 , thank you for posting it.
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]
|
|
|
|
|
Thanks. I've got so much useful code from CP, I like to give back when I can.
I hope you've added yourself to pointy haired thread hijackers list...
Iain.
|
|
|
|
|
Iain Clarke wrote:
I hope you've added yourself to pointy haired thread hijackers list...
Well, since I'm (together with Rajesh) the proud founder of the Brigade, my name is necessarily there.
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]
|
|
|
|
|
Thanks. But I foound out what was missing from my code. I had to add
PAINTSTRUCT ps;
HDC hdc = ::BeginPaint(m_hWnd, &ps);
at the start and
::EndPaint(m_hWnd, &ps);
at end of my code snippet and it works.
|
|
|
|
|
First, use CPaintDC in the WM_PAINT message handler, not GetDC, and second, when you do this:
GetClientRect(hStatic,&pirect);
You get the client area of the static, not its position in the client area of its parent. If you want to know where the static lies inside of its parent use some coord mapping functions or simply this:
RECT pirect;
GetWindowRect(hStatic,&pirect);
ScreenToClient(&pirect);
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
I am using SDK so CPaintDC is ruled out. So I have to add BeginPaint() and EndPaint() instead fro it to work.
|
|
|
|
|
Hi,
i want to change the button label (ok,save) of native dialog box.
OPENFILENAME C_FAR *ofn;
fileW = FILEW_Create();
FILEW_Init(fileW);
fileW = FILEW_DefFileW();
ofn = (OPENFILENAME C_FAR *)PTR_New(sizeof(OPENFILENAME));
ofn->lStructSize = sizeof(OPENFILENAME);
ofn->lpstrTitle="Rajib";
ofn->hwndOwner = ((win != (WinPtr)NULL)) ? MSW_WgtGetWWindow((WgtPtr)win) :(HWND)NULL;
ofn->Flags |=OFN_EXPLORER;
GetOpenFileName(ofn);
PostMessage((HWND)fileW,(UINT) CDM_SETCONTROLTEXT,(WPARAM)IDOK,(LPARAM)"hi");
i have used this code and trying to set OK button's label as "Hi" but not being able to do the task.
Can some one help me?
Vikas
|
|
|
|
|
|
Use the CFileDialog class and overwrite its OnInitDone() method and use GetDlgItem to find the button (IDOK) and try to change its text.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
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
|
|
|
|