creating icon in system tray
12 posts
• Page 1 of 2 • 1, 2
creating icon in system tray
hello,
I am using phalanger beta version, I need a help on how to create a icon of any application on system tray, after installation.
When we double click on the icon it has to popup a small window where it has to show information about the application.
Is this application can be done using phalanger.
Thanks
I am using phalanger beta version, I need a help on how to create a icon of any application on system tray, after installation.
When we double click on the icon it has to popup a small window where it has to show information about the application.
Is this application can be done using phalanger.
Thanks
- nagraj@codeplex
- Posts: 24
- Joined: January 7th, 2012, 8:55 pm
RE: creating icon in system tray
Hi,
You can build such an application using Phalanger. Please refer to the System.Windows.Forms.NotifyIcon class.
A little example to get you started:
<?
import namespace System:::Windows:::Forms;
import namespace System:::Drawing;
$x = new NotifyIcon;
$x->Icon = new Icon("sample.ico");
$x->Text = "Tooltip";
$x->Click->Add("OnClick");
$x->Visible = TRUE;
Application::Run();
function OnClick()
{
global $x;
$x->Visible = FALSE;
Application::i'Exit'();
}
?>
You can build such an application using Phalanger. Please refer to the System.Windows.Forms.NotifyIcon class.
A little example to get you started:
<?
import namespace System:::Windows:::Forms;
import namespace System:::Drawing;
$x = new NotifyIcon;
$x->Icon = new Icon("sample.ico");
$x->Text = "Tooltip";
$x->Click->Add("OnClick");
$x->Visible = TRUE;
Application::Run();
function OnClick()
{
global $x;
$x->Visible = FALSE;
Application::i'Exit'();
}
?>
- Lada Prosek
- Posts: 47
- Joined: January 7th, 2012, 8:52 pm
RE: creating icon in system tray
The command line should look like this when compiling the above example:
phpc Sample.php /target:winexe /lang:clr /r:System.Drawing /r:System.Windows.Forms
phpc Sample.php /target:winexe /lang:clr /r:System.Drawing /r:System.Windows.Forms
- Tomas Matousek
- Posts: 17
- Joined: January 7th, 2012, 8:52 pm
RE: creating icon in system tray
Thanks for ur solutions.
Now i am facing a problem, i am getting syntax error: unexpected token 'namespace'. Do i have to install any software.
Now i am facing a problem, i am getting syntax error: unexpected token 'namespace'. Do i have to install any software.
- nagraj@codeplex
- Posts: 24
- Joined: January 7th, 2012, 8:55 pm
RE: creating icon in system tray
And what command line arguments do you enter? By default, Phalanger compiles in PHP5-compatible mode, which doesn't support namespaces. You must enter /lang:clr in order to enable namespaces.
- Tomas Matousek
- Posts: 17
- Joined: January 7th, 2012, 8:52 pm
RE: creating icon in system tray
how will you popup some application when you click on the icon.
And also I want to know whether we can create a file like .msi, using phalanger.
Since i am new to phalanger, I need to get basic command lines.
Thanks in advance
And also I want to know whether we can create a file like .msi, using phalanger.
Since i am new to phalanger, I need to get basic command lines.
Thanks in advance
- nagraj@codeplex
- Posts: 24
- Joined: January 7th, 2012, 8:55 pm
RE: creating icon in system tray
WinForms applications built with Phalanger are no different than WinForms applications compiled by any other .NET compiler like C# or VB.NET when it comes to questions like "How do I popup a window".
If you are unfamiliar with the .NET Framework and WinForms in particular, I would recommend a book (there are loads of books covering these topics) or try browsing MSDN which is primary reference.
http://msdn2.microsoft.com/en-us/library/ms229601.aspx
The books, articles, and how-tos usually contain examples in C# or VB.NET, so you should have basic understanding of one of these languages. Then it's quite easy to transform the examples to PHP and compile them with Phalanger.
As for the .MSI question, there is a lot of both free and commercial software for building installation packages. In most cases, the Deployment project in Visual Studio is a sufficient tool. But again, this is not directly a Phalanger thing. The task of Phalanger is to compile PHP to MSIL.
If you are unfamiliar with the .NET Framework and WinForms in particular, I would recommend a book (there are loads of books covering these topics) or try browsing MSDN which is primary reference.
http://msdn2.microsoft.com/en-us/library/ms229601.aspx
The books, articles, and how-tos usually contain examples in C# or VB.NET, so you should have basic understanding of one of these languages. Then it's quite easy to transform the examples to PHP and compile them with Phalanger.
As for the .MSI question, there is a lot of both free and commercial software for building installation packages. In most cases, the Deployment project in Visual Studio is a sufficient tool. But again, this is not directly a Phalanger thing. The task of Phalanger is to compile PHP to MSIL.
- Lada Prosek
- Posts: 47
- Joined: January 7th, 2012, 8:52 pm
RE: creating icon in system tray
hi,
I tried to compile the code, initially i was able to compile it properly. Later for some of the codes, I am getting an error, saying that "System.Drawing" could not be loaded.
I have used "phpc test.php /target:winexe /lang:clr /r:System.Drawing /r:System.Windows.Forms" in the command line.
And also for some of the code, it compiles porperly but when i tried to execute it, i will get a popup window indicating that "test.exe has encountered a problem and needs to close."
I tried to uninstall .netframe work and install it again. I found same problem
I tried to compile the code, initially i was able to compile it properly. Later for some of the codes, I am getting an error, saying that "System.Drawing" could not be loaded.
I have used "phpc test.php /target:winexe /lang:clr /r:System.Drawing /r:System.Windows.Forms" in the command line.
And also for some of the code, it compiles porperly but when i tried to execute it, i will get a popup window indicating that "test.exe has encountered a problem and needs to close."
I tried to uninstall .netframe work and install it again. I found same problem
- nagraj@codeplex
- Posts: 24
- Joined: January 7th, 2012, 8:55 pm
RE: creating icon in system tray
Can you post the code which you are unable to compile or unable to run?
Thanks.
Thanks.
- Lada Prosek
- Posts: 47
- Joined: January 7th, 2012, 8:52 pm
RE: creating icon in system tray
you can consider the code one which you had given.
When I am using 'xterm' to compile the code, I won't get any error or warning. I use 'z-shell' to execute the code.
When I use Phalanger command prompt, I get error while compiling the code.
When I am using 'xterm' to compile the code, I won't get any error or warning. I use 'z-shell' to execute the code.
When I use Phalanger command prompt, I get error while compiling the code.
- nagraj@codeplex
- Posts: 24
- Joined: January 7th, 2012, 8:55 pm
12 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 3 guests