creating icon in system tray

Discussion about the open-source Phalanger [?] project.

creating icon in system tray

Postby nagraj@codeplex » August 12th, 2006, 12:37 pm

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
nagraj@codeplex
 
Posts: 24
Joined: January 7th, 2012, 8:55 pm

RE: creating icon in system tray

Postby Lada Prosek » August 12th, 2006, 11:58 pm

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'();
}
?>
Lada Prosek
 
Posts: 47
Joined: January 7th, 2012, 8:52 pm

RE: creating icon in system tray

Postby Tomas Matousek » August 13th, 2006, 9:05 am

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
Tomas Matousek
 
Posts: 17
Joined: January 7th, 2012, 8:52 pm

RE: creating icon in system tray

Postby nagraj@codeplex » August 16th, 2006, 1:01 pm

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.
nagraj@codeplex
 
Posts: 24
Joined: January 7th, 2012, 8:55 pm

RE: creating icon in system tray

Postby Tomas Matousek » August 16th, 2006, 7:28 pm

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

Postby nagraj@codeplex » August 18th, 2006, 1:01 pm

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
nagraj@codeplex
 
Posts: 24
Joined: January 7th, 2012, 8:55 pm

RE: creating icon in system tray

Postby Lada Prosek » August 19th, 2006, 10:41 am

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.
Lada Prosek
 
Posts: 47
Joined: January 7th, 2012, 8:52 pm

RE: creating icon in system tray

Postby nagraj@codeplex » August 23rd, 2006, 1:49 pm

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



nagraj@codeplex
 
Posts: 24
Joined: January 7th, 2012, 8:55 pm

RE: creating icon in system tray

Postby Lada Prosek » August 23rd, 2006, 8:14 pm

Can you post the code which you are unable to compile or unable to run?
Thanks.
Lada Prosek
 
Posts: 47
Joined: January 7th, 2012, 8:52 pm

RE: creating icon in system tray

Postby nagraj@codeplex » August 24th, 2006, 6:34 am

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.
nagraj@codeplex
 
Posts: 24
Joined: January 7th, 2012, 8:55 pm

Next

Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 3 guests

cron

User Control Panel

Login

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 787 on May 12th, 2024, 11:50 am

Users browsing this forum: No registered users and 3 guests