Click here to Skip to main content
15,914,416 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
David Crow17-Jun-05 3:31
David Crow17-Jun-05 3:31 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
BlackDice17-Jun-05 4:54
BlackDice17-Jun-05 4:54 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
David Crow17-Jun-05 5:14
David Crow17-Jun-05 5:14 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
BlackDice17-Jun-05 5:20
BlackDice17-Jun-05 5:20 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
David Crow17-Jun-05 5:24
David Crow17-Jun-05 5:24 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
BlackDice17-Jun-05 5:32
BlackDice17-Jun-05 5:32 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
Toby Opferman23-Jun-05 10:44
Toby Opferman23-Jun-05 10:44 
AnswerRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
Bob Stanneveld17-Jun-05 3:38
Bob Stanneveld17-Jun-05 3:38 
You cannot process those messages at the same time. You can however, simulate the behaviour by using some boolean states of which key is down and which key is up:
// In your class that processes the messages:
bool m_bIsVKLeftDown, m_bIsVKRightDown;

Second, you need to process the WM_KEYDOWN[^] and WM_KEYUP[^] messages:
// I assume that you are using MFC
// in you class
afx_msg void OnKeyDown(UINT nChar, UINT nRepCount, UINT nFlags)
{
    switch( nChar )
    {
    case VK_LEFT: m_bIsVKLeftDown = true; break;
    case VK_RIGHT: m_bIsVKRightDown = true; break;
    }

    CYourDerivedClass::OnKeyDown(nChar, nRepCount, nFlags);
}

afx_msg void OnKeyUp(UINT nChar, UINT nRepCount, UINT nFlags)
{
    switch( nChar )
    {
    case VK_LEFT: m_bIsVKLeftDown = false; break;
    case VK_RIGHT: m_bIsVKRightDown = false; break;
    }

    CYourDerivedClass::OnKeyUp(nChar, nRepCount, nFlags);
}

After that, you can move your window how you want depending on the different states.

Hope this helps Big Grin | :-D

Behind every great black man...
            ... is the police. - Conspiracy brother


Blog[^]
GeneralMapping a network drive programmatically Pin
Still learning how to code17-Jun-05 2:15
Still learning how to code17-Jun-05 2:15 
GeneralRe: Mapping a network drive programmatically Pin
David Crow17-Jun-05 2:22
David Crow17-Jun-05 2:22 
GeneralNon MFC X-Y Plots Pin
jerry1211a17-Jun-05 1:59
jerry1211a17-Jun-05 1:59 
GeneralRe: Non MFC X-Y Plots Pin
toxcct17-Jun-05 2:01
toxcct17-Jun-05 2:01 
GeneralRe: Non MFC X-Y Plots Pin
Ravi Bhavnani17-Jun-05 4:50
professionalRavi Bhavnani17-Jun-05 4:50 
QuestionHow to call VB DLL in C code ( VC environment) Pin
Tuscon17-Jun-05 1:04
Tuscon17-Jun-05 1:04 
AnswerRe: How to call VB DLL in C code ( VC environment) Pin
David Crow17-Jun-05 2:23
David Crow17-Jun-05 2:23 
AnswerRe: How to call VB DLL in C code ( VC environment) Pin
Mike Dimmick17-Jun-05 2:28
Mike Dimmick17-Jun-05 2:28 
GeneralShared data problem, use of #pragma data_seg() Pin
Vaibhav Sanghavi17-Jun-05 0:55
Vaibhav Sanghavi17-Jun-05 0:55 
GeneralRe: Shared data problem, use of #pragma data_seg() Pin
Blake Miller17-Jun-05 6:53
Blake Miller17-Jun-05 6:53 
GeneralRe: Shared data problem, use of #pragma data_seg() Pin
Vaibhav Sanghavi20-Jun-05 2:27
Vaibhav Sanghavi20-Jun-05 2:27 
GeneralC++ file I/O Pin
Hachaso17-Jun-05 0:49
Hachaso17-Jun-05 0:49 
GeneralRe: C++ file I/O Pin
toxcct17-Jun-05 0:59
toxcct17-Jun-05 0:59 
GeneralRe: C++ file I/O Pin
xiaohe52117-Jun-05 1:14
xiaohe52117-Jun-05 1:14 
GeneralRe: C++ file I/O Pin
toxcct17-Jun-05 1:24
toxcct17-Jun-05 1:24 
GeneralRe: C++ file I/O Pin
Bob Stanneveld17-Jun-05 1:44
Bob Stanneveld17-Jun-05 1:44 
GeneralRe: C++ file I/O Pin
David Crow17-Jun-05 2:25
David Crow17-Jun-05 2:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.