Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB DDE conduit form

API Examples

VB DDE conduit form

by  goner  Posted    (Edited  )
Using VB6? Think it's a pain in the butt to communicate via DDE with GoldMine?

Make a form named frmDDE
Add a textbox called txtGMDDE

Add this code to the form:

-------------------------------------------------
Public Function DDERequest(sExpr As String) As String

With txtGMDDE
.LinkItem = sExpr
.LinkRequest
DDERequest = .Text
End With

End Function
Public Function DDEInitiate() As Integer

On Error GoTo Err_DDE

With txtGMDDE
.LinkMode = vbLinkNone
.LinkTopic = "GoldMine|Data"
.LinkMode = vbLinkManual
End With

DDEInitiate = 1

Exit Function

Err_DDE:
If Err = 282 Then
MsgBox "GoldMine is not running! Please launch GoldMine before attempting " & _
"to run this operation.", vbCritical, "DDE Error"
End
Else
Err.Description = "DDE Error:" & Err & " :" & Err.Description
End If

DDEInitiate = 0
End Function
-------------------------------------------------

Then you can, from other areas of the program, make DDE calls to GoldMine without having to mess with the repetitive details. Here's an example that uses frmDDE to retrieve the basic GoldMine paths and username and put them into a few variables. Other DDE functions work equally well.

-------------------------------------------------
With frmDDE
iReturn = .DDEInitiate
If iReturn Then
sGM_Sysdir = .DDERequest("&sysdir")
sGM_GoldDir = .DDERequest("&golddir")
sGM_Commondir = .DDERequest("&commondir")
sGM_Username = .DDERequest("&username")
End If
End With
-------------------------------------------------


**Thanks to Frances Corazza for idea for this one!

Doug Castell
Castell Computers
http://www.castellcomputers.com
office: 310.601.4738
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top