Applies To:
  • CitectSCADA 5.21

Summary:
MS Web Browser ActiveX - shdocvw.dll (a component of IE 5.0) could be used with Citect V521 or above. Make sure the component exists on your PC. It is normally located in the directory \WINNT\SYSTEM32 for NT and Windows2000, \WINDOWS\SYSTEM for Windows98. 

Solution:
Here is an example of how to print an HTML file with shdocvw.dll.

1. Find the "Example" project and append the attached code to the file ActiveX.ci.

2. Create a new page called "File_HTM".

3. Create an instance of the "Microsoft Web Browser" on the page

4. Create a button called "Open" on the page to call the function, HtmFileOpen(STRING An, STRING FileName), to open an html file. The first argument is the animation point occupied by the ActiveX object, and the second one is the html filename including its path. For example, if you want to list all html files in the Citect data folder, you should link the command HtmFileOpen("AN35", "[DATA]:\*.htm"), with the button where "AN35" is the animation point occupied by the object.

5. Create a button called "Print" on the page to call the function, HtmFilePrint (STRING An, INT PrintPrompt), to print the displayed file where the second argument is the print option.

6. Create a button called "Refresh" on the page to call the function, HtmFileRefresh (STRING An) to refresh the opened file.

Note: if you want to open a default file whenever the page "File_HTM" is open. Add the function HtmFileDefault("An35", "your file") to the OnPageEntry event.

FUNCTION HtmFileDefault(STRING An, STRING FileName)
STRING sFile;

    sPath = FileName;
    _ObjectCallMethod(ObjectByName(An), "Navigate", 
    sFile, 0, 0, 0 ,0);
    RETURN sFile;

END

FUNCTION HtmFileRefresh(STRING An)
    IF PageInfo(0) = "File_Htm" THEN
    _ObjectCallMethod(ObjectByName(An), "Refresh")
    END
END

FUNCTION HtmFileOpen(STRING An, STRING FileName)
STRING sFile;

    sFile = FormOpenFile("Open", FileName, "*.htm");
    IF sFile <> "" THEN
    _ObjectCallMethod(ObjectByName(An), "Navigate", 
    sFile, 0, 0, 0 ,0);
    END
END

FUNCTION HtmFilePrint(STRING An, INT PrintPrompt=1)
//PrintPrompt: 0 -Default;
//             1 -Prompt to users
//             2 -Don't prompt to users
    _ObjectCallMethod(ObjectByName(An), "ExecWB", 
    6, PrintPrompt, 0, 0);
END

 

Keywords:
 

Attachments