CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Object: SpObjectToken
Type: Hidden

GetStorageFileName Method


The GetStorageFileName method creates a storage file for data associated with the object token.


SpObjectToken.GetStorageFileName(
     ObjectStorageCLSID As String,
     KeyName As String,
     FileName As String,
     Folder As SpeechTokenShellFolder
) As String

Parameters

ObjectStorageCLSID
Globally unique identifier (GUID) of the calling object. The method searches the registry for an entry key name of ObjectStorageCLSID, and then a corresponding Files subkey. If the registry entry is not present, one is created.
KeyName
The name of the attribute file for the registry entry of clsidCaller. This attribute stores the location of the resource file.
FileName
A specifier that is either "" or a path/file name for storage file.
Folder
One or more SpeechTokenShellFolder constants specifying the Folder.

Return Value

A String variable containing the path of the storage file.


Example

The following Visual Basic form code demonstrates the GetStorageFileName and RemoveStorageFileName methods. To run this code, create a form with the following controls:

  • Four command buttons, called Command1, Command2, Command3, and Command4
  • Paste this code into the Declarations section of the form.

    The operations performed in this example can best be viewed with REGEDIT.EXE. For a discussion of Registry issues, please see the ISpeechDataKey interface.

    The Form_Load procedure creates a new SpObjectToken object, and sets its ID property to a new subfolder called Demo within the Voices\Tokens folder. The True parameter of the SetId call forces the creation of this folder, if it does not already exist.

    The Command1 procedure creates a data key object which references the new Demo folder, and uses the data key to write a value into the folder.

    The Command2 procedure calls the GetStorageFileName method. After this call, the Demo folder contains a subfolder called {CDD1141B-82FB-405c-99BE-69A793A92D87}. This is the CLSID used as a parameter of the GetStorageFileName method. Within this is a folder called Files, which contains a the storage file path in a value called Demo.

    The Command3 procedure calls the RemoveStorageFileName method. This deletes the storage file, and removes the Demo value from the Files folder.

    The Command4 procedure uses the ISpeechDataKey.Remove method to delete the {CDD1141B-82FB-405c-99BE-69A793A92D87} folder and Demo folders.


    Option Explicit
    
    Dim T As SpeechLib.SpObjectToken            'one object token
    Dim C As SpeechLib.SpObjectTokenCategory    'one object token category
    Dim K As SpeechLib.ISpeechDataKey           '
    Dim ID As String
    Dim SF As String                            'Storage file name
    Dim TestCLSID As String
    
    Private Sub Command1_Click()
    
        'Set data key object to the demo voice's folder,
        'Write a CLSID value
        Set K = T.DataKey
        K.SetStringValue "CLSID", TestCLSID
        
    End Sub
    
    Private Sub Command2_Click()
    
        'Create a storage file for the token
        SF = T.GetStorageFileName(TestCLSID, "Demo", vbNullString, _
                                  STSF_FlagCreate + STSF_AppData)
        MsgBox SF
    
    End Sub
    
    Private Sub Command3_Click()
    
        'Remove the storage file
        Call T.RemoveStorageFileName(TestCLSID, "Demo", True)
    
    End Sub
    
    Private Sub Command4_Click()
    
        'Remove the "{CDD1141B-82FB-405c-99BE-69A793A92D87}" folder,
        'and the "Demo" folder
        T.Remove TestCLSID
        T.Remove ""
    
    End Sub
    
    Private Sub Form_Load()
    
        TestCLSID = "{CDD1141B-82FB-405c-99BE-69A793A92D87}"
    
        'Create new category object, set it to Voices category
        Set C = New SpObjectTokenCategory
        C.SetId SpeechCategoryVoices
        
        'Create new token object, and set its ID
        'to the path of a folder which does not exist
        '"True" parameter creates the folder
        
        Set T = New SpObjectToken
        ID = SpeechCategoryVoices & "\Tokens\Demo"
        T.SetId ID, , True
        
    End Sub


    You are reading help file online using chmlib.com

    If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
    Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web