[VB] hoe weet je welke programmas COM ondersteunen

Pagina: 1
Acties:

  • GiLuX
  • Registratie: Juni 1999
  • Laatst online: 12-11-2025
stiekum gaat deze vraag over php maar dan krijg ik waarschijnlijk een stuk minder antwoorden.

met onderstaande VB code kan je bv word openen:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
   Dim docNew As Word.Document

    ' Add new document to Documents collection.
    Set docNew = Documents.Add
    ' Type text into document.
    Selection.TypeText "Four score and seven years ago"
    ' Display document name and count of words, and then close document without
    ' saving changes.
    With docNew
       MsgBox "'" & .Name & "' contains " & .Words.Count & " words."
       .Close wdDoNotSaveChanges
    End With
    Set docNew = Nothing

dit voorbeeld is voor word maar hoe kan ik erachter komen hoe dit bv voor mediaplayer werkt?

staat er ergens een lijst op microsoft.com/com waar dit voor elk programma te vinden is?
dus bv:

Object type..............Class name
Access application.......Access.Application
Excel application........Excel.Application
Excel workbook...........Excel.Sheet Excel.Chart
FrontPage application....FrontPage.Application
Outlook application......Outlook.Application
PowerPoint application...PowerPoint.Application
Word application.........Word.Application
Word document............Word.Document

ik heb dit lijstje kunnen vinden maar ik zou bv ook willen weten hoe je media player en andere apps aanroept.

wie weet waar je deze info vandaan kan halen?

"I disagree with what you are saying, but I will defend to the death your right to say it." -- not clear who


  • GiLuX
  • Registratie: Juni 1999
  • Laatst online: 12-11-2025
dit is precies wat ik zocht :)
tnx a million.

een vraagje,

ik browse bv door "wave sound" en daar staat:

ProgId: SoundRec
Ole1Class: SoundRec

is dat de naam waar ik naar moet zoeken?
maw, moet je het dan zo doen?:

Dim recNew As SoundRec.Document

ik krijg onder php dan deze fout:

warning: invalid ProgId or Moniker

(onder php doe je dan nl:
$sndrec=new COM("SoundRec.Application");
)

ik heb echt de ballen verstand van VB dus ik gok het maar een beetje.

"I disagree with what you are saying, but I will defend to the death your right to say it." -- not clear who


  • GiLuX
  • Registratie: Juni 1999
  • Laatst online: 12-11-2025
en nog een vraag dan maar,

hoe kan je met die object viewer bv alle methodes van een object te zien krijgen?

"I disagree with what you are saying, but I will defend to the death your right to say it." -- not clear who


Verwijderd

view typelibray

  • GiLuX
  • Registratie: Juni 1999
  • Laatst online: 12-11-2025
hmm,

ik browse als volgt:
-Document objects
+microsoft word-document

daar right klik ik op view type information
krijg ik een:library not registered melding

word doet het verder prima,
is een verse install op versie win98 install.

wat ik eigenlijk wil bereiken is dat ik bv soundrecorder kan openen en vervolgens een wavje inladen en spelen met php.

dit is de code om zoiets dergelijks met php te doen dmv COM:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 // starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";
 
//bring it to front
$word->Visible = 1;
 
//open an empty document
$word->Documents->Add();
 
//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
 
//closing word
$word->Quit();
 
//free the object
$word->Release();
$word = null;

dit werkt perfect,
maar dit heb ik niet zelf bedacht.

en als je weet hoe het in VB werkt is het niet zo moeilijk om dit om te schrijven naar de php manier,

in VB: Selection.typetext "bla"
in php: Selection->typetext("bla");

"I disagree with what you are saying, but I will defend to the death your right to say it." -- not clear who


  • GiLuX
  • Registratie: Juni 1999
  • Laatst online: 12-11-2025
hangen hier nog ervaren VB specialisten rond die hier iets mee kunnen?

vraag is:
hoe kan je een overzichtelijk lijstje van methodes te zien krijgen?

"I disagree with what you are saying, but I will defend to the death your right to say it." -- not clear who


Verwijderd

2e maal (dit maal maar wat uitgebreider) bekijk de typelibrary van de door het object ondersteunde interfaces.

  • GiLuX
  • Registratie: Juni 1999
  • Laatst online: 12-11-2025
ok ok,

ik vroeg me alleen af of het ook op een andere manier kan omdat ik dan die fout melding krijg.
(library not registered)

"I disagree with what you are saying, but I will defend to the death your right to say it." -- not clear who


Verwijderd

Oh mijn god! dubbelklikken werkt niet! *PANIEK*.....

File->viewTypelib, filetje aanklikken. Hoppa!

  • GiLuX
  • Registratie: Juni 1999
  • Laatst online: 12-11-2025
ik weet niet wat jouw probleem is??

maar reageer dan gewoon niet joh!

zoals ik nu voor de 3e keer zeg,
view type information
werkt dus niet!

ik vraag gewoon waar dat aan kan liggen.

heb ik je iets misdaan ofzo??

djeeezzz :(

"I disagree with what you are saying, but I will defend to the death your right to say it." -- not clear who


Verwijderd

Ik heb geen probleem hoor, je moet niet alles als pa opvatten ;)

Maar zo komen we er niet echt, als je vb hebt ga naar references, klik wat typelibs naar aan en bekijk dan met de object browser (F2) alle methods en properties.

kan wellicht geen kwaad om je wat verder in com te verdiepen ipv "jah ik zit gewoon wat te klikken en het werkt niet"

http://www.microsoft.com/com/
Pagina: 1