|
I want to write a program and run as an icon at the right cornor of the Explorer.How to program it with C++. Can someone help me. |
| energybody Tuesday, April 21, 2009 6:39 AM |
Hi energybody, I just created a test project here , please let me know if you have any question. Best regards, Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't. - Marked As Answer byenergybody Friday, April 24, 2009 10:17 AM
-
|
| Bruce.Zhou Friday, April 24, 2009 8:26 AM |
Hi Energybody, Did you want to make a float window at the right corner of the Explorer like falshget? If so, I think it's less related to use which language to implement, but we can follow the below steps. We can create a Windows Forms application, and set the FormBoarderStyle property to None. After that, set the topmost of property to true. At last,we adjust the location and size of the form to dock it to the top right of the screen. In addition, we can also set the BackGroundImage of the Form to show the icon, and set the form's transparency. If you want to the icon form can be moved, than you'll need to handle the mousedown, and mousemove event to move the form programmatically. If you have anything unclear or difficulty to implement, please feel free to let me know. Best regards, Bruce Zhou Please mark the replies as answers if they help and unmark if they don't. |
| Bruce.Zhou Wednesday, April 22, 2009 6:30 AM |
I am just want the program to shrink as an icon and show at the right down cornor of Explorer tool bar. |
| energybody Wednesday, April 22, 2009 6:38 AM |
Sorry, I think I've misunderstood you in my previous post. Are you going to extend the Explorer with Band objects? If so, there's too much steps to describe in this thread. I just found several articles having the detail steps to achieve that. Please check out them: http://www.codeproject.com/KB/shell/ietoolbartutorial.aspx http://www.codeproject.com/KB/shell/dotnetbandobjects.aspx If I still misunderstood you, please feel free to let me know. Best regards, Bruce Zhou Please mark the replies as answers if they help and unmark if they don't. |
| Bruce.Zhou Wednesday, April 22, 2009 7:09 AM |
The linka you give me seems to not much suitable for me. I onlycan shrink the program in system tray. Do you have source code to send to me. I can learn it myself. |
| energybody Friday, April 24, 2009 2:41 AM |
Hi energybody, I don't have the source code now. Would you please let me know why the links are not suitable for you? Did I misunderstand you? If so, please feel free to let me know. Besides, I am a little curious what kind of application you are developing. Why do you need to dock the your application in the Explorer bar? Can't it be OK if display an icon in the system tray? Best regards, Bruce Zhou Please mark the replies as answers if they help and unmark if they don't. |
| Bruce.Zhou Friday, April 24, 2009 2:57 AM |
if display an icon in the system tray. Do you have source code or the links. - Edited byenergybody Friday, April 24, 2009 3:01 AM
-
|
| energybody Friday, April 24, 2009 3:00 AM |
Yes, I think it's easy. You can try the steps below.
- Drag a NotifyIcon component to the form.
- Choose an icon in the designer for the NotifyIncon component.
- Handle the resize event of the Form.(When the window state of the form is Minimized, set the NotifyIcon to true)
You can also assign a ContextMenu control to the NotifyIcon Component so that you can use to open the main form
public Form1()
{
InitializeComponent();
this.notifyIcon1.Visible = false;
this.Resize += new EventHandler(Form1_Resize);
}
void Form1_Resize(object sender, EventArgs e)
{
this.Hide();
if (this.WindowState == FormWindowState.Minimized)
{
this.notifyIcon1.Visible = true;
}
}
Best regards, Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't. |
| Bruce.Zhou Friday, April 24, 2009 3:16 AM |
I know how to use it. But how can I Return to the program when I click. |
| energybody Friday, April 24, 2009 6:49 AM |
Hi energybody As I mentioned in my previous post, we can assign a contextMenuStrip to the NotifyIcon component. The steps are as below:
- Drag a ContextMenuStrip control to the Form, and name it to contextMenuStrip1.
- Select NotifyIcon component, choose ContextMenuStrip property, and set it to contextMenuStrip1.
- Add ToolStripMenuItem to the ContextMenuStrip, and change it's Text to "Open".
- Add click event handler for the ToolStripMenuItem.
- In the Click event handler, invoke the Show method of the Form to show the main form.
Best regards, Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't. |
| Bruce.Zhou Friday, April 24, 2009 7:05 AM |
First: How to set the contextMenuStrip1 with notifyIcon1->ContextMenuStrip second : I don't have a ToolStripMenuItem , only ToolStrip third : How to use the show method. If you have code, I'm appreciated for that. |
| energybody Friday, April 24, 2009 7:20 AM |
I don't have the code now, but I can write it for you since it's not complex. Can you tell me which programming language you use? and which version of Visual Studio did you use in your machine? Best regards, Bruce Zhou Please mark the replies as answers if they help and unmark if they don't. |
| Bruce.Zhou Friday, April 24, 2009 7:23 AM |
I am using Vista and visiual studio 2008 c++, 2008 is like 2005. |
| energybody Friday, April 24, 2009 7:52 AM |
Hi energybody, I just created a test project here , please let me know if you have any question. Best regards, Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't. - Marked As Answer byenergybody Friday, April 24, 2009 10:17 AM
-
|
| Bruce.Zhou Friday, April 24, 2009 8:26 AM |
where is the ToolStripMenuItem, I can't see it in my project's component. But it can run on my system. |
| energybody Friday, April 24, 2009 9:05 AM |
The ToolStripMenuItem is a sub item in the ContextMenuStrip control. You can select ContextMenuStrip first in the bottom which is next to NotifyIcon component, and then the ContextMenuStrip will appear in the MainMenuStrip location. Click it the ContextMenuStrip, it will drop down the ToolStripMenuItems. Best regards, Bruce Zhou Please mark the replies as answers if they help and unmark if they don't. |
| Bruce.Zhou Friday, April 24, 2009 9:09 AM |
It works. Can you tell me how it work. I don't understand. Why this->show() used twice. It will help anyone who see this question. |
| energybody Friday, April 24, 2009 9:49 AM |
You can open the main form by two ways.
- Double click the icon docked in the System tray.
- Right click the icon, and then the context menu item appears, we click "open" to show the main form.
So I add event handlers for both "double click event" of the NotifyIcon component and "click event" of the "open" ToolStripItem, they both have code to show the main form. Best regards, Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't. - Marked As Answer byenergybody Friday, April 24, 2009 10:17 AM
- Unmarked As Answer byenergybody Friday, April 24, 2009 10:17 AM
-
|
| Bruce.Zhou Friday, April 24, 2009 9:56 AM |
Thanks a lots. |
| energybody Friday, April 24, 2009 10:17 AM |