Re: Windows COM programming.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I might be able to provide a little insight, but all my code that I've done COM work with is at home so I can't send you any samples right this second.

I've used PHP and COM to interface with Excel, Outlook and MapPoint.  I'm not terribly familiar with using Objects with PHP, but have done a ton of VBA coding so I was able to figure most of it out.

If you happen to have Excel or Word or most any other MS Office product installed (which I'm sure you do, since you're doing COM stuff.. although not necessarily) then you have access to the VBA editor that most of them have.  This can be very helpful in telling you what properties, methods and objects are available.

Microsoft sometimes has good (sometimes not so good) data models in their knowledge base that illustrate everything you can do via COM or VBA.  MapPoint's data model is excellent.  I think Excel's was ok too (mostly I used Excel's VBA Help file though) but some are just super poorly documented on MS's site.

Do you have a specific program you're trying to interface with?  Any specific problems?

If you search Yahoo or Google for "php com excel" or "php com word", that might narrow it down a bit.

Just remember:

Properties are things you can read a value from and most of the time set as well (ie font color.. with no parameters it'll usually return the current color, setting a parameter changes the color)

Methods are actions, like to select a cell in Excel, calculate directions in MapPoint, etc.  Typically these don't take parameters(?) but I think they can sometimes.  I think that's what I never got the hang of before.. passing parameters to methods, but I think you can do it.

Objects are things that have properties or can use methods.  A MailItem in Outlook for example.  It has a read/unread flag (property), or an Excel Application object might have a Calculate method as well as a Saved (is it saved or not) property.

Collections are groups of objects. Usually you'd cycle through them like when you do a 'foreach' in PHP, although I don't think you can typically use 'foreach' with PHP and COM, I think you need to get a Count of items (.Count property) then cycle using a for loop and using the 'for' value as your index number for the collection (eg item($i), or item(2), etc).

Drop me a line later to remind me, and maybe I can dig up some of my sample code for MapPoint and Outlook and such.  I know I posted some Outlook calendar code to either PHP General or PHP Windows recently.

Good luck Dave!

-TG

= = = Original message = = =

Hi,
Anyone got any good pointers to COM programming in PHP under windows?
Searching for com in google has been no help to me :-)
http://www.zend.com/tips/tips.php?id=262&single=1 and
http://www.php.net/manual/en/ref.com.php have been quite helpful, but
I'm sure there is much more to see.

Dave.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux