|
-
Apr 24th, 2005, 09:57 PM
#1
Thread Starter
New Member
4 button switchboard
Hello
I need some help in modifying my Visual Basic 5 code
I have a USBmicro interface board connected to the PC I have 4 switchs on 4 seperate ports
so when I press the read0 command button and hold down one of 4 momentary switchs the backcolor changes from &HFF to &H80
The following is the current sequence
1. Run program in windows
2. Push switch in on the u401 and hold, Click read0 command button in the form1 code.
3. backcolor changes from &HFF to &H80
4. release switch click read0 command button
backcolor goes back to &HFF
The sequence I would like is
1. Run program in windows
2. push switch in momentary
3. color changes from &HFF to &H80
4. release switch backcolor goes back to &HFF
The following code lies in my form1 (demotest.frm) which also has the following module files so as to acces the U401.
osinterface.bas
hidinterface.bas
miscfunc.bas
USBmAPI.bas
The code that needs to be modifided is as follows
Private Sub Read0_Click()
USBm_ReadA 0, State0
Write0Value.Text = TwoHexCharacters$(State0)
If State0 And &H1 Then D0.BackColor = &HFF Else D0.BackColor = &H80
If State0 And &H2 Then D1.BackColor = &HFF Else D1.BackColor = &H80
If State0 And &H4 Then D2.BackColor = &HFF Else D2.BackColor = &H80
If State0 And &H8 Then D3.BackColor = &HFF Else D3.BackColor = &H80
If you require more technial help please go to http://www.usbmicro.com
Thank you hope to hear from someone soon.
Last edited by Sally6; Apr 26th, 2005 at 02:48 AM.
Reason: url not working
-
Apr 24th, 2005, 11:01 PM
#2
Fanatic Member
Re: 4 button switchboard
I'm not sure what some of the controls are that you mentioned.
If you have a command button and set it's style to Graphical, then this code will work-
VB Code:
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.BackColor = &H80
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.BackColor = &HFF
End Sub
-
Apr 26th, 2005, 02:26 AM
#3
Thread Starter
New Member
Re: 4 button switchboard
Thanks Rob but that is for a mouse command if you go to the URL I have posted on the bottom of the thread it will give you an idea of what I want
Thanks Sally6
-
Apr 26th, 2005, 02:39 AM
#4
-
Apr 26th, 2005, 03:04 AM
#5
Re: 4 button switchboard
If I understand you correctly, you are in need of an event, that fires whenever an action is performed on the device.
If the dll you use doesn't provide you with any event like features, the only thing I can think about is to periodically poll for changes.
You could use a timer for this.
-
Apr 26th, 2005, 04:31 AM
#6
Thread Starter
New Member
Re: external switch device
Thanks Frans C Your first paragraph is correct I need an event to happen when I depress the external switch. my knowledge of visual basic is limited to manipulating the code for the USB micro interface board, click the run button and hope for the best. I know its possible to do I just need someone who is familiar with software hardware.
Thanks
Sally6
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
|