Click here to Skip to main content
15,894,343 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
permutations16-Mar-10 14:16
permutations16-Mar-10 14:16 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
Rolf Kristensen16-Mar-10 14:21
Rolf Kristensen16-Mar-10 14:21 
GeneralRe: persistent crash on tester's computers that I can't reproduce [modified] Pin
permutations17-Mar-10 3:31
permutations17-Mar-10 3:31 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
permutations17-Mar-10 12:07
permutations17-Mar-10 12:07 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
permutations18-Mar-10 10:09
permutations18-Mar-10 10:09 
QuestionSystem Tray Icon Pin
MrMcIntyre15-Mar-10 9:40
MrMcIntyre15-Mar-10 9:40 
AnswerRe: System Tray Icon Pin
Stuart Dootson15-Mar-10 10:04
professionalStuart Dootson15-Mar-10 10:04 
AnswerRe: System Tray Icon Pin
LouisLewis15-Mar-10 10:09
LouisLewis15-Mar-10 10:09 
Hi Andrew,

I hope this code will help you out.

What i normally do is first setup the basic funtionality for the try icon, something like this:
      this->notifyIcon1->BalloonTipIcon = System::Windows::Forms::ToolTipIcon::Info;
      this->notifyIcon1->Icon = (cli::safe_cast<System::Drawing::Icon^ >resources->GetObject(L"notifyIcon1.Icon")));
      this->notifyIcon1->Text = L"Helios Options";
      this->notifyIcon1->Visible = true;
      this->notifyIcon1->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::notifyIcon1_MouseDoubleClick)
<pre>

Then i create a funtion that takes a couple of arguments to write and display certain text:
<pre>private: System::Void DoNotify(System::String^ Titlex, System::String^ Message, int Timeout)
		{
			notifyIcon1->ShowBalloonTip(Timeout,Titlex,Message,System::Windows::Forms::ToolTipIcon::Info);
		}
<pre>

I then use the funtion like this:
<pre>DoNotify("Helios Minimised","Helios is still running\r\nDouble click icon to maximise",5);



I then handle the form resize funtion, this will show and hide the main window


private: System::Void Form1_Resize(System::Object^  sender, System::EventArgs^  e) 
		 {
			 if(FormWindowState::Minimized == this->;WindowState)
			 {
				DoNotify("Helios Minimised","Helios is still running\r\nDouble click icon to maximise",5);
				this->Hide();
			 }
			 else if(FormWindowState::Normal == this->WindowState)
			 {

			 }
		 }


Then finally i hadle the function we created a event handler for at the notifyicon:

private: System::Void notifyIcon1_MouseDoubleClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) 
		 {
			 this->Show();
			 this->WindowState = FormWindowState::Normal;
		 }


I hope this will help you a little more.
Let me know if there is anything else i can help with.

Louis
GeneralRe: System Tray Icon Pin
MrMcIntyre15-Mar-10 10:12
MrMcIntyre15-Mar-10 10:12 
GeneralRe: System Tray Icon Pin
LouisLewis15-Mar-10 10:15
LouisLewis15-Mar-10 10:15 
GeneralRe: System Tray Icon Pin
MrMcIntyre15-Mar-10 10:18
MrMcIntyre15-Mar-10 10:18 
GeneralRe: System Tray Icon Pin
LouisLewis15-Mar-10 10:31
LouisLewis15-Mar-10 10:31 
GeneralRe: System Tray Icon Pin
MrMcIntyre15-Mar-10 10:32
MrMcIntyre15-Mar-10 10:32 
GeneralRe: System Tray Icon Pin
LouisLewis15-Mar-10 11:06
LouisLewis15-Mar-10 11:06 
AnswerRe: System Tray Icon Pin
David Crow15-Mar-10 10:35
David Crow15-Mar-10 10:35 
GeneralRe: System Tray Icon Pin
MrMcIntyre15-Mar-10 11:34
MrMcIntyre15-Mar-10 11:34 
GeneralRe: System Tray Icon Pin
LouisLewis15-Mar-10 11:49
LouisLewis15-Mar-10 11:49 
QuestionRe: System Tray Icon Pin
David Crow15-Mar-10 16:48
David Crow15-Mar-10 16:48 
AnswerRe: System Tray Icon [modified] Pin
MrMcIntyre16-Mar-10 6:39
MrMcIntyre16-Mar-10 6:39 
AnswerRe: System Tray Icon Pin
David Crow16-Mar-10 7:42
David Crow16-Mar-10 7:42 
GeneralRe: System Tray Icon Pin
MrMcIntyre16-Mar-10 7:49
MrMcIntyre16-Mar-10 7:49 
GeneralRe: System Tray Icon Pin
David Crow16-Mar-10 7:54
David Crow16-Mar-10 7:54 
GeneralRe: System Tray Icon [modified] Pin
MrMcIntyre16-Mar-10 9:59
MrMcIntyre16-Mar-10 9:59 
QuestionClient /Server application with VPN connection Pin
Bugslayer115-Mar-10 9:22
Bugslayer115-Mar-10 9:22 
AnswerRe: Client /Server application with VPN connection Pin
22491715-Mar-10 13:54
22491715-Mar-10 13:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.