Vb program to control the flash
Familiar with vb friends must know that we can use in VB shockwaveflash to achieve this control program in vb flash animation player, then turn to what we can to control the animation in flash vb program? The answer is yes, we can not only use flash animation to encapsulate vb application interface, and can be manipulated through the flash animation vb program to run.
Please refer to Networking Academy's another article: "DIY your Flash Player"
To control the VB program want flash animation, we must first flash animation of the design process, add some action script (referred to as) scripting language, as in the flash of a called fscommand () function, its main function is to send FScommand command, such as making the animation full screen, hide the animated menus, more important is that external files and programs can communicate (in the VB program, we are using the shockwaveflash control of fscommand () to complete the communication process process, enabling messaging function) and sent out under different commands and parameters to achieve control of the program on VB.
Here I am with a simple search procedure example:
1. First of all open flash5, create a new named "search.fla" animation files, in the main scene into a "search" button and a "Quit" button.
2. Then the two buttons were added as. Search button as to:
file / / send the search command, the command name can be customized.
on (release) (
Fscommand ("search", "OpenURL");
)
Exit button as to:
file / / send the exit command
on (release) (
fscommand ("Exit", "Close");)
The main role of this as is: when the mouse click button to send "search" and "Exit" command, "OpenURL", Close "is fscommand () function parameters, and the size of its writing and in vb program as to be consistent. This animation work is complete, the next is what happened in vb, animation interface shown in Figure 1:
Figure 1
3. Open vb6.0, in VB create a new standard exe project, to make the flash files just released into the swf animation play the file, the output after the "Search.swf" animation file in vb project in the same directory next. Then in the mid-point of right toolbox, select the "parts" command, the showwaveflash control is selected, as shown in Figure 2:
Figure II
[Next]
Then click OK to add controls to the toolbox showwaveflash, as shown in Figure 3:
Figure 3
Double-click the toolbox with over the showwaveflash control icon, the showwaveflash control to the form to, to display the flash animation, and then use a Textbox control to a text input window. Upon completion of the program interface as shown in Figure 4:
Figure 4
Double-click the form, enter the code in edit mode, and enter the following code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd as long, ByVal lpOperation as String, ByVal lpFile as string, ByVal lpParameters as string, ByVal lpDirectory as String, ByVal nShowCmd as long) as long
Api declaration''function here to open the URL
private Sub Form_load ()
Load''of the process and procedures for the same directory search.swf animation
ShockwaveFlash1.Movie = App.Path & "search.swf"
end sub
private sub ShockwaveFlash1_Fscommand (ByVal command as string, nyVa; args as String)
if command = "Search" Then''If you receive a Search command issued flash, then perform the following operation
URL = "http://search.chinese.yahoo.com/search/gb?p =" + text1.text
Web search engine''position of the specified
Call ShellExecute (Form1.hwnd, "open", Url, vbNullString vbnullString, & h0)
Open the browser''to the Chinese Yahoo keyword search
End if
if command = "Exit" then''Exit if the issue is out of order