calling DDE within a webpage

Hi,

Is it possible to call DDE within a web page?  there's a DDE application service running in the background.

Please kindly assist with sample codes. (asp and asp.net)

Thanks.
EdwardPeterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EDDYKTCommented:
Don't think you can call directly but you can create active exe and then call from your asp.

Your activex exe will wrap around the dde call.


Note, activex dll doesn't coexist with dde
EdwardPeterAuthor Commented:
EDDYKT,

is it okay if you could kindly guide me how to create this active exe?
Can we create this active exe using vb6 or asp.net ? (these are the only laguage which i'm currently able to handle)

Thanks.
EDDYKTCommented:
yeah, you can create active exe by using vb6

do you know how to get data from vb6 using textbox?
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

EdwardPeterAuthor Commented:
EDDYKT,

Yes I can manage the dde part from vb. I have no clue what is active exe or how can we use it to get the value from asp.

Please kindly assist

Thanks.
EDDYKTCommented:
in vb you can create standard application, activex exe and activex dll and more

activex exe is com object that doesn't like activex dll, activex exe run out-of-process


To call from your asp, you can use server.createobject to initialate your activex exe


Treat the exe is the same as dll when you are programming
EdwardPeterAuthor Commented:
EDDYKT,

I started to create ActiveX EXE, sadly there are no forms available for placing the text boxes for DDE..can you kindly assist?

Thanks.
EDDYKTCommented:
create a new activex exe
add a form1 and add textbox on form1 (text1)

in your class

Option Explicit
Private MyForm As form1

Private Sub Class_Initialize()
   
    On Error Resume Next
    Set MyForm = New form1
End Sub

Private Sub Class_Terminate()

    On Error Resume Next
    If (Not MyForm Is Nothing) Then Unload MyForm
    Set MyForm = Nothing
End Sub

public function GetValue(byval mydde as string) as string
dim ExitNowBool As Boolean, TimeOut As Date
With MyForm.text1
        .Text = ""
        .LinkTopic = yourLinkTopic
        .LinkItem = mydde
        .LinkMode = vbLinkAutomatic
        TimeOut = Now
        ExitNowBool = False
        Do While ((ExitNowBool = False) And Err.Number = 0)
            If (len(.Text) > 0) Then ExitNowBool = True
            If (DateDiff("s", TimeOut, Now) > 30) Then ExitNowBool = True
            DoEvents
            Sleep (50)
            If (Err.Number = 9) Then Err.Clear
        Loop
        GetValue = .Text
    End With
end function


in your asp function you should be able to use serverobject to createobject of your exe and call the function.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EdwardPeterAuthor Commented:
EDDYKT,

Which should we place in start up object? will we create an exe file too?  (hitting F5) should make our activex exe run ?


Thanks.
EDDYKTCommented:
>>Which should we place in start up object?

You can run your ocx by calling from another program. You need to create another standard application to initiate your activex exe component.

Just think about activex dll, you need something to trigger.

In your case, you initiate from asp page.

Are you new to vb?>
EdwardPeterAuthor Commented:
EDDYKT,

My apology, it's just that I haven't touch anything outside a standard form (executalbe application).

I've pasted the code and populated the proper LinkTopic, and Mode.
On the project properties there's a start up object, should we leave it at (none) or ?
Will we require to create this project as an exe file?

Thanks.

EDDYKTCommented:
>>On the project properties there's a start up object, should we leave it at (none)

leave it to none. also make sure you change

project property->component tab -> version compatibliity

to binary compatibility after you compile to make exe
EdwardPeterAuthor Commented:
EDDYKT,

You're an absolute genius!!! , i'm currently researching for the asp side (initiate and trigger GetValue).

Thanks.
EDDYKTCommented:
There is slightly different on calling from IIS

make sure you have to turn on metadata AspAllowOutOfProcComponents

if you use IIS5 then it is on by default.
EdwardPeterAuthor Commented:
EDDYKT,

Will the asp code below work? Please kindly assist if there are missing links.

Thanks.

<%@ LANGUAGE = "VBScript" %>
    <%
            Set o = GetObject ("IIS://localhost/W3SVC/1/ROOT")
            o.AspAllowOutOfProcComponents = true
            Set wApp = Server.Createobject("ProjectName.Classname")
    %>
    <HTML>
        <HEAD></HEAD>
        <BODY>
            <FORM action="<% = Request.ServerVariables("URL") %>" method="post">
                <INPUT name="text1" type="text" value="<%= Request.Form("text1") %>" />
                <INPUT name="submit" type="submit" value="Go" />
            </FORM>
    <%
        If Request.Form("submit") = "Go" Then
            Response.Write "<P> " & wApp.GetValue(Request.Form("text1")) & " </P>"
        End If
    %>
        </BODY>

    </HTML>
EDDYKTCommented:
1. you only need to set AspAllowOutOfProcComponents once. Again if you use IIS5 then the flag is on by default.

2. do you get it working? I don;t see any problem

EdwardPeterAuthor Commented:
EDDYKT,

Sadly I'm not sure if the exe run, I've double click it and check under teask manager, it doesn't show.

Is this normal?

Thanks.
EdwardPeterAuthor Commented:
EDDYKT,

Your code is amazing!!!

Sad to say an error message popup, could it be that the activeX exe is not loaded?

Thanks.

Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.
/test/test.asp, line 5

____________________________________________________________

<%@ LANGUAGE = "VBScript" %>
    <%
            Set o = GetObject ("IIS://localhost/W3SVC/1/ROOT")
            o.AspAllowOutOfProcComponents = true
            Set wApp = Server.Createobject("ActiveXEXE.Classname")
    %>
    <HTML>
        <HEAD></HEAD>
        <BODY>
            <FORM action="<% = Request.ServerVariables("URL") %>" method="post">
                <INPUT name="text1" type="text" value="<%= Request.Form("text1") %>" />
                <INPUT name="submit" type="submit" value="Go" />
            </FORM>
    <%
        If Request.Form("submit") = "Go" Then
            Response.Write "<P> " & wApp.GetValue(Request.Form("text1")) & " </P>"
        End If
    %>
        </BODY>

    </HTML>
EDDYKTCommented:
just use a simple asp to test


ie


<%

dim wApp

' make sure your progid is correct
Set wApp = Server.Createobject("ActiveXEXE.Classname")
Response.Write "<P> " & wApp.GetValue("hard code your dde string here") & " </P>"

%>
EDDYKTCommented:
you can also create a standard exe to test


ie


Private Sub Command1_Click()
dim wApp

Set wApp = Createobject("ActiveXEXE.Classname")
debug.print wApp.GetValue("hard code your dde string here")
End Sub

EdwardPeterAuthor Commented:
EDDYKT,

Great idea, simply the best!!!

Sadly, it gave a runtime error 429; ActiveX component can't create object

>>Set wApp = CreateObject("ActiveXEXE.Classname")

I think there could be something wrong with the way I made the exe or the activex exe is not running since we can't see it in task manager?

Thanks.
EDDYKTCommented:
Have you do that?

project property->component tab -> version compatibliity

to binary compatibility after you compile to make exe


what is your program name and class name?
EdwardPeterAuthor Commented:
EDDYKT,

Got it!!! My apology it was the Classname, by the way is there a way to determine if the exe is running or it has been run once?

You are no doubt simply the best!!!

Tried it on the actual DDE, error returned: No foreign application responded to a DDE initiate
>>Debug.Print wApp.GetValue("PosDSSPositionID")
        .Text = ""
        .LinkTopic = "PLUS|PLUS"
        .LinkItem = mydde
        .LinkMode = 1
        TimeOut = Now
EDDYKTCommented:
well you have to know what is your linktopic and linkitem is

for each linktopic, the name must be unique

for excel

there is

Excel|Sheet1


http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21412082.html


I will suggest you create a simple standard exe and use textbox to get data from your dde so that you know what is your dde server linktopic and linkitem is

I cannot help you on this
EDDYKTCommented:
>>Got it!!! My apology it was the Classname, by the way is there a way to determine if the exe is running or it has been run once?


Just bring up the task manager and you should see it.

EdwardPeterAuthor Commented:
EDDYKT,

That's correct, the dde using a standard vb exe does work. Please kindly see below.


txtPosDSSPositionID.LinkItem = "PosDSSPositionID"
    txtPosDSSPositionID.LinkTopic = "PLUS|PLUS"
    txtPosDSSPositionID.LinkMode = 1
    txtPosDSSPositionID.LinkRequest

I'm trying all the tricks in the book, hope everything goes well..
EdwardPeterAuthor Commented:
EDDYKT,

Got it to work (silightly)  

I've Place a msgbox in the function you've created (Amazing funtion)

        GetValue = .Text
        MsgBox GetValue

it returned the correct value, what could be next to check, to furthur our troubleshooting?

Thanks.
EDDYKTCommented:
ok since you use linkrequest, you can use linkmanual


ie, in your class


Option Explicit
Private MyForm As form1

Private Sub Class_Initialize()
   
    On Error Resume Next
    Set MyForm = New form1
End Sub

Private Sub Class_Terminate()

    On Error Resume Next
    If (Not MyForm Is Nothing) Then Unload MyForm
    Set MyForm = Nothing
End Sub

public function GetValue(byval mydde as string) as string
dim ExitNowBool As Boolean, TimeOut As Date
With MyForm.text1
        .Text = ""
        .LinkTopic = "PLUS|PLUS"
        .LinkItem = mydde
        .LinkMode = vbLinkManual
        .LinkRequest
        GetValue = .Text
    End With
end function



in you vb app


Private Sub Command1_Click()
dim wApp

Set wApp = Createobject("ActiveXEXE.Classname")
debug.print wApp.GetValue("PosDSSPositionID")
End Sub



you should see something on the debug window
I have to go now and will check email tomorrow
EdwardPeterAuthor Commented:
EDDYKT,

Got it to work (almost full)

i've place a label = wApp.GetValue("PosDSSPositionID")  this is using vb6 for client

we got the correct value.

what could have happend when printing it?

Thanks.
EdwardPeterAuthor Commented:
EDDYKT,

It's working on VB, sad to say it's not displaying anything in asp side.. (triend all the tricks in the book)

How can we troubleshoot futhur?

Thanks.
EdwardPeterAuthor Commented:
EDDYKT,

I've open up another question related to this, if it's okay please kindy give guidance.

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21480210.html
EDDYKTCommented:
Do you get what you want?

I read your post that you've got your answer
EdwardPeterAuthor Commented:
EDDYKT,

You are no doubt simply one of the coder here at EE. Thanks so much for your time and patience.

Yes I was able to run the html on the client side and using javascript to control the activex exe. Thanks so much to you and your time.

I'm researching on how to run the activex exe in the webserver and running the asp in the client browser and hope we are able to query the client's dde from the web server.

Thanks.
EDDYKTCommented:
That's what i don't understand, if you want to just report data from client side. Why do you need to go through IIS. Why don't you just write app for client only?
EdwardPeterAuthor Commented:
EDDYKT,

Is Java possbile using DDE? Please kindly assist if your not to busy.

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21490229.html

Thanks.
EDDYKTCommented:
I'm not quite familiar with Java. Again if you use activex exe, it is just a matter of calling your exe from java. Again i'm sure about how to call from java
EdwardPeterAuthor Commented:
EDDYKT,

Thanks so much for the time and patience.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.