Re: .ocx with ASP.NET

From: Kevin Spencer (kspencer_at_takempis.com)
Date: 10/21/04


Date: Thu, 21 Oct 2004 09:29:20 -0400

An ActiveX Control is an application running on the client. ASP.Net is an
application running on the server. As they are both applications, there are
any number of ways they can communicate over a TCP/IP network. There is no
"most common way" for such communication to occur. It's all a matter of how
each app is built.

-- 
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
"B. Chernick" <BChernick@discussions.microsoft.com> wrote in message
news:9FFBA1C2-12DC-43A0-BACD-B1CB4903D20C@microsoft.com...
> Perhaps I shouldn't have used the word interaction.  Let me rephrase this
> again.
>
> What is the most common way (Is there any common way?) to move data
between
> ActiveX and ASP.Net?  As I look at this problem, I'm thinking along the
lines
> of a webform button is clicked, triggering a script function which
interacts
> with an outside process and generates a value.  How do I get that value
into
> an webform control like a textbox?
>
> "Kevin Spencer" wrote:
>
> > You don't understand. ActiveX has NOTHING to do with .Net. It runs
entirely
> > on its own on the client browser.
> >
> > An ASPX page delivers an HTML document to the client. An ActiveX Control
is
> > just a bunch of text tags in an HTML document. Think of it as "staic
HTML"
> > if you like. Now, there are some tricks you can do on the server side to
> > create the tags dynamically if needed, but all you're doing is modifying
> > text.
> >
> > -- 
> > HTH,
> > Kevin Spencer
> > ..Net Developer
> > Microsoft MVP
> > I get paid good money to
> > solve puzzles for a living
> >
> > "B. Chernick" <BChernick@discussions.microsoft.com> wrote in message
> > news:D0F2CCBB-4F41-42F1-B676-2DDE3C40B2A5@microsoft.com...
> > > (Ironically enough, the purpose of the ocx to pass stuff out, not in,
> > > specifically a hook to another currently running process.)
> > >
> > > Can you point me to a good discussion on interaction betwee OCXs and
> > ASP.Net
> > > code?  That other reference you gave seems to be solely focused on
> > ActiveX.
> > >
> > > Thanks!
> > >
> > > "Kevin Spencer" wrote:
> > >
> > > > > In the most general sense, here is the problem.  I've added an Ocx
to
> > my
> > > > > toolbox and put a copy on the aspx page.  This ocx somehow
supposdly
> > > > provides
> > > > > access to a currently running application session through a COM
dll.
> > > >
> > > > An ActiveX Control is not a server-side object. It is downloaded and
> > > > executed in the client browser. The only thing you should be adding
is
> > an
> > > > <OBJECT> tag to your client-side HTML.
> > > >
> > > > > The problem is that I'm now trying by trial and error to make use
of
> > it
> > > > and
> > > > > I'm not sure of the best possible approach.  In general I would
expect
> > > > that I
> > > > > would need to make a number of calls to the application and put
the
> > data
> > > > on
> > > > > the screen.
> > > >
> > > > An ActiveX Control is an application. How it works is, like any
other
> > app,
> > > > entirely up to the developer who created it in the first place..
> > > >
> > > > > Given that, what is the general direction I should proceed in?
Sorry
> > I
> > > > > can't be more specific.
> > > >
> > > > Learn how ActiveX Controls work, how an <OBJECT> tag is used to
embed
> > the
> > > > ActiveX Control in the web page on the client, and how to use th
> > <OBJECT>
> > > > tag to pass parameters to the Control. Other than that, how the
Control
> > > > works, I can't tell you. Only the developer of the Control could
tell
> > you
> > > > that.
> > > >
> > > > The following MSDN article should be useful:
> > > >
> > > >
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaxctrl/html/msdn_actxcont.asp
> > > >
> > > > -- 
> > > > HTH,
> > > > Kevin Spencer
> > > > ..Net Developer
> > > > Microsoft MVP
> > > > I get paid good money to
> > > > solve puzzles for a living
> > > >
> > > >
> > > > "B. Chernick" <BChernick@discussions.microsoft.com> wrote in message
> > > > news:3CBA40FF-0729-474D-AC5D-86E1FB2806AF@microsoft.com...
> > > > > I just noticed this conversation.  I'm trying to review ASP.Net in
a
> > hurry
> > > > > for the usual reason (sudden job :-) and I have a vague question.
> > > > >
> > > > > In the most general sense, here is the problem.  I've added an Ocx
to
> > my
> > > > > toolbox and put a copy on the aspx page.  This ocx somehow
supposdly
> > > > provides
> > > > > access to a currently running application session through a COM
dll.
> > > > >
> > > > > The problem is that I'm now trying by trial and error to make use
of
> > it
> > > > and
> > > > > I'm not sure of the best possible approach.  In general I would
expect
> > > > that I
> > > > > would need to make a number of calls to the application and put
the
> > data
> > > > on
> > > > > the screen.
> > > > >
> > > > > Given that, what is the general direction I should proceed in?
Sorry
> > I
> > > > > can't be more specific.
> > > > >
> > > > > "Kevin Spencer" wrote:
> > > > >
> > > > > > Hi Dilek,
> > > > > >
> > > > > > You're confusing client-side and server-side. An ActiveX control
> > (.ocx)
> > > > is a
> > > > > > client-side application. It is hosted in the browser. Your HTML
is
> > > > right,
> > > > > > but your CodeBehind is wrong. The ONLY thing you can use
CodeBehind
> > for
> > > > with
> > > > > > an ActiveX Control is to (possibly, if necessary) modify the
OBJECT
> > tag
> > > > that
> > > > > > is sent to the client. The ActiveX Control is fetched by the
browser
> > and
> > > > run
> > > > > > on the client, according to the OBJECT tag in the HTML on the
> > client.
> > > > > >
> > > > > > -- 
> > > > > > HTH,
> > > > > > Kevin Spencer
> > > > > > ..Net Developer
> > > > > > Microsoft MVP
> > > > > > I get paid good money to
> > > > > > solve puzzles for a living
> > > > > >
> > > > > > "Dilek KARAKAYA" <dikeyus@yahoo.com> wrote in message
> > > > > > news:O$BRyhupEHA.2900@TK2MSFTNGP12.phx.gbl...
> > > > > > > I must use a component in my ASP.NET project but couldn't do
it.
> > There
> > > > is
> > > > > > a mistake anywhere .
> > > > > > > I use Microsoft Visual Studio.NET 2003
> > > > > > > I'm making a new project and add MSFlexGrid to my
WebForm1.aspx
> > > > > > > I'm adding MSFlexGrid from Project->Add References too
> > > > > > >
> > > > > > > When Run this project it's give an error at WebForm1.aspx.vb
at
> > > > MSFlex.Col
> > > > > > = 1
> > > > > > >
> > > > > > > System.Runtime.InteropServices.COMException: The server threw
an
> > > > > > exception.
> > > > > > >
> > > > > > >
> > > > > > > My WebForm1.aspx like this
> > > > > > >
> > > > > > > <%@ Page Language="vb" AutoEventWireup="false"
> > > > > > Codebehind="WebForm1.aspx.vb" Inherits="geoview.WebForm1"%>
> > > > > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > > > > > > <HTML>
> > > > > > > <HEAD>
> > > > > > > <title>WebForm1</title>
> > > > > > > <meta name="GENERATOR" content="Microsoft Visual Studio .NET
7.1">
> > > > > > > <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
> > > > > > > <meta name="vs_defaultClientScript" content="JavaScript">
> > > > > > > <meta name="vs_targetSchema"
> > > > > > content="http://schemas.microsoft.com/intellisense/ie5">
> > > > > > > </HEAD>
> > > > > > > <body MS_POSITIONING="GridLayout">
> > > > > > > <form id="Form1" method="post" runat="server">
> > > > > > >
> > > > > > > <OBJECT id=MSFlex
> > classid=clsid:6262D3A0-531B-11CF-91F6-C2863C385E30>
> > > > > > > <PARAM NAME="_ExtentX" VALUE="2646">
> > > > > > > <PARAM NAME="_ExtentY" VALUE="1323">
> > > > > > > <PARAM NAME="_Version" VALUE="393216">
> > > > > > > <PARAM NAME="Rows" VALUE="2">
> > > > > > > <PARAM NAME="Cols" VALUE="2">
> > > > > > > <PARAM NAME="FixedRows" VALUE="1">
> > > > > > > <PARAM NAME="FixedCols" VALUE="1">
> > > > > > > <PARAM NAME="RowHeightMin" VALUE="0">
> > > > > > > <PARAM NAME="BackColor" VALUE="-2147483643">
> > > > > > > <PARAM NAME="ForeColor" VALUE="-2147483640">
> > > > > > > <PARAM NAME="BackColorFixed" VALUE="-2147483633">
> > > > > > > <PARAM NAME="ForeColorFixed" VALUE="-2147483630">
> > > > > > > <PARAM NAME="BackColorSel" VALUE="-2147483635">
> > > > > > > <PARAM NAME="ForeColorSel" VALUE="-2147483634">
> > > > > > > <PARAM NAME="BackColorBkg" VALUE="8421504">
> > > > > > > <PARAM NAME="GridColor" VALUE="12632256">
> > > > > > > <PARAM NAME="GridColorFixed" VALUE="0">
> > > > > > > <PARAM NAME="WordWrap" VALUE="0">
> > > > > > > <PARAM NAME="Redraw" VALUE="-1">
> > > > > > > <PARAM NAME="AllowBigSelection" VALUE="-1">
> > > > > > > <PARAM NAME="ScrollTrack" VALUE="0">
> > > > > > > <PARAM NAME="Enabled" VALUE="-1">
> > > > > > > <PARAM NAME="RightToLeft" VALUE="0">
> > > > > > > <PARAM NAME="TextStyle" VALUE="0">
> > > > > > > <PARAM NAME="TextStyleFixed" VALUE="0">
> > > > > > > <PARAM NAME="FocusRect" VALUE="1">
> > > > > > > <PARAM NAME="HighLight" VALUE="1">
> > > > > > > <PARAM NAME="FillStyle" VALUE="0">
> > > > > > > <PARAM NAME="GridLines" VALUE="1">
> > > > > > > <PARAM NAME="GridLinesFixed" VALUE="2">
> > > > > > > <PARAM NAME="ScrollBars" VALUE="3">
> > > > > > > <PARAM NAME="SelectionMode" VALUE="0">
> > > > > > > <PARAM NAME="MergeCells" VALUE="0">
> > > > > > > <PARAM NAME="AllowUserResizing" VALUE="0">
> > > > > > > <PARAM NAME="PictureType" VALUE="0">
> > > > > > > <PARAM NAME="BorderStyle" VALUE="1">
> > > > > > > <PARAM NAME="Appearance" VALUE="1">
> > > > > > > <PARAM NAME="MousePointer" VALUE="0">
> > > > > > > <PARAM NAME="GridLineWidth" VALUE="1">
> > > > > > > <PARAM NAME="FormatString" VALUE="">
> > > > > > > <PARAM NAME="OLEDropMode" VALUE="0">
> > > > > > > </OBJECT>
> > > > > > >
> > > > > > > </form>
> > > > > > > </body>
> > > > > > > </HTML>
> > > > > > >
> > > > > > >
> > > > > > > And My WebForm1.aspx.vb like this
> > > > > > >
> > > > > > >
> > > > > > > Public Class WebForm1
> > > > > > >     Inherits System.Web.UI.Page
> > > > > > >     'Protected WithEvents MSFlex As MSFlexGridLib.MSFlexGrid
> > > > > > > #Region " Web Form Designer Generated Code "
> > > > > > >     'This call is required by the Web Form Designer.
> > > > > > >     <System.Diagnostics.DebuggerStepThrough()> Private Sub
> > > > > > InitializeComponent()
> > > > > > >     End Sub
> > > > > > >
> > > > > > >     'NOTE: The following placeholder declaration is required
by
> > the
> > > > Web
> > > > > > Form Designer.
> > > > > > >     'Do not delete or move it.
> > > > > > >     Private designerPlaceholderDeclaration As System.Object
> > > > > > >
> > > > > > >     Private Sub Page_Init(ByVal sender As System.Object, ByVal
e
> > As
> > > > > > System.EventArgs) Handles MyBase.Init
> > > > > > >         'CODEGEN: This method call is required by the Web Form
> > > > Designer
> > > > > > >         'Do not modify it using the code editor.
> > > > > > >         InitializeComponent()
> > > > > > >     End Sub
> > > > > > >
> > > > > > > #End Region
> > > > > > >
> > > > > > >     Private Sub Page_Load(ByVal sender As System.Object, ByVal
e
> > As
> > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > >         'Put user code to initialize the page here
> > > > > > >         Dim MSFlex As MSFlexGridLib.MSFlexGrid
> > > > > > >         MSFlex = New MSFlexGridLib.MSFlexGrid
> > > > > > >         MSFlex.Col = 1
> > > > > > >         MSFlex.Row = 1
> > > > > > >         MSFlex.Text = "abc"
> > > > > > >     End Sub
> > > > > > >
> > > > > > > End Class
> > > > > > >
> > > > > > >
> > > > > > >
> > **********************************************************************
> > > > > > > Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
> > > > > > > Comprehensive, categorised, searchable collection of links to
ASP
> > &
> > > > > > ASP.NET resources...
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> >
> >
> >

Loading