PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > WIN32OLE - problem with argv
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
WIN32OLE - problem with argv

Réponse
 
LinkBack Outils de la discussion
Vieux 02/12/2007, 22h45   #1
Rainer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut WIN32OLE - problem with argv

Hello,

I'm having a problem trying to pass parameters by reference with
WIN32OLE::ARGV. What I'm actually trying to do is getting access to
OneNote 2007 as described here...

http://msdn2.microsoft.com/de-de/lib...84(en-us).aspx

....but using Ruby instead.

Here's my little program:

-----
require "win32ole"
one = WIN32OLE.new("onenote.application")

class ON_CONST
end
WIN32OLE.const_load(one, ON_CONST)

a_string = ''

one.GetHierarchy(nil,ON_CONST::HsPages,a_string)
-----

GetHierarchy should pass the Hierarchy of OneNote pages into
"a_string" (I think). However, WIN32OLE::ARGV leaves "a_string" empty:

p WIN32OLE::ARGV
prompt> [-2147352572, 4, ""]

Using invoke won't make a difference:

one.invoke("GetHierarchy", nil,ON_CONST::HsPages,a_string)
p WIN32OLE::ARGV
prompt> [-2147352572, 4, ""]


Does anybody have an idea what I'm getting wrong? (I'm using Ruby
1.8.6)

Kind regards,

Rainer

P.S.: Any example for a successful pass by reference is appreciated,
even with another Office program like Excel or Word.

P.P.S.: I already have read the earlier discussion from Nov. 14 about
the same problem.


  Réponse avec citation
Vieux 02/12/2007, 23h31   #2
Masaki Suketa
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: WIN32OLE - problem with argv

Hello,

Rainer wrote:

> Here's my little program:
>
> -----
> require "win32ole"
> one = WIN32OLE.new("onenote.application")
>
> class ON_CONST
> end
> WIN32OLE.const_load(one, ON_CONST)
>
> a_string = ''
>
> one.GetHierarchy(nil,ON_CONST::HsPages,a_string)


I have not used OneNote 2007, so I'm not sure, but
could you try to use empty string (="") instead of nil as 1st argument?

one.GetHierarchy("",ON_CONST::HsPages,a_string)

Regards,
Masaki Suketa

  Réponse avec citation
Vieux 02/12/2007, 23h56   #3
Masaki Suketa
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: WIN32OLE - problem with argv

Masaki Suketa wrote:
> > one.GetHierarchy(nil,ON_CONST::HsPages,a_string)

>
> one.GetHierarchy("",ON_CONST::HsPages,a_string)
>


Or try to use WIN32OLE#_invoke method.
include WIN32OLE::VARIANT
one._invoke(dispid, ["", ON_ONST::HsPages, a_string],
[VT_BSTR, VT_I4, VT_BSTR|VT_BYREF])
The dispid should be dispatch id of GetHierarchy method.

Regards,
Masaki Suketa


  Réponse avec citation
Vieux 03/12/2007, 01h29   #4
Rainer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: WIN32OLE - problem with argv

On 3 Dez., 00:56, Masaki Suketa <masaki.suk...@nifty.ne.jp> wrote:
> Masaki Suketa wrote:
>
> > > one.GetHierarchy(nil,ON_CONST::HsPages,a_string)

> >
> > one.GetHierarchy("",ON_CONST::HsPages,a_string)
> >

>
> Or try to use WIN32OLE#_invoke method.
> include WIN32OLE::VARIANT
> one._invoke(dispid, ["", ON_ONST::HsPages, a_string],
> [VT_BSTR, VT_I4, VT_BSTR|VT_BYREF])
> The dispid should be dispatch id of GetHierarchy method.
>
> Regards,
> Masaki Suketa


Dear Masaki,

thank you very much, that did the trick! Now I'm getting a massive XML
string as promised!

Kind regards,

Rainer
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h55.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10206 seconds with 12 queries