|
-
Jun 12th, 2000, 04:19 PM
#1
Thread Starter
Member
Hello I have set up the following class, but I am having problems . I need to make and a call and send data back from one of the subroutines in this class.
The following vb script code is to make a call to callgeo passing the values in the variables Lat, Lon and Map To the CallGeo function. This should return some values back.
---- vb script code ------------------
Msg= Maps &","& Lon &"," & Lat
Set Session(SESN_GEO) = CreateObject("DLLCall.Class1")
RunC = CallGeo(Lat, Lon, Map)
Also,
have the following code
is being called with the (LatLonMsg As String)
is passed to as a string), but this is not returning any values to my own test routine which I have set up. I need these values to be returned , with positions as I have requested to be sent onto another piece of coding.
Sub GeomanCode(LatLonMsg As String)
Dim AtlasFile As String
Dim Message As String
Dim I As Integer
Dim J As Integer
Dim K As Integer
Dim MapNum As Integer
Dim PageNum As Integer
Dim Row As String * 2
Dim Col As String * 2
Dim XCol As Double
Dim YRow As Double
Dim XRem As Double
Dim YRem As Double
Dim Conv As Double
Dim PSF As Double
Dim TCol As String
Dim TRow As String
Dim InFile As Integer
Dim SquareNum As Integer
Dim MapsRead As Boolean
Dim NumMsg As Integer
Dim Msg(5) As String
Dim FinalMsg As String
Dim ClientID As String
Dim ClientMsgNum As String
Dim ClientPhoneType As String
Dim ClientAtlasID As String
Dim ClientPageNum(5) As String
Dim ClientCol(5) As String
Dim ClientRow(5) As String
Dim ClientXPlot(5) As String
Dim ClientYPlot(5) As String
Dim VertMsg(5) As String
Dim XPlot As Integer
Dim YPlot As Integer
Dim M As Integer
Dim Work As String
Dim StringData(39) As String
Call Parse(LatLonMsg, ",", StringData())
ClientAtlasID = StringData(1)
AtlasFile = "c:\vb\GeomanDataPreparation\" + LTrim(StringData(1))
GeogLat = Val(StringData(2))
Geoglon = Val(StringData(3))
InFile = FreeFile
On Error GoTo ER
Open AtlasFile For Binary As #InFile
On Error GoTo 0
FileLength = LOF(InFile)
MapsInList = (FileLength - 246) / 162
Get #InFile, , AtlasName ' 50
Get #InFile, , Geo ' 2
SpSName = Space(30)
Get #InFile, , SpSName
Get #InFile, , SpSMAxis
Get #InFile, , SpFlatening
Get #InFile, , SpRNu
Get #InFile, , SpE
Get #InFile, , SpE2
Get #InFile, , SpEDash2
ProjPName = Space(30)
Get #InFile, , ProjPName
Get #InFile, , ProjType
Get #InFile, , ProjLatorigin
Get #InFile, , ProjCMeridian
Get #InFile, , ProjFalseE
Get #InFile, , ProjFalseN
Get #InFile, , ProjCSFact
Get #InFile, , ProjUnits
Get #InFile, , ProjToMetres
Get #InFile, , ProjANZ
Get #InFile, , TranA0
Get #InFile, , TranA2
Get #InFile, , TranA4
Get #InFile, , TranA6
If Geo Then
Call InitializeSpheroid(UseFlat, SpE2, SpFlatening, SpE, SpEDash2)
If ProjType = 1 Then ' Hook for other projections
Call InitializeTranmerc(SpE2, TranA0, TranA2, TranA4, TranA6)
End If
End If
For I = 1 To MapsInList
CurrentMap = I
Get #InFile, , Map(I) '146
Next I
Close #InFile
If Geo Then
Call TransverseMercator(GeogToGrid, Degs, GeogLat, Geoglon, ENE, _
ENN, Conv, PSF, SpSMAxis, ProjLatorigin, ProjCMeridian, _
ProjFalseE, ProjFalseN, ProjCSFact, ProjANZ)
Else
ENE = Geoglon * 3600#
ENN = GeogLat * 3600#
End If
FinalMsg = ClientAtlasID + ","
For I = 1 To MapsInList
CurrentMap = I
If Inside(I, ENE, ENN, True) Then
NumMsg = NumMsg + 1
XCol = ((ENE - Map(I).FirstSWCnr.E)) / Map(I).XInt
YRow = ((ENN - Map(I).FirstSWCnr.N)) / Map(I).YInt
XRem = AMod(ENE, Map(I).XInt)
YRem = AMod(ENN, Map(I).YInt)
Call GetVerts(ENE, ENN, XRem, YRem, Map(I).XInt, Map(I).YInt)
VertMsg(NumMsg) = ""
For K = 1 To 4
VertMsg(NumMsg) = VertMsg(NumMsg) + "," + Format(LLVert(K).Lat, "00.000000")
VertMsg(NumMsg) = VertMsg(NumMsg) + "," + Format(LLVert(K).Lon, "000.000000")
Next K
Call IncColRow(XCol, ColString, 1)
Call IncColRow(YRow, RowString, 2)
TCol = ColString
TRow = RowString
If Mid(TCol, 1, 1) = "0" Then Mid(TCol, 1, 1) = " "
If Mid(TRow, 1, 1) = "0" Then Mid(TRow, 1, 1) = " "
XPlot = Int(XRem / Map(I).XInt * 100)
YPlot = Int(YRem / Map(I).YInt * 100)
ClientPageNum(NumMsg) = Format(Map(I).MapPage, "0000")
ClientXPlot(NumMsg) = Format(XPlot, "0000")
ClientYPlot(NumMsg) = Format(YPlot, "0000")
ClientCol(NumMsg) = TCol
ClientRow(NumMsg) = TRow
Msg(NumMsg) = ClientPageNum(NumMsg) + "," + ClientCol(NumMsg) + "," _
+ ClientRow(NumMsg) + "," + ClientXPlot(NumMsg) + "," _
+ ClientYPlot(NumMsg) + "," + VertMsg(NumMsg) + vbCr
End If
Next I
' Append number of records to message
FinalMsg = FinalMsg + Format(NumMsg, "0") + vbCr
' Append records to message
For I = 1 To NumMsg
FinalMsg = FinalMsg + "," + Msg(I)
Next I
' Debug the resulting message
If Simulate Then
MsgBox FinalMsg
Simulate = False
Else
' Send the message
' Call SMSSendTextMsg(FinalMsg, "D")
End If
Exit Sub
ER:
MsgBox "Problem with opening " + AtlasFile, vbCritical
End Sub
Response.Write (RunC)
Set Session(SESN_GEO)=Nothing
----------------------------------------
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "CallGeomanDLL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'Geomancode.dll
Option Explicit
Public Name As String
Public gdatServerStarted As Date
Private mlngDebugID As Long
Sub Main()
' Code to be executed when the component starts,
' in response to the first object request.
gdatServerStarted = Now
Debug.Print "Executing Sub Main"
End Sub
Public Sub ReverseName()
Dim intCt As Integer
Dim strNew As String
For intCt = 1 To Len(Name)
strNew = Mid$(Name, intCt, 1) & strNew
Next
Name = strNew
End Sub
Public Property Get DebugID() As Long
DebugID = mlngDebugID
End Property
'The following subroutine, I need to send the data back from this, to the GEOMANCODE
Public Sub CallGeoman(MAP, LAT, LNG)
Call GEOMANCODE(" & MAP &", "& LAT &", "& LNG &")
End Sub
Private Sub Class_Initialize()
' Get a debug ID number that can be returned by
' the read-only DebugID property.
mlngDebugID = GetDebugID
Debug.Print "Initialize CallGeoman " & DebugID _
& ", Name=" & Name
End Sub
Public Sub DebudID()
End Sub
Private Sub Class_Terminate()
On Error Resume Next
Debug.Print "Terminate CallGeoman " & DebugID _
& ", Name=" & Name
End Sub
Any ideas as to the problem with this code, would be grateful.
I am not sure why it is not working.
Any ideas, would be great. I am new to dll and classes. My main area of programming has been sql and vbscript but not vb in depth in terms of classes, activex and dll or database programming.
[Edited by raj2000 on 06-13-2000 at 06:37 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|