jossul Posted May 21, 2007 Share Posted May 21, 2007 Hi! I created dll in C# and trying to use it in PHP. I'm creating new com object, but the problem is that the class inherits from another class (standard c# class) and the constractor has a parameter. How do I make it work? $var = new com (object.class, parameter) doesn't seem to work in this case. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/52321-php-new-com-object-help/ Share on other sites More sharing options...
MadTechie Posted May 21, 2007 Share Posted May 21, 2007 check DOM & COM example <?php function SpellCheck($input) { $word=new COM("word.application") or die("Cannot create Word object"); $word->Visible=false; $word->WindowState=2; $word->DisplayAlerts=false; $doc=$word->Documents->Add(); $doc->Content=$input; $doc->CheckSpelling(); $result= $doc->SpellingErrors->Count; if($result!=0) { echo "Input text contains misspelled words.\n\n"; for($i=1; $i <= $result; $i++) { echo "Original Word: " .$doc->SpellingErrors[$i]->Text."\n"; $list=$doc->SpellingErrors[$i]->GetSpellingSuggestions(); echo "Suggestions: "; for($j=1; $j <= $list->Count; $j++) { $correct=$list->Item($j); echo $correct->Name.","; } echo "\n\n"; } } else { echo "No spelling mistakes found."; } $word->ActiveDocument->Close(false); $word->Quit(); $word->Release(); $word=null; } $str="Hellu world. There is a spellling error in this sentence."; SpellCheck($str); ?> Quote Link to comment https://forums.phpfreaks.com/topic/52321-php-new-com-object-help/#findComment-258160 Share on other sites More sharing options...
trq Posted May 21, 2007 Share Posted May 21, 2007 Sorry MadTechie, but dom has nothing to do with com. As for passing a parameter to the construct, I'm not sure its possible. How would you normally do so in say vbscript? Quote Link to comment https://forums.phpfreaks.com/topic/52321-php-new-com-object-help/#findComment-258164 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.