|
You show us what you have done so far. Not all of it, just the bit you can't get to work, together with a full explanation of how it doesn't work, error messages etc.
Then if anyone sees a problem they will probably offer some help.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Dear All,
I have a problem whle declaring input and output variable to pass a 'C' based Dll.
The Dll Api is as follows:
int rw_polling(int PortNumber,unsigned char *SelSysCode, unsigned char *IDm, unsigned char *PMm,int *Response)
Function :Send Polling Command to Card
Return :TRUE = succeeded FALSE = failed
Input :
*PortNumber : com port number (1-8)
*SelSysCode(2bytes) : systemcode of target card
Output :
*IDm(8bytes) : IDm from card
*PMm(8bytes) : PMm from card
*Response : 0 = succeeded
1 = Reader Writer is not open
2 = no response (ACK) from reader/writer
3 = check sum error of received data
10 = card is not detected
Problem:
In the above function I want to pass values of the variable
Input Variables
1) PortNumber=1
2) unsigned char *SelSysCode = 2bytes i.e FF and FF
Output variables
3)IDm (8 Bytes)
4) PMm (8 Bytes)
5) Response.
How I tried:
in Declarations:
Declare Function rw_polling Lib "RCS962INSPCT.dll" (ByVal PortNumber As Long, ByRef SelSysCode As Long, ByRef IDm As Long, ByRef PMm As Long, ByRef Response As Long) As Long
While calling through VB Form:
Dim PortNumber As Long
Dim SelSysCode(1) As Byte
Dim IDm(7) As Byte
Dim PMm(7) As Byte
Dim Response As Long
Dim ReturnCode As Long
'PortNumber = cmbComPort.ItemData(Me.cmbComPort.ListIndex)
PortNumber=1
'Here I want to pass value of 2 bytes i.e FF and FF
SelSysCode(0) = &HFF
SelSysCode(1) = &HFF
ReturnCode = rw_polling(PortNumber, VarPtr(SelSysCode(0)), VarPtr(IDm(0)), VarPtr(PMm(0)), Response)
Result: Function is returning false
Response: 10
If Response = 0 Then
pp = "succeeded"
ElseIf Response = 1 Then
pp = "Reader Writer is not open"
ElseIf Response = 2 Then
pp = "no response (ACK) from reader/writer"
ElseIf Response = 3 Then
pp = "check sum error of received data"
ElseIf Response = 10 Then
pp = "card is not detected"
End If
If ReturnCode = 0 Then
txtMsg.Text = Trim(txtMsg.Text) & vbCrLf & pp
txtMsg.Text = Trim(txtMsg.Text) & vbCrLf & "Pooling Fail"
Else
txtMsg.Text = Trim(txtMsg.Text) & vbCrLf & pp
txtMsg.Text = Trim(txtMsg.Text) & vbCrLf & "Pooling Success"
End If
What I want is:
by which way can I pass the value (FF and FF 2bytes) Input Variable for SelSysCode.
I am able to caputre the Response also.
Please anybody help me in this regarding in VB6
Ram
|
|
|
|
|
Why are you still using VB6 in 2009 ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
This is my normal reaction until one of the junior devs found out that passing a struct from C#/VB.net to a C DLL fails whereas using VBA/VB6 works . I found this so distressing I refused to have anything to do with the project.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
In my company we had VB6 Apps and our main Priority was to get rig of them. and we Did, and never wanted to do anything that is related to it , i will not attempt to answer vb6 Questions , i cant remember how it is
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
hi,
i want to check printer is currently installed or not?
then one more how to check printer status?
i mean printer is busy or not..
plz help me.
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
goto start menu settings printer and faxes then lesect ur printer name thats it
Regards
Vidhish
|
|
|
|
|
hi,
i got printer name.
thx for your information.
i have one more doubt..
i have using network sharing printer.
now i am give print request. but already somebodies use same printer.
now i need status of printer is busy or not...
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Why?? The jobs will queue up on each machine until the printer is no longer busy with the previous job. Then, it'll print the next job in the queue automatically.
|
|
|
|
|
ya i no..
but i need some status of printer...
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Again, why do you need the status of the printer?? It's rare that anyone would need this.
|
|
|
|
|
|
I've asked this before, but just in case it was missed, I thought I'd ask again.
"I want to emphasize the relationship of some adjacent Cell Rows in a Column, by Drawing a 2 or 3 Pixel Line around the Group of Cells.
I read that the Microsoft DataGridView Control does not support the Individual Cell Border Style in the Current Version.
Does anyone have a routine, or suggestions that will achieve this result with the MS DataGridView Control."
Regards, Graham
|
|
|
|
|
You could use the OnPaintCell event to give them a common background colour.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thank you Henry.
If I'd wanted to know about BackColor I would have asked that question.
The question was about Drawing a line!
Regards, Graham
|
|
|
|
|
You also asked for other suggestions.
I made one.
Sorry you didn't like it, but there was no need for you to respond, if that was the case.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I need to populate a DGV. I need to be able to index the rows of the DGV by a string variable. But I also need to have duplicate rows in the DGV. A collection allows me to index the rows the way I need to, but doesn't allow duplicate keys. Is there any other alternative?
Thanks
|
|
|
|
|
Hi,
what collection are you using?
some of them (such as List) don't care about unique items, others do (such as Dictionary which requires unique keys).
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Hello,
Dim Mycollection as new collection
Are you saying I should be looking into List(of)?
Thanks!
|
|
|
|
|
you should ALWAYS use typed containers.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
if you're using a hashtable, you can make the key map to a list of items, then you can add duplicates there.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
"Make the key map to a list of item" sounds like what I want, but how?
I map my collection (maybe a hashtable) to the DGV
Each item in the collection represents a separate row in the DGV
I write to the collection through the key. Ideally, more than one row could have the same key and would all be written to in the same set.
But collections, hashtables too, require unique keys.
What am I missing?
Thanks again.
|
|
|
|
|
You could create a Dictionary< string, List< someThing>> which would map each string onto a List holding zero, one, or more objects of type someThing.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Yes, that's what I was trying to say :P
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi everyone, im working on the GCS part of our autopilot project. I have developed it in visual basic.net 2005 , what the software basically does is that it receives the values byte by byte, convert them into type double and then displays it on the gauges attached in the design window, im attaching my code below, can someone please tell me if whatever i have done here is correct ?? I would be really grateful thank you (also anyone knows if there is an opensource gcs availible that can receive the serial states serially).
VB.NET CODE:
'Enlisting the classes that could be inherited by this class'
Imports System
Imports System.Drawing
Imports System.Windows.Forms
'Class for the main GCS form
Public Class Form1
Inherits System.Windows.Forms.Form 'Inheritance
'----------------Initializations----------------------------------------'
Dim WithEvents serialportx As New System.IO.Ports.SerialPort 'Declaring serial port form'
Public Delegate Sub throttle()
Public Delegate Sub airspeed()
Public Delegate Sub altitude()
Public Delegate Sub orientation()
Public Delegate Sub direction()
Public Delegate Sub direction2()
Public Delegate Sub rollorientation()
Public Delegate Sub latitude()
Public Delegate Sub longitude()
Dim incomingspeed As Boolean
Dim incomingheight As Boolean
Dim incomingangle As Boolean
Dim incomingposition As Boolean
Dim incomingrollangle As Boolean
Dim incominglatitude As Boolean
Dim incominglongitude As Boolean
Dim receive(,) As Byte
Dim singlearray() As Single
Dim temp() As Byte
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'--------Loading Serial Port Form--------
If serialportx.IsOpen Then
serialportx.Close()
End If
Try
With serialportx 'setting serial comm. parameters
.PortName = "COM2"
.BaudRate = 115200
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
' .ReadBufferSize = 4
End With
serialportx.Open() 'opening serial port
Catch ex As Exception
MsgBox(ex.ToString)
End Try
'------------------------------------------
'--Adding Gauges & Map Controls
Me.Controls.Add(airspeedx)
'Me.Controls.Add(mmap1)
Me.Controls.Add(orientationx)
Me.Controls.Add(directionx)
Me.Controls.Add(altitudex)
'------------------------------------------
End Sub
Public Sub SerialPortX_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles serialportx.DataReceived
Dim length As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
If serialportx.BytesToRead > 0 Then
length = receive.Length()
For i = 0 To 14
For j = 0 To 3
receive(i, j) = serialportx.ReadByte()
temp(j + i * 4) = receive(i, j)
Next
Next
If temp(0) = 102 And temp(1) = 105 And temp(2) = 105 And temp(3) = 105 Then
For k = 0 To 14
singlearray(k) = BitConverter.ToDouble(temp, 4 * k)
Next
End If
End If
altitudex.Invoke(New altitude(AddressOf updatealtitude), New Object() {})
airspeedx.Invoke(New airspeed(AddressOf updateairspeed), New Object() {})
orientationx.Invoke(New orientation(AddressOf updatepitch), New Object() {})
orientationx.Invoke(New rollorientation(AddressOf updateroll), New Object() {})
altitudex.Invoke(New altitude(AddressOf updatealtitude), New Object() {})
End Sub
Public Sub updatealtitude()
With altitudex
.Altitude = singlearray(5)
.AltBarometer = singlearray(5) / 1000
End With
End Sub
Public Sub updateairspeed()
With airspeedx
.Airspeed = singlearray(1)
End With
End Sub
Public Sub updatepitch()
With orientationx
.AHPitch = singlearray(4)
End With
End Sub
Public Sub updateposition()
With directionx
.HeadingIndicator = singlearray(3)
End With
End Sub
' Public Sub updateposition2()
'With mmap1
'.ObjectID = 0
' .ObjectOrientation = receive(4)
' End With
' End Sub
Public Sub updateroll()
With orientationx
.AHRoll = singlearray(9)
End With
End Sub
'Public Sub updatelatitude()
'With mmap1
' .ObjectID = 0
' .ObjectX = receive(6)
' End With
' End Sub
' Public Sub updatelongitude()
'With mmap1
' .ObjectID = 0
' .ObjectY = receive(7)
'End With
' End Sub
End Class
modified on Sunday, June 21, 2009 5:25 PM
|
|
|
|