nou heb ik dat goed doorgelezen maar als het script maak en het wil runnen zegt hij
sub or function not defined
wat moet ik hier nou mee ik heb IO.dll geinstaleerd de pc opnieuw opgestart en heb parmon.exe geinstaleerd als iemand mij kan helpen, graag
Martijn v
KIS!!: Keep It Simple
uuh,
Je probeert een subroutine op te roepen die niet bestaat.
In de cursus staan de API's niet genoteerd.
option explicit
Public Const LPTPOORT_1 As Long = 888
Public Const LPTPOORT_2 As Long = 632
Public Declare Sub apiPORTOUT Lib "IO.dll" Alias "SchrijfLPT" (ByVal Adres As Long, ByVal Data As Long)
Public Declare Function apiPORTIN Lib "IO.dll" Alias "LeesLPT" (ByVal Adres As Long)
maar dan ben je er nog niet, je moet pinnummers om rekenen naar hex waarde. dat systeem heb je ook nog niet.
tis niet moeilijk.
Jij wilt bv pin 3 en 5 hoog, de andere zijn laag.
Pin 3 heeft waarde 4, en pin 6 heeft waarde 64.
Je moet dus 4 + 64 = 68 zenden naar de LPT poort.
apiPORTOUT LPTPOORT_1, 68
Wil je daarna alleen pin 6 hoog hebben, stuur je 64.
apiPORTOUT LPTPOORT_1, 64
dit zijn de pinnummers:
1= 1
2= 2
3= 4
4= 16
5= 32
6= 64
7 = 132
enz
die IO.dll hoef je niet te installeren, gewoon ctlr-C ctrl-v in
C:\Windows\system32 suc6
[Bericht gewijzigd door Martijn v op ]
Martijn v
KIS!!: Keep It Simple
Op 13 juli 2006 21:28:24 schreef toko:
[...]
ik wil zo graag ..
je moest eens weten wat ik wou...
ik ben echt radeloos
helemaal nergens voor nodig. voor zaterdag vliegt die heli.
trouwens, heb je wel zon lang snoer dan? 
uuh, 'k ga ff weg, maar dit moet het doen:
8 checkboxen plaatsen, en 1 button.
Option Explicit
'api's for writing to the LPT poort
Public Const LPTPOORT_1 As Long = 888
Public Const LPTPOORT_2 As Long = 632
Public Declare Sub apiPORTOUT Lib "IO.dll" Alias "SchrijfLPT" (ByVal Adres As Long, ByVal Data As Long)
'Public Declare Function apiPORTIN Lib "IO.dll" Alias "LeesLPT" (ByVal Adres As Long)
Private Sub Commandbutton_Click()
Dim LPT As Integer
'per pin bekijken of deze hoog moet zijn, en de waarde berekenen
If Checkbox1.Value = vbChecked Then LPT = LPT + 1
If Checkbox2.Value = vbChecked Then LPT = LPT + 2
If Checkbox3.Value = vbChecked Then LPT = LPT + 4
If Checkbox4.Value = vbChecked Then LPT = LPT + 8
If Checkbox5.Value = vbChecked Then LPT = LPT + 16
If Checkbox6.Value = vbChecked Then LPT = LPT + 32
If Checkbox7.Value = vbChecked Then LPT = LPT + 64
If Checkbox8.Value = vbChecked Then LPT = LPT + 132
'waarde uitsturen naar LPT
apiPORTOUT LPTPOORT_1, LPT
End Sub
[Bericht gewijzigd door Martijn v op ]
heb je wel zon lang snoer dan?
ik sluit hem aan op de draadloze afstandsbediening snappie maarhu vraagje je stuurde mij een code
option explicit
Public Const LPTPOORT_1 As Long = 888
Public Const LPTPOORT_2 As Long = 632Public Declare Sub apiPORTOUT Lib "IO.dll" Alias "SchrijfLPT" (ByVal Adres As Long, ByVal Data As Long)
Public Declare Function apiPORTIN Lib "IO.dll" Alias "LeesLPT" (ByVal Adres As Long)
maarhu is dat wel vb of is het c++ want dat snap ik niet helemaal
zou je niet iets kunnen maken met screenshots waar je uitlegt waar ik die code moet neer zetten en ik hem moet gebruiken
Martijn v
KIS!!: Keep It Simple
je heb gelijk:
pin 2 van de LPT stekker, is datakanaal 0, met adres 1.
132 moet idd 128 zijn jah!
Ik heb even geen idee of "SchrijfLPT" de functie in IO.dll is. Bestanden en functies kunnen hernoemd worden, dus na een tijdje heten ze allemaal anders, maar zijn hetzelfde..
[Bericht gewijzigd door Martijn v op ]
hennep
reading can seriously damage your ignorance
toko
Ik neem aan dat je io.dll van deze pagina gebruikt: http://geekhideout.com/iodll.shtml
Daar staat ook een lijst met "private declare" statements.
Neem die over in je programma en je dll gaat werken.
Ik weet niet wie die nederlandse functienamen heeft bedacht maar waaron zou je afwijken van de originele namen.
Als je daarna nog steeds de melding "sub or function not defined" krijgt dan heb je waarschijnlijk een typefout in de sub- of functie-naam gemaakt.
[Bericht gewijzigd door hennep op ]
hennep
reading can seriously damage your ignorance
Je kunt alle declare statements bovenin zetten onder "option explicit" als je dat wilt gebruiken en boven de eerste function of sub
Dus bijvoorbeeld:
Option Explicit
Private Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
Private Declare Sub PortWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Integer)
Private Declare Sub PortDWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Long)
Private Declare Function PortIn Lib "IO.DLL" (ByVal Port As Integer) As Byte
Private Declare Function PortWordIn Lib "IO.DLL" (ByVal Port As Integer) As Integer
Private Declare Function PortDWordIn Lib "IO.DLL" (ByVal Port As Integer) As Long
Private Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Private Declare Sub ClrPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Private Declare Sub NotPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Private Declare Function GetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte) As Boolean
Private Declare Function RightPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Private Declare Function LeftPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Private Declare Function IsDriverInstalled Lib "IO.DLL" () As Boolean
Private Sub Command1_Click()
PortOut &H478, 255
End Subwanneer je meerder formulieren gaat maken die van io.dll gebruik maken dan is het handiger om het in een module te zetten.
Om er dan voor te zorgen dat het in alle formulieren werkt dien je geen private declare te gebruiken maar bijvoorbeeld
module:
Public Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
Public Declare Sub PortWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Integer)
Public Declare Sub PortDWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Long)
Public Declare Function PortIn Lib "IO.DLL" (ByVal Port As Integer) As Byte
Public Declare Function PortWordIn Lib "IO.DLL" (ByVal Port As Integer) As Integer
Public Declare Function PortDWordIn Lib "IO.DLL" (ByVal Port As Integer) As Long
Public Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub ClrPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub NotPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Function GetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte) As Boolean
Public Declare Function RightPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Public Declare Function LeftPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Public Declare Function IsDriverInstalled Lib "IO.DLL" () As Boolean
[Bericht gewijzigd door hennep op ]