Solved

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

Posted on 1997-10-30
9
522 Views
Last Modified: 2008-03-03
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

0
Comment
Question by:cellphone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 6

Expert Comment

by:alamo
ID: 1439296
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
 

Author Comment

by:cellphone
ID: 1439297
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
 

Author Comment

by:cellphone
ID: 1439298
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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 6

Expert Comment

by:alamo
ID: 1439299
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
 

Author Comment

by:cellphone
ID: 1439300
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
 
LVL 6

Accepted Solution

by:
alamo earned 200 total points
ID: 1439301
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
 
LVL 6

Expert Comment

by:alamo
ID: 1439302
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
 

Author Comment

by:cellphone
ID: 1439303
Thanks very much - I'm looking foward to your answer.
0
 

Author Comment

by:cellphone
ID: 1439304
Will do. We seem to be in realtime here!
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month6 days, 1 hour left to enroll

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question