--------------------------------------------------------------------------------
Hi,
Using Blitz+ neat .decls capabilities and trying to convert some of my old Visual Basic code into Blitz. I'm having trouble trying to work out how to get some of the parameters to work. For example, Blitz+ does not have Long's, only Int's. How do strip NULL's from the end of strings... etc.
The code below is a simple example of calling some api calls from within the MPR.DLL. It trying to map a drive to a machine.
Under Visual Basic, some of the constants had &H1 which I think means Hex value 1. Under blitz, I couldnt see away of using hex numbers, so I simply converted them to decimal. Will that work?
The 2nd think I've done is used INT's instead of LONG's. I'm not sure how many Bytes that Blitz's INT's use compared with the number of bytes used in Visual Basics LONG's. I also need a Strip Nulls routine from the UserID string.
Pretty new to this .decls thing.
[CODE]
Const RESOURCETYPE_ANY = 0 ; &H0
Const RESOURCETYPE_DISK = 1 ; &H1
Const RESOURCETYPE_PRINT = 2 ; &H2
Const RESOURCETYPE_UNKNOWN = 65535 ; &HFFFF
Const CONNECT_UPDATE_PROFILE = 1
Const NO_ERROR = 0
Const ERROR_ACCESS_DENIED = 5
Const ERROR_ALREADY_ASSIGNED = 85
Const ERROR_BAD_DEV_TYPE = 66
Const ERROR_BAD_DEVICE = 1200
Const ERROR_BAD_NET_NAME = 67
Const ERROR_BAD_PROFILE = 1206
Const ERROR_BAD_PROVIDER = 1204
Const ERROR_BUSY = 170
Const ERROR_CANNOT_OPEN_PROFILE = 1205
Const ERROR_DEVICE_ALREADY_REMEMBERED = 1202
Const ERROR_DEVICE_IN_USE = 2404
Const ERROR_EXTENDED_ERROR = 1208
Const ERROR_INVALID_PASSWORD = 86
Const ERROR_NO_NET_OR_BAD_PATH = 1203
Const ERROR_NO_NETWORK = 1222
Const ERROR_NOT_CONNECTED = 2250
Const ERROR_OPEN_FILES = 2401
;Define miscellaneous variables
Const ERROR_INVALID_ADDRESS = 487
Const ERROR_INVALID_PARAMETER = 87
Const ERROR_MORE_DATA = 234
Const ERROR_UNEXP_NET_ERR = 59
Const ERROR_NOT_SUPPORTED = 50
Const ERROR_NOT_ENOUGH_MEMORY = 8
Type NETRESOURCE
Field dwScope ; Long
Field dwType ; Long
Field dwDisplayType ; Long
Field dwUsage ; Long
Field lpLocalName$ ; String
Field lpRemoteName$ ; String
Field lpComment$ ; String
Field lpProvider$ ; String
End Type
Global rc
Global lCxnType
Global netAddCxn.NETRESOURCE = New NETRESOURCE
Global varPersistent = 0
Global sPassword = "", sUserID="administrator"
lCxnType = RESOURCETYPE_DISK
netAddCxn\dwType = RESOURCETYPE_DISK
netAddCxn\lpLocalName = "R:" ;sLocalDevice
netAddCxn\lpRemoteName = "\\MyMachine\c$" ;sShareName
netAddCxn\lpProvider = Chr(0)
rc = api_WNetAddConnection2(netAddCxn, sPassword, sUserID, varPersistent)
DebugLog rc
WaitKey()
[/CODE]
Anyone help?
Hi,
Using Blitz+ neat .decls capabilities and trying to convert some of my old Visual Basic code into Blitz. I'm having trouble trying to work out how to get some of the parameters to work. For example, Blitz+ does not have Long's, only Int's. How do strip NULL's from the end of strings... etc.
The code below is a simple example of calling some api calls from within the MPR.DLL. It trying to map a drive to a machine.
Under Visual Basic, some of the constants had &H1 which I think means Hex value 1. Under blitz, I couldnt see away of using hex numbers, so I simply converted them to decimal. Will that work?
The 2nd think I've done is used INT's instead of LONG's. I'm not sure how many Bytes that Blitz's INT's use compared with the number of bytes used in Visual Basics LONG's. I also need a Strip Nulls routine from the UserID string.
Pretty new to this .decls thing.
[CODE]
Const RESOURCETYPE_ANY = 0 ; &H0
Const RESOURCETYPE_DISK = 1 ; &H1
Const RESOURCETYPE_PRINT = 2 ; &H2
Const RESOURCETYPE_UNKNOWN = 65535 ; &HFFFF
Const CONNECT_UPDATE_PROFILE = 1
Const NO_ERROR = 0
Const ERROR_ACCESS_DENIED = 5
Const ERROR_ALREADY_ASSIGNED = 85
Const ERROR_BAD_DEV_TYPE = 66
Const ERROR_BAD_DEVICE = 1200
Const ERROR_BAD_NET_NAME = 67
Const ERROR_BAD_PROFILE = 1206
Const ERROR_BAD_PROVIDER = 1204
Const ERROR_BUSY = 170
Const ERROR_CANNOT_OPEN_PROFILE = 1205
Const ERROR_DEVICE_ALREADY_REMEMBERED = 1202
Const ERROR_DEVICE_IN_USE = 2404
Const ERROR_EXTENDED_ERROR = 1208
Const ERROR_INVALID_PASSWORD = 86
Const ERROR_NO_NET_OR_BAD_PATH = 1203
Const ERROR_NO_NETWORK = 1222
Const ERROR_NOT_CONNECTED = 2250
Const ERROR_OPEN_FILES = 2401
;Define miscellaneous variables
Const ERROR_INVALID_ADDRESS = 487
Const ERROR_INVALID_PARAMETER = 87
Const ERROR_MORE_DATA = 234
Const ERROR_UNEXP_NET_ERR = 59
Const ERROR_NOT_SUPPORTED = 50
Const ERROR_NOT_ENOUGH_MEMORY = 8
Type NETRESOURCE
Field dwScope ; Long
Field dwType ; Long
Field dwDisplayType ; Long
Field dwUsage ; Long
Field lpLocalName$ ; String
Field lpRemoteName$ ; String
Field lpComment$ ; String
Field lpProvider$ ; String
End Type
Global rc
Global lCxnType
Global netAddCxn.NETRESOURCE = New NETRESOURCE
Global varPersistent = 0
Global sPassword = "", sUserID="administrator"
lCxnType = RESOURCETYPE_DISK
netAddCxn\dwType = RESOURCETYPE_DISK
netAddCxn\lpLocalName = "R:" ;sLocalDevice
netAddCxn\lpRemoteName = "\\MyMachine\c$" ;sShareName
netAddCxn\lpProvider = Chr(0)
rc = api_WNetAddConnection2(netAddCxn, sPassword, sUserID, varPersistent)
DebugLog rc
WaitKey()
[/CODE]
Anyone help?