×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

need simple VB code help

need simple VB code help

need simple VB code help

(OP)
I have VB 6.0 I haven't programmed in 10 years
I know this is not hard, but I just am having an awful time.
All I need to do is send the following out the rs232 (com 1)
scrlck scrlck uparrow esc

can someone send me source code on how to do this?

I feel stupid, but I just can't make it work.

thanks

RE: need simple VB code help

For better help, this should be posted in the Visual Basic forum on this site or in the appropriate forum on Tek-Tips

TTFN

RE: need simple VB code help

The easy way to access the serial port is with the MSComm control. There is some sample code in VB Help.

However as far as I know there are no standard ASCII codes for scrlck or uparrow

Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting

UK steam enthusiasts: www.essexsteam.co.uk

RE: need simple VB code help

Have you looked at VB's SendKeys function? You can send {SCROLLLOCK}, {ESC} and {UP}.

Have fun.

RE: need simple VB code help

As far as I know SendKeys will only simulate keypresses to the currently active window and not to a serial port.

Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting

UK steam enthusiasts: www.essexsteam.co.uk

RE: need simple VB code help

(OP)
o.k.
I have had such bad luck with VB that I actually went back to QBASIC.

here is the code I an using.

10 OPEN "COM1:9600,N,8,1,CS,DS,RS" FOR RANDOM AS #1
20 PRINT #1, CHR$(176) + CHR$(176) + CHR$(214) + CHR$(27)
30 END

chr$(176) is num lock ( using this instead of scroll lock)
chr$(214) is the up arrow
chr$(27)  is the esc key

my problem now is that the keypress is not being released
so instead of the pc recieving numlock numlock up arrow esc
its recieving numlock-uparrow-esc.
(much like crtl-alt-del)
but it is not releasing the keypress.
also I am getting a chr$(13) (enter key press) without asking for one.
How do I get it to release the keypress?
I would greatly appreciate some direction on this.

RE: need simple VB code help

It's been a long time since I use QB in earnest, but try:
PRINT #1, CHR$(176);CHR$(176);CHR$(214);CHR$(27);

The semicolon should send each character separately, and suppress the final (implied) <CR>

Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting

UK steam enthusiasts: www.essexsteam.co.uk

RE: need simple VB code help

(OP)
Thanks for the help.
the semicolon did get rid of the extra <cr>, but the keys still remain in the down state.
is there a chr$ value to release a key press?
or a command to reset the keyboard bios?

Who would have thought it was so hard to send four keystrokes out the rs232?

RE: need simple VB code help

{SCROLLLOCK} is a toggle, isn't it?
Send it twice, it should be back where it started.
Send it too quick, it may get "debounced", with all but the first ignored.

Jay Maechtlen

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources