Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access/Assign in COM Object?
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00481355
Message ID:
00484009
Views:
14
>I am trying to get something simple and am tripping somewhere. Can you tell me wat you did in your example that I didn't?
>
>
>Define Class killthis as Custom OLEPublic
>
>cSourceName = "SOURCENAME"
>
>Procedure cSourceName_Assign
>  Parameters cNothing
   <b>This.cSourceName = cNothing</b>
>  ? This.cSourceName + "!"
>  This.PlayWavAPI("c:\winnt\media\birp.wav")		
>EndProc
>
>Function Init
>  lParameters cOne
>  This.cSourceName = cOne
>  Return .t.
>EndFunc
>Function Destroy
>EndFunc
>
>Function PlayWavAPI
>  Parameters pcWavfile
>  Declare Integer mciSendString IN WINMM String sendstr, Integer retstr, Integer szret, Integer callback
>  mciSendString("open "+FullPath(pcWavfile) + " type waveaudio alias mmwav", 0, 0, 0)
>  mciSendString("play mmwav wait", 0, 0, 0)
>  mciSendString("close mmwav", 0, 0, 0)
>  Return .t.
>EndFunc
>
>
>At the command window, I did:
>
>Set Procedure to d:\wintemp\killthis
>oK = CreateObject("killthis", <b>"aa"</b>)
><b>*</b> ? oK.init("aa")
>
>
>But I thought I would see "aa" as a return value but instead I get "SOURCENAME!.T.". The birp.wav is playing, so I know the Assign method is firing. Where did I goof?

The "goof" is that you did not actually assign the value. I've made the necessary modification in bold above. The assign event allows you to change or even by-pass the assignment of the variable. Note also that the Init even fires on CreateObject() and to pass a parameter to it all you have to do is pass it there (again in bold above).

>Btw, I'm now checking with my social secretary for other Philly bakery options. :)

< bg >
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform