|
Register a hot key with RegisterHotKey for WinKey+D. See here[^] for an example. In your message handler for the hot key message, put the logic to send your window to the system tray.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
no dude, please ! don't send him in this direction !
he doesn't need at all to know that it's Win+D which made his application minimized to the tray.
What he wants is overriding WM_MINIMIZE to put his apps to the tray.
|
|
|
|
|
toxcct wrote: WM_MINIMIZE
Is there a message like that in MFC?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
my bad, WM_SIZE or WM_ACTIVATE.
You can also get notified of the minimize command before it is carried out using WM_SYSCOMMAND.
also, the IsIconic() function is there to know if an application is minimized...
|
|
|
|
|
toxcct wrote: WM_SYSCOMMAND.
Overriding the WM_SYSCOMMAND is the best way if one should execute some code before an app is being minimized. But the WinKey+D combination will not send your application this message!
toxcct wrote: also, the IsIconic() function is there to know if an application is minimized...
The op has a two-staged problem. At first, he must detect WinKey+D. And then, he must minimize it. I suggested him how to detect WinKey+D. He could add a handler which would be executed while this combination is pressed. Now, the second stage is to put the code within this handler, which sends his app into the system tray.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: At first, he must detect WinKey+D
i'm absolutely not sure of this.
here is what I'm thinking he has (but as long as he didn't replyed to my question, I can't know for sure).
he implemented a "Go To tray" function in his application. but he certainly throws his Apps to the tray when selecting that action on a Menu or with a button.
but what he wants is sending his apps to the tray whenever the application is minimized.
Win+D is a Windows implementation to show the desktop. it throws a Minimize event to every application in the taskbar.
so the OP doen't have to know that it is a Win+D, but only that the application is told to minimize (then, to the tray)...
get me ?
|
|
|
|
|
toxcct wrote: so the OP doen't have to know that it is a Win+D, but only that the application is told to minimize (then, to the tray)...
I agree, although it should probably be WM_SIZE /SIZE_MINIMZED that is being looked for instead.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
toxcct wrote: he implemented a "Go To tray" function in his application. but he certainly throws his Apps to the tray when selecting that action on a Menu or with a button.
Yes. I am telling the op that he has to capture Win+D and execute the same code to send his app to the tray in response. Because his app is currently not reacting to Win+D, which is what his problem is. You may want to override OnSysCommand like this to verify it:
void CDialogDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if(nID==SC_MINIMIZE)
AfxMessageBox(_T("Minimizing!"));
}
Pressing the minimize button will display the message. But if you press Win+D, the control never reaches here, but the app goes minimized.
toxcct wrote: Win+D is a Windows implementation to show the desktop. it throws a Minimize event to every application in the taskbar.
What exactly do you mean by minimize event? Windows won't throw any such minimize event when Win+D is pressed!
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: But if you press Win+D, the control never reaches here, but the app goes minimized
so what more does he need ?
he puts his "go to tray" code in the minimizing event handler, no matter if it is a Win+D, a Win+M or any other way to minimize an application !
|
|
|
|
|
OMG, tox you are not getting it. His app is not responding to Win+D (see his original msg), for some reason and that's why I asked him to trap separately and react to it.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Mohammad Khodaea wrote: I want to send my dialog box to the system-tray...
Are you referring to the taskbar notification area?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Mohammad Khodaea wrote: Since my dialog has no border (it has no caption) and subsequently it has no minimized property in the dialog properties, I don't know how to handle the message.
This would be trivial for a "normal" dialog box. I added the WS_MINIMIZEBOX style to one of my dialogs, and I could then respond to WM_SIZE and call Shell_NotifyIcon() appropriately. Are you indicating that this has not worked for you (I assume so but just wanted to be sure)?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi
i run a thread to show some line in edit box and in every second thread add one line but i want to show only last added ten lines in edit box,how is this possible
thank you
|
|
|
|
|
If I understand it right, your question boils down to: "How can I update the contents in an edit box?" And the answer is, with the help of a member variable.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
hi rajesh
you r absolutely right.can u tell me with the help of some code
|
|
|
|
|
There is no serious coding. Add a member variable to your edit control and name it as m_str . Now, you can alter the value of this variable like: m_str = _T("some new value"); and then call UpdateData(false); to reflect it on the screen.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
i think u r not understanding my problem.i am able to show string in the edit box.but my actual problem is that in every one second i am adding on line.and only want to show 10 lines means i want to erase the one oldest line when the one new line is inserted
|
|
|
|
|
rajneshmalik wrote: and only want to show 10 lines means i want to erase the one oldest line when the one new line is inserted
Use a CStringList to accomplish the same.
Look at CStringList::RemoveHead() function. Your task would become easy with it.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
modified on Tuesday, January 08, 2008 9:44:03 AM
|
|
|
|
|
How about keeping the 10 lines in a CStringArray (or similar) object instead? Then the edit control can be updated from this object. Does this sound plausible?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
can i have a check box in the menu pane? if yes then how do i do it?
|
|
|
|
|
have you looked here[^] ?
|
|
|
|
|
yes i just did that now.. what i want is not there in the list of examples. i wnat to add the checkbox where fileopen and print option is there. is it possible?
|
|
|
|
|
its actually not menu pane. its the tool bar. and i dint see any of the articles in the given link. any other leads?
|
|
|
|
|
any leads to the above mentioned query. i need to know how to add a checkbox in the tool bar.
|
|
|
|
|
hi
i have a application to call a object in all classes.
how to make it . help me
k.guru moorthy
|
|
|
|