|
DNC
Server OLE Interface
With a little programming in your favorite
language, it's possible to write your own programs that will command and
control DNC Server.
Example program made in Visual Basic 6.0
dnctest.exe
Dim DNCServer As DNCServerx
Private Sub Command1_Click()
'Load File button
CommonDialog1.ShowOpen
DNCServer.LoadFile (CommonDialog1.FileName)
End Sub
Private Sub Command2_Click()
'clear button
DNCServer.Clear
End Sub
Private Sub Command3_Click()
'send button
DNCServer.Send
End Sub
Private Sub Command4_Click()
'receive button
DNCServer.Receive
End Sub
Private Sub Command5_Click()
'renumber button
DNCServer.Renumber
End Sub
Private Sub Form_Load()
'connect to DNC Server
Set DNCServer = CreateObject("dncserver.dncserverx")
End Sub
Download this Visual Basic example.
Need to have DNC Server properly installed
on your computer for this to work.
Run the dnctest.exe example. DNC Server
will startup if it's not already running.
Press the 'Load File' button and the select
a text file from the dialog box. Then you will see that file loaded into
DNC Server.
In the same way, the other buttons are
connected to other functions in DNC Server.
When loading the example source code Into
Visual Basic 6.0 you need to go to the main menu 'Project' -
"References". In the dialog box find and check "DNCServer Library"
www.i-logic.com/ftp/dnctest.zip
Same thing for Delphi:
www.i-logic.com/ftp/delphiDNCtest.zip
Properties:
- Filename:
Name of file in the edit window.
- Status:
not implemented
- Line(index)
array of strings in the edit window
- BlockIncrement;
for renumber
- StartBlock;
for renumber
These properties are like in the
configuration windows:
- CharDelay
: Integer
- DefaultFileExt
: String
- SendCharAfter
: String
- SendCharBefore
: String
- BaudRate:
integer 300; 600; 1200; 2400; 4800; 9600; 19200;
- EndOfLine:
integer 0= CRLF; 1= LFCRCR; 2=LF; 3= CR< /FONT>
- Format: integer ASCII=1; EIA= 2;
ISO= 3;< /FONT>
- Handshake: integer 0= XON/XOFF; 1=
NONE; 3= DTR; 4= CTS;
- Parity: string 'O'; 'E'; 'N'
- DataBits: integer 7; 8;
- CommPort: integer 1-255
- StopBits: integer 1;2
- SkipComments: Boolean
- DefaultReadDirectory: String
- DefaultSaveDirectory : String
- GetFileString : String
- SaveFileString :
String
- ResetString : String
- AutoSaveString : String
Methods:
- LoadFile(FileName)
- SaveFile(Filename); saves edit
window to filename
- Abort: Like pressing the Stop
button
- Clear: Like pressing the Clear
button
- Close: Like pressing the Close
button
- Receive: Like pressing the Receive
button
- Renumber
- Save: Like pressing the Save button
- Send: Like pressing the Send button
- GetNumberofLines: Returns number of
lines in the editor
- SendLine(String): Outputs a line of
text to the serial port
- Note(string); writes in the main
status line
Back
|