Board index » delphi » ICP And DocOutput

ICP And DocOutput

I am trying to convert the following code, Can anyone help me in doing
this?

This is for microsofts icp, particulary the NNTP component.

Thanks,

Steve.

[Code follows]

Private Sub NNTP_DocOutput(ByVal DocOutput As DocOutput)
    Dim Data As String
    Dim Hdr As Object

    Select Case DocOutput.State
    Case icDocBegin            
        txtOutput.Text = ""
    Case icDocHeaders
        For Each Hdr In DocOutput.Headers
            Select Case LCase(Hdr.Name)
            Case "subject"            
                txtSubject.Text = Hdr.Value
            Case "from"                    
                txtName.Text = Hdr.Value  
                txtEmailAddress.Text = Hdr.Value
            Case "newsgroups"                  
                txtGroup.Text = Hdr.Value      
            Case Else
            End Select
        Next                                        
    Case icDocData                                  
        DocOutput.GetData Data                      

        Select Case TRANSACTION
        Case transLISTGROUPS  
            txtOutput.Text = txtOutput.Text & Data
        Case transGETMESSAGE  
            txtOutput.Text = txtOutput.Text & Data
        Case transGETARTICLEHEADERS  
            txtOutput.Text = txtOutput.Text & Data
        Case Else
        End Select
    Case icDocEnd
    Case icDocError
    Case icDocNone
    End Select

End Sub

 

Re:ICP And DocOutput


Quote
Frank Han <hfr...@ix.netcom.com> wrote:
->Steve Thompson wrote:

->>
->> I am trying to convert the following code, Can anyone help me in
doing
->> this?
->>
->> This is for microsofts icp, particulary the NNTP component.
->>
->> Thanks,
->>
->> Steve.
->>
->> [Code follows]
->>
->> Private Sub NNTP_DocOutput(ByVal DocOutput As DocOutput)
->>     Dim Data As String
->>     Dim Hdr As Object
->>
->>     Select Case DocOutput.State
->>     Case icDocBegin
->>         txtOutput.Text = ""
->>     Case icDocHeaders
->>         For Each Hdr In DocOutput.Headers
->>             Select Case LCase(Hdr.Name)
->>             Case "subject"
->>                 txtSubject.Text = Hdr.Value
->>             Case "from"
->>                 txtName.Text = Hdr.Value
->>                 txtEmailAddress.Text = Hdr.Value
->>             Case "newsgroups"
->>                 txtGroup.Text = Hdr.Value
->>             Case Else
->>             End Select
->>         Next
->>     Case icDocData
->>         DocOutput.GetData Data
->>
->>         Select Case TRANSACTION
->>         Case transLISTGROUPS
->>             txtOutput.Text = txtOutput.Text & Data
->>         Case transGETMESSAGE
->>             txtOutput.Text = txtOutput.Text & Data
->>         Case transGETARTICLEHEADERS
->>             txtOutput.Text = txtOutput.Text & Data
->>         Case Else
->>         End Select
->>     Case icDocEnd
->>     Case icDocError
->>     Case icDocNone
->>     End Select
->>
->> End Sub

->Geeeeee man. I almost chocked myself. I thought the nightmare of VB
was
->comming back. Please post delphi related msg in this news group.

->Phweeeeee....... Thank god. it was just a miss post.

->From a poor man just recovering from C and VB. :)

Excuse me, but I was arsking for help in converting this VB code TO
DELPHI. Is this really off topic ?

Steve.

Re:ICP And DocOutput


Quote
Frank Han wrote:

> Steve Thompson wrote:

> > I am trying to convert the following code, Can anyone help me in doing
> > this?

> > This is for microsofts icp, particulary the NNTP component.

> > Thanks,

> > Steve.

> > [Code follows]

> > Private Sub NNTP_DocOutput(ByVal DocOutput As DocOutput)
> >     Dim Data As String
> >     Dim Hdr As Object

> >     Select Case DocOutput.State
> >     Case icDocBegin
> >         txtOutput.Text = ""
> >     Case icDocHeaders
> >         For Each Hdr In DocOutput.Headers
> >             Select Case LCase(Hdr.Name)
> >             Case "subject"
> >                 txtSubject.Text = Hdr.Value
> >             Case "from"
> >                 txtName.Text = Hdr.Value
> >                 txtEmailAddress.Text = Hdr.Value
> >             Case "newsgroups"
> >                 txtGroup.Text = Hdr.Value
> >             Case Else
> >             End Select
> >         Next
> >     Case icDocData
> >         DocOutput.GetData Data

> >         Select Case TRANSACTION
> >         Case transLISTGROUPS
> >             txtOutput.Text = txtOutput.Text & Data
> >         Case transGETMESSAGE
> >             txtOutput.Text = txtOutput.Text & Data
> >         Case transGETARTICLEHEADERS
> >             txtOutput.Text = txtOutput.Text & Data
> >         Case Else
> >         End Select
> >     Case icDocEnd
> >     Case icDocError
> >     Case icDocNone
> >     End Select

> > End Sub

> Geeeeee man. I almost chocked myself. I thought the nightmare of VB was
> comming back. Please post delphi related msg in this news group.

> Phweeeeee....... Thank god. it was just a miss post.

> From a poor man just recovering from C and VB. :)

Uh, I think the post was requesting help translating the VB example code to
Delphi.  I'm having similar problems myself.  I've never touched VB, so
Microsofts examples on using the ActiveX controls doesn't help me in the
least.  

Anybody have sample Delphi code for these things?

Darren Clark
--
"Of two evils, choose to be the lesser"
                        -Ambrose Bierce

Re:ICP And DocOutput


Heres my Docoutput for a POPClient :

- hope it gives you some hints on how to use the DocOutput.
---------------------------------------
procedure TJobList.PopClientDocOutput(Sender: TObject;
  const DocOutput: Variant);
var
 C:integer;
 S:String;
 V,N:string;

begin
 case DocOutput.State of
 icDocBegin:JobTable.Insert;
 icDocHeaders:begin
               with JobTable do
                for C:=1 to DocOutput.Headers.Count do
                begin
                  N:=DocOutput.Headers.Item(C).Name;
                  V:=DocOutput.Headers.Item(C).Value;
                  if N='Message-Id' then
                    FieldByName('MsgId').AsString := V
                  else if N='Subject' then
                    FieldByName('Subject').AsString := V
                  else if N='Date' then
                    FieldByName('TimeStamp').AsString := stripDate(V)
                  else if N='From' then
                    FieldByName('UserId').AsString :=
Uppercase(Copy(V,1,pos('@',V)-1))
                  else if N='Received' then
                    FieldByName('Machine').AsString :=
Uppercase(Rake(V,Pos('from',v)+5,pos('.',v)-1))
                  else if N='To' then
                    FieldByName('Type').AsString :=
Uppercase(Copy(V,1,pos('@',V)-1));
                end;
              end;
 icDocData:begin
             DocOutput.Getdata(S);
             JobTable.FieldByName('Problem').SetData(@S[1]);
           end;
 icDocEnd:if MsgNumber<MsgCount then begin
                try
                  JobTable.Post
                except
                  on E:EDatabaseError do
                  begin
                    ShowMessage(E.Message+'
ID:'+JobTable.FieldByName('MsgId').AsString);
                    JobTable.Cancel;
                  end;
                end;
                PopClient.RetrieveMessage(MsgNumber+1);
                inc(MsgNumber);
          end;
 icDocError:Status.Panels.Items[1].Text:='POP3: Download Error';
 end;
end;

Re:ICP And DocOutput


Quote
Darren Clark <bherr...@thinkthink.com> wrote:

| Uh, I think the post was requesting help translating the VB example code to
| Delphi.  I'm having similar problems myself.  I've never touched VB, so
| Microsofts examples on using the ActiveX controls doesn't help me in the
| least.  

| Anybody have sample Delphi code for these things?

I've given up on the MSICP controls, trying to write a simple POP
client using them is taking more time and effort than using SOCKSV3
and doing all the commands manually.

Problem is - there is no event that signals the end of the first
message, you can't request all the messages at once because the
program crashes and you can't request the message in the previous
EndDoc because it goes recersive and generates unkown OCX errors.

Borland have really gone overboard in saying they support internet
developers - they ran a header conversion script over a MS header,
left out important constants and functions which are in MSICP, added
extra functions and stuff which has no documentation and they don't
even have some Delphi samples to show they have even used them.

At this stage Borland is beginning to fall behind MS in the support
stakes.

C.L.Burke

Re:ICP And DocOutput


Take it as a joke. I have not seen those vb codes for ages not that I miss them.
I was being psychotic dude. If I offended you, pardon me. :|

In article <833403083.2488...@dden.demon.co.uk>, St...@dden.demon.co.uk says...

Quote

>Frank Han <hfr...@ix.netcom.com> wrote:

>->Steve Thompson wrote:
>->>
>->> I am trying to convert the following code, Can anyone help me in
>doing
>->> this?
>->>
>->> This is for microsofts icp, particulary the NNTP component.
>->>
>->> Thanks,
>->>
>->> Steve.
>->>
>->> [Code follows]
>->>
>->> Private Sub NNTP_DocOutput(ByVal DocOutput As DocOutput)
>->>     Dim Data As String
>->>     Dim Hdr As Object
>->>
>->>     Select Case DocOutput.State
>->>     Case icDocBegin
>->>         txtOutput.Text = ""
>->>     Case icDocHeaders
>->>         For Each Hdr In DocOutput.Headers
>->>             Select Case LCase(Hdr.Name)
>->>             Case "subject"
>->>                 txtSubject.Text = Hdr.Value
>->>             Case "from"
>->>                 txtName.Text = Hdr.Value
>->>                 txtEmailAddress.Text = Hdr.Value
>->>             Case "newsgroups"
>->>                 txtGroup.Text = Hdr.Value
>->>             Case Else
>->>             End Select
>->>         Next
>->>     Case icDocData
>->>         DocOutput.GetData Data
>->>
>->>         Select Case TRANSACTION
>->>         Case transLISTGROUPS
>->>             txtOutput.Text = txtOutput.Text & Data
>->>         Case transGETMESSAGE
>->>             txtOutput.Text = txtOutput.Text & Data
>->>         Case transGETARTICLEHEADERS
>->>             txtOutput.Text = txtOutput.Text & Data
>->>         Case Else
>->>         End Select
>->>     Case icDocEnd
>->>     Case icDocError
>->>     Case icDocNone
>->>     End Select
>->>
>->> End Sub

>->Geeeeee man. I almost chocked myself. I thought the nightmare of VB
>was
>->comming back. Please post delphi related msg in this news group.

>->Phweeeeee....... Thank god. it was just a miss post.

>->From a poor man just recovering from C and VB. :)

>Excuse me, but I was arsking for help in converting this VB code TO
>DELPHI. Is this really off topic ?

>Steve.

Re:ICP And DocOutput


Quote
Frank wrote:

->Take it as a joke. I have not seen those vb codes for ages not that
I miss them.
->I was being psychotic dude. If I offended you, pardon me. :|

That's OK, It's just that I have had a few emails along this line that
were not jokes. Sorry for jumping on you.

Steve.

->In article <833403083.2488...@dden.demon.co.uk>,
St...@dden.demon.co.uk says...
->>

Quote
->>Frank Han <hfr...@ix.netcom.com> wrote:

->>
Quote
->>->Steve Thompson wrote:

->>->>
->>->> I am trying to convert the following code, Can anyone help me
in
->>doing
->>->> this?
->>->>
->>->> This is for microsofts icp, particulary the NNTP component.
->>->>
->>->> Thanks,
->>->>
->>->> Steve.
->>->>
->>->> [Code follows]
->>->>
->>->> Private Sub NNTP_DocOutput(ByVal DocOutput As DocOutput)
->>->>     Dim Data As String
->>->>     Dim Hdr As Object
->>->>
->>->>     Select Case DocOutput.State
->>->>     Case icDocBegin
->>->>         txtOutput.Text = ""
->>->>     Case icDocHeaders
->>->>         For Each Hdr In DocOutput.Headers
->>->>             Select Case LCase(Hdr.Name)
->>->>             Case "subject"
->>->>                 txtSubject.Text = Hdr.Value
->>->>             Case "from"
->>->>                 txtName.Text = Hdr.Value
->>->>                 txtEmailAddress.Text = Hdr.Value
->>->>             Case "newsgroups"
->>->>                 txtGroup.Text = Hdr.Value
->>->>             Case Else
->>->>             End Select
->>->>         Next
->>->>     Case icDocData
->>->>         DocOutput.GetData Data
->>->>
->>->>         Select Case TRANSACTION
->>->>         Case transLISTGROUPS
->>->>             txtOutput.Text = txtOutput.Text & Data
->>->>         Case transGETMESSAGE
->>->>             txtOutput.Text = txtOutput.Text & Data
->>->>         Case transGETARTICLEHEADERS
->>->>             txtOutput.Text = txtOutput.Text & Data
->>->>         Case Else
->>->>         End Select
->>->>     Case icDocEnd
->>->>     Case icDocError
->>->>     Case icDocNone
->>->>     End Select
->>->>
->>->> End Sub
->>
->>->Geeeeee man. I almost chocked myself. I thought the nightmare of
VB
->>was
->>->comming back. Please post delphi related msg in this news group.
->>
->>
->>->Phweeeeee....... Thank god. it was just a miss post.
->>
->>->From a poor man just recovering from C and VB. :)
->>
->>
->>Excuse me, but I was arsking for help in converting this VB code TO
->>DELPHI. Is this really off topic ?
->>
->>
->>Steve.
->>
->>

Re:ICP And DocOutput


You will probably get all the help you need if you all were to subscirbe
to the Delphi Newletter.  The May issue features using OCX/ActiveX
controls with delphi.

You can get the interface unit WININET.PAS, which contains manifests,
functions, types and prototypes for the Microsoft Internet Extensions at

www.borland.com/TechInfo/delphi/index.html

You can also get a help file from Microsoft at

www.microsoft.com/intdev/sdk/docs/wininet/default.htm

See what you come out with.

Quote
> C.Bu...@mailbox.uq.oz.au (Christopher Burke) wrote in article

<4ok4l5$...@bunyip.cc.uq.oz.au>...
Quote
> Darren Clark <bherr...@thinkthink.com> wrote:

> | Uh, I think the post was requesting help translating the VB example
code to
> | Delphi.  I'm having similar problems myself.  I've never touched VB,
so
> | Microsofts examples on using the ActiveX controls doesn't help me in
the
> | least.  

> | Anybody have sample Delphi code for these things?

> I've given up on the MSICP controls, trying to write a simple POP
> client using them is taking more time and effort than using SOCKSV3
> and doing all the commands manually.

> Problem is - there is no event that signals the end of the first
> message, you can't request all the messages at once because the
> program crashes and you can't request the message in the previous
> EndDoc because it goes recersive and generates unkown OCX errors.

> Borland have really gone overboard in saying they support internet
> developers - they ran a header conversion script over a MS header,
> left out important constants and functions which are in MSICP, added
> extra functions and stuff which has no documentation and they don't
> even have some Delphi samples to show they have even used them.

> At this stage Borland is beginning to fall behind MS in the support
> stakes.

> C.L.Burke

Re:ICP And DocOutput


Quote
"Bolee" <bob...@cris.com> wrote:

->You will probably get all the help you need if you all were to
subscirbe
->to the Delphi Newletter.  The May issue features using OCX/ActiveX
->controls with delphi.

How can I subscribe to this ?

Steve.

Other Threads