VB5, Netscape, DDE & long word arrays...

Via DDE, Netscape can return a list of its open windows (WWW_ListWindows). The value returned is a long word array. If I pass a long to WWW_GetWindowInfo, I'll get back the URL and the title, which I want.

My question is how within the confines of VB DDE handling do I parse what WWW_List Window returns?

Here's netscapes Doc:  see http://developer.netscape.com/library/documentation/communicator/DDE/ddeapi.htm

cellphoneAsked:
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.

alamoCommented:
Well, unfortunately, you cant. The reason is that Netscape sends an array of longs as a straight binary array, not converted to ASCII. Dumb on Netscape's part (actually Spyglass wrote it originally) since there are therefore chr$(0) characters embedded in the data, yet most DDE (including VB's) expects text and terminates strings with chr$(0).

So you are stuck. I don't have VB5 available to test with but I can find nothing anywhere that says it is any different. I will post the code to process what you *should* be getting back, anyway - just in case, and so you can test as I tested. It actually works for the first window, since NS apparently starts numbering its windows at 1 and increments as each new one is opened.

Main code:
    DDE.LinkTopic = "netscape|WWW_ListWindows"
    DDE.LinkMode = vbLinkManual
    DDE.LinkRequest
    windowarray$ = DDE.Text
    While Len(windowarray$) > 0
        MsgBox (GetWindowInfo(GetNextDW&(windowarray$)))
    Wend

Public Function GetNextDW&(strdata$)
' Remove next 4 characters off strdata$
' and convert to a dw (long) which we return
' Pad strdata$ if it's <4 characters
  If (Len(strdata$) < 4) Then strdata$ = strdata$ & String$(4 - Len(strdata$), 0)
  dw& = Asc(Mid$(strdata$, 4, 1))
  If dw& > 127 Then dw& = dw& - 256
  For i% = 3 To 1 Step -1
    dw& = dw& * 256 + Asc(Mid$(strdata$, i%, 1))
  Next
  strdata$ = Mid$(strdata$, 5)
  GetNextDW& = dw&
End Function

Public Function GetWindowInfo$(win&)
    DDE.LinkTopic = "netscape|WWW_GetWindowInfo"
    DDE.LinkItem = win&
    DDE.LinkMode = vbLinkManual
    DDE.LinkRequest
    DDE.LinkMode = 0
    GetWindowInfo$ = DDE.Text
End Function

By the way, I searched for a DDE control which could handle binary data and was unsuccessful; perhaps with VB's callback capability you could actually use DDEML. DDEML should handle the binary data properly if you can get it to work at all when called from  VB.
0
cellphoneAuthor Commented:
What is DDEML? And what would be involved in writing a C++ .dll that makes this call and passes back a normal comma/quote delimited array?
0
cellphoneAuthor Commented:
What is DDEML? And what would be involved in writing a C++ .dll that makes this call and passes back a normal comma/quote delimited array?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

alamoCommented:
Thanks Bob, I really appreciate that. I gave a complete and correct and well-researched answer (to quote directly from your question) "within the confines of VB DDE handling". The rest of the solution is a new question, as you implicitly acknowledged when you posted a new message to Usenet asking for a solution, *quoting* *directly* *from* *my* *rejected* *answer*.

You have actually hurt your chances of getting an answer quickly on experts exchange since this question has mutated. The best solution for everyone would have been for you to accept my answer and post a new question.
0
cellphoneAuthor Commented:
Whoa!! Your answer was in a nutshell: can't be done, unless you use DDEML. But you give no clue as to what that is. As far as I can tell I can accept an answer as is, or reject and as for clarification. Which is what I did. I'd as soon given you 3/4 credit and waited for a clarification, but that is not an available choice.

I will be more than happy to accept your answer if you clarify it. As for quoting you, consider it a compliment.
0
alamoCommented:
To answer your followup question -

Back in the old days or Win31 DDE was truly a mystical art, full of low-level Global Atoms and callbacks. MS figured out it was impossible to use (probably feedback from their own applications people) and so defined a higher-level interface, ddeml.dll. (An order of magnitude better, but still an order of magnitude below the ease of use of DDE in VB). Since then they have made the ddeml functions standard, so they now reside in user32 not in the separate 16 bit ddeml. So when I said "ddeml" I meant the Win32 DDE calls.

These calls can certainly be done in a C++ dll. Maybe even in VB (I am trying to figure this out right now, i have made some progress). No need to reformat the data, the restriction with chr$(0) is in the fact VB  puts the data into a control which uses chr$(0)-terminated strings. I will let you know.
0

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
alamoCommented:
cellphone, I have succeeded in writing pure VB code to get the binary arrays from Netscape. Please grade this and post another question asking for it and I will answer. It took quite a while, I'd rather not post it on the end of this one. Thanks!
0
cellphoneAuthor Commented:
Thanks very much - I'm looking foward to your answer.
0
cellphoneAuthor Commented:
Will do. We seem to be in realtime here!
0
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
Visual Basic Classic

From novice to tech pro — start learning today.