note 98745 added to class.dotnet
| From: | Anonymous at osu1 dot php dot net | Date: | Mon, 05 Jul 2010 00:17:31 +0000 |
| Subject: | note 98745 added to class.dotnet | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170697@lists.php.net to get a copy of this message | ||
As suggested before, you'll likely have to use a full assembly string including the assembly
name, the assembly version (not the dll file version), the culture, and the public key token.
Otherwise, you'll get a 'file not found' catchable error. To quickly find this on
your own system to get the ball rolling, open C:\Windows\assembly in explorer (not in cmd as that
shows a different view), scroll down the list until you find the assembly you want to work with,
hover the mouse over it, and the tooltip shows the exact string to use (though
processcorArchitecture if shown is optional). You'll have to use .net utilities or other
methods to automate collecting this info on other machines.
You'll also have to use the fully-qualified class name. In other words, if you want to use the
'Form' class within 'System.Windows.Forms', you have to use the full class
hierarchy 'System.Windows.Forms.Form'. Otherwise you'll get an unhelpful
'Failed to instantiate .Net object' catchable error.
The following example shows the correct syntax to use the 'Form' class to pop up a blank
form from php-cli, which can be used in leu of many Windows GUI PHP extensions out there. Replace
Version with your local version, and PublicKeyToken with your own local key token.
<?php
$full_assembly_string = 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=a8425bc35256e463';
$full_class_name = 'System.Windows.Forms.Form';
$form = new DOTNET($full_assembly_string, $full_class_name);
// code to add buttons, menus, text, etc
$form->Show();
$form_event = '';
while($form_event !== 'close') {
// handle form functions and events
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 70.124.94.109
----
Manual Page -- http://www.php.net/manual/en/class.dotnet.php
Edit -- https://master.php.net/note/edit/98745
Del: integrated -- https://master.php.net/note/delete/98745/integrated
Del: useless -- https://master.php.net/note/delete/98745/useless
Del: bad code -- https://master.php.net/note/delete/98745/bad+code
Del: spam -- https://master.php.net/note/delete/98745/spam
Del: non-english -- https://master.php.net/note/delete/98745/non-english
Del: in docs -- https://master.php.net/note/delete/98745/in+docs
Del: other reasons-- https://master.php.net/note/delete/98745
Reject -- https://master.php.net/note/reject/98745
Search -- https://master.php.net/manage/user-notes.php