﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>A1VBCode Forums / Visual Basic (VB 4/5/6) / General Visual Basic  / Use more keys than one at a time? / Latest Posts</title><generator>InstantForum.NET v4.1.1</generator><description>A1VBCode Forums</description><link>http://www.a1vbcode.com/vbforums/</link><webMaster>forums@a1vbcode.com</webMaster><lastBuildDate>Mon, 08 Sep 2008 03:47:05 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>&lt;div class="Quote"&gt;&lt;b&gt;Panik (5/16/2008)&lt;/b&gt;&lt;hr noshade size="1" class="hr"&gt;is there an online table with all of them?&lt;/div&gt;&lt;P&gt;Online version of what? API Viewer or MSDN help?&lt;/P&gt;&lt;P&gt;You can download a newer version of &lt;STRONG&gt;API Viewer&lt;/STRONG&gt; &lt;a href="http://allapi.mentalis.org/agnet/" target="_blank" class="SmlLinks"&gt;here&lt;/a&gt; and while you are there you can download &lt;STRONG&gt;API-Guide&lt;/STRONG&gt; which is very useful, both of them are free.&lt;/P&gt;&lt;P&gt;As for MSDN help there is an online version but I don't find it any good. So your using a pirate copy of VB6 because VB6 comes with the MSDN help disks? Or you could search eBay there are MSDN disks on there.&lt;/P&gt;&lt;P&gt;I don't know which eBay you use but &lt;a href="http://search.ebay.com/MSDN-Library_W0QQbsZSearchQQcatrefZC6QQfposZQ5AIPQ2fPostalQQfromZR10QQfsooZ1QQfsopZ1QQfstypeZ1QQftrtZ1QQftrvZ1QQsacatZQ2d1QQsadisZ200QQsargnZQ2d1QQsaslcZ2QQsbrftogZ1QQsofocusZbs" target="_blank" class="SmlLinks"&gt;eBay Search&lt;/a&gt;, the second one it a bargin and you can buy now. &lt;/P&gt;&lt;P&gt;If you still have the VB6 CD then you can reinstall and add the API Viewer to the installation. &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Wink.gif" border="0" title="Wink"&gt;</description><pubDate>Fri, 16 May 2008 10:40:40 GMT</pubDate><dc:creator>Keithuk</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>is there an online table with all of them?</description><pubDate>Fri, 16 May 2008 08:30:09 GMT</pubDate><dc:creator>Panik</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>&lt;div class="Quote"&gt;&lt;b&gt;Panik (5/16/2008)&lt;/b&gt;&lt;hr noshade size="1" class="hr"&gt;&lt;P&gt;where can I find a list of the all the codes for the keys?&lt;/div&gt;&lt;P&gt;VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT and VK_SPACE you will find them in &lt;STRONG&gt;API Viewer&lt;/STRONG&gt; under Constants in API Type combo. &lt;P&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_DOWN = &amp;amp;H28&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_UP = &amp;amp;H26&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_LEFT = &amp;amp;H25&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_RIGHT = &amp;amp;H27&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_SPACE = &amp;amp;H20&lt;BR&gt;&lt;/P&gt;&lt;P&gt;The normal VB keycodes you can find in VB6 help under &lt;STRONG&gt;keycode contants&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Do you have the MSDN help?&lt;/P&gt;&lt;P&gt;Do you have API Viewer installed? &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Wink.gif" border="0" title="Wink"&gt;</description><pubDate>Fri, 16 May 2008 07:13:05 GMT</pubDate><dc:creator>Keithuk</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>oh, one more thing&lt;P&gt;where can I find a list of the all the codes for the keys?</description><pubDate>Fri, 16 May 2008 01:28:49 GMT</pubDate><dc:creator>Panik</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>man you saved my life! that's just perfect!!&lt;/P&gt;&lt;P&gt;thanks Mark &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Smile.gif" border="0" title="Smile"&gt;</description><pubDate>Thu, 15 May 2008 17:08:14 GMT</pubDate><dc:creator>Panik</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>You can use the GetAsyncKeyState API. It can be used to catch 2 keys.&lt;/P&gt;&lt;DIV style="BORDER-RIGHT: #000000 3px solid; PADDING-RIGHT: 25px; BORDER-TOP: #000000 3px solid; PADDING-LEFT: 25px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 25px; BORDER-LEFT: #000000 3px solid; PADDING-TOP: 25px; BORDER-BOTTOM: #000000 3px solid; BACKGROUND-COLOR: #cccccc"&gt;&lt;FONT color=#0000cc&gt;Option&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Explicit&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Declare&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Function&lt;/FONT&gt; GetAsyncKeyState Lib "user32" (&lt;FONT color=#0000cc&gt;ByVal&lt;/FONT&gt; vKey &lt;FONT color=#0000cc&gt;As&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Long&lt;/FONT&gt;) &lt;FONT color=#0000cc&gt;As&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Integer&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_DOWN = &amp;amp;H28&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_UP = &amp;amp;H26&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_LEFT = &amp;amp;H25&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_RIGHT = &amp;amp;H27&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Const&lt;/FONT&gt; VK_SPACE = &amp;amp;H20&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt; Form_Load()&lt;BR&gt;    Timer1.Interval = 100&lt;BR&gt;    Timer1.Enabled = True&lt;BR&gt;&lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt; Timer1_Timer()&lt;BR&gt;    &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; GetAsyncKeyState(VK_UP) &amp;lt;&amp;gt; 0 &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt; Picture1.Top = Picture1.Top - 30&lt;BR&gt;    &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; GetAsyncKeyState(VK_DOWN) &amp;lt;&amp;gt; 0 &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt; Picture1.Top = Picture1.Top + 30&lt;BR&gt;    &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; GetAsyncKeyState(VK_LEFT) &amp;lt;&amp;gt; 0 &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt; Picture1.Left = Picture1.Left - 30&lt;BR&gt;    &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; GetAsyncKeyState(VK_RIGHT) &amp;lt;&amp;gt; 0 &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt; Picture1.Left = Picture1.Left + 30&lt;BR&gt;    &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; GetAsyncKeyState(VK_SPACE) &amp;lt;&amp;gt; 0 &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt; Me.Caption = &lt;FONT color=#0000cc&gt;Val&lt;/FONT&gt;(Me.Caption) + 1&lt;BR&gt;&lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;</description><pubDate>Thu, 15 May 2008 11:25:15 GMT</pubDate><dc:creator>Mark</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>&lt;div class="Quote"&gt;&lt;b&gt;Panik (5/15/2008)&lt;/b&gt;&lt;hr noshade size="1" class="hr"&gt;yeah they're both pics&lt;P&gt;btw i dont see how the DoEvents is gonna solve anything&lt;/div&gt;&lt;/P&gt;&lt;STRONG&gt;DoEvents &lt;/STRONG&gt;- Yields execution so that the operating system can process other events.&lt;P&gt;If you have one object moving and then you try to move another object at the same time then it probably won't. DoEvents will switch between objects/processes. &lt;/P&gt;&lt;P&gt;Have you tried it? &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Wink.gif" border="0" title="Wink"&gt;</description><pubDate>Thu, 15 May 2008 11:05:55 GMT</pubDate><dc:creator>Keithuk</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>Yea I'm having the same problem too.&lt;/P&gt;&lt;P&gt;I'm stilll trying to find a solution for it and if I do I will let you know so you can use it too.</description><pubDate>Thu, 15 May 2008 10:44:51 GMT</pubDate><dc:creator>Phantom Sonic</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>yeah they're both pics&lt;/P&gt;&lt;P&gt;btw i dont see how the DoEvents is gonna solve anything&lt;/P&gt;&lt;P&gt;what I want to achieve is keep moving while shooting&lt;/P&gt;&lt;P&gt;While holding down 'right' if I press 'space', the 'right' key commands stop working (even though I'm still pressing it)</description><pubDate>Thu, 15 May 2008 06:32:42 GMT</pubDate><dc:creator>Panik</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>Try putting a few &lt;STRONG&gt;DoEvents&lt;/STRONG&gt; in the fire code. &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Wink.gif" border="0" title="Wink"&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If KeyCode = vbKeySpace Then&lt;BR&gt;fire.Left = player.Left + 1000&lt;BR&gt;fire.Top = player.Top + 700&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DoEvents&lt;BR&gt;fire.Visible = True&lt;BR&gt;Timer1.Enabled = True&lt;BR&gt;End If&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is fire and player just pictures then? It doesn't actually fire anything.&lt;BR&gt;</description><pubDate>Tue, 13 May 2008 13:17:41 GMT</pubDate><dc:creator>Keithuk</dc:creator></item><item><title>RE: Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>bump</description><pubDate>Tue, 13 May 2008 13:00:10 GMT</pubDate><dc:creator>Panik</dc:creator></item><item><title>Use more keys than one at a time?</title><link>http://www.a1vbcode.com/vbforums/Topic24847-3-1.aspx</link><description>I am creating a game and i need to find a way to enable the user to use more than one keys at a time&lt;/P&gt;&lt;P&gt;The case is...&lt;/P&gt;&lt;P&gt;I hold down right and the "character" moves right, then i press space to shoot (while keep holding right) and the character shoots the "fire" BUT he stops moving&lt;/P&gt;&lt;P&gt;Also the same happens when I press Up for jump&lt;/P&gt;&lt;P&gt;The char stops moving to the right and only moves up (he should keep moving while on air, like games such as super mario bros)&lt;/P&gt;&lt;P&gt;These are parts of the commands I use:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)&lt;BR&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If KeyCode = vbKeyRight Then&lt;BR&gt;player.Left = player.Left + 100&lt;BR&gt;End If&lt;BR&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If KeyCode = vbKeySpace Then&lt;BR&gt;fire.Left = player.Left + 1000&lt;BR&gt;fire.Top = player.Top + 700&lt;BR&gt;fire.Visible = True&lt;BR&gt;Timer1.Enabled = True&lt;BR&gt;End If&lt;BR&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;end sub&lt;/STRONG&gt;</description><pubDate>Thu, 08 May 2008 09:21:48 GMT</pubDate><dc:creator>Panik</dc:creator></item></channel></rss>