無奈之際我讀了它的幫助文件,突然發現RealProducer的核心部分就是用ProducerControl.ocx控件編的,這個控件支持從.mpg、.dat、.avi、.mov、.qt 等文件格式到.rm格式的轉換,功能還不差呢!呵呵,真是天助我也!
打開VB新建一個工程,在窗體上添加兩個CommandButton,Name屬性分別是Run和Stop,Caption屬性分別是“開始編碼”與“停止編碼”。再添加兩個TextBox,Name 屬性分別是InputFile和OutPutFile,是用來確定輸入輸出文件名的。依次點擊Project、Components,在Components對話框中選上Real Producer ActiveX Control Library后按下確定,窗體上就會自動加入ProducerControl1控件了。最終的窗體設計請參考附圖。
切換到代碼編輯窗口并輸入以下代碼:
Private Sub Form_Load()
InputFile = ""
OutputFile = ""
ProducerControl1.InputType = INPUT_SOURCE_FILE
ProducerControl1.InputFilename = ""
ProducerControl1.TempDirectory = "c:\temp"
ProducerControl1.OutputFilename = ""
End Sub
Private Sub Run_Click()
ProducerControl1.InputFilename = InputFile
ProducerControl1.OutputFilename = OutputFile
ProducerControl1.StartEncoding
End Sub
Private Sub Stop_Click()
ProducerControl1.StopEncoding
End Sub
以上的代碼只是個演示,只能實現簡單的RM文件制作,如果你還想要挖掘ProducerControl,那么VB中的Object Browser將成為你的好幫手。順便說一句,網上好多的RM制作軟件都是利用ProducerControl.ocx編出來的,只是ProducerControl. visible=False罷了!
程序在VB6+Windows2000下調試通過。
延伸閱讀
文章來源于領測軟件測試網 http://www.kjueaiud.com/