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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.