2014-03-27 51 views

回答

1
//API function declaration to simulate keystrokes GLOBAL EXTERNAL FUNCTION 
subroutine keybd_event(uint bVk,uint bScan,long dwFlags,long dwExtraInfo) library 'user32.dll' 


public function integer of_presskey (integer ai_key);//Calls an API function to simulate a key press 
keybd_event(ai_key,0,0,0) 
return 1 
end function 

public function integer of_releasekey (integer ai_key);//Calls an API function to simulate a key release 
keybd_event(ai_key,0,2,0) 
return 1 
end function 


//Put the following in the KEY event if available. Otherwise create a custom event using //the Event ID pbm_keydown for regular objects or the Event ID pbm_dwnkey for DataWindows. 
CONSTANT INT VK_SHIFT = 16  //Keycode for the SHIFT key 
CONSTANT INT VK_TAB = 09  //Keycode for the TAB key 

//Simulates a TAB keystroke when the DOWN ARROW OR ENTER is pushed as long 
//as it isn't on the last column or the last row. Kills the DOWN ARROW 
//keypress 
if ((key = KeyDownArrow! OR key = KeyEnter!)) then 
    ibl_noenter = false 
    of_presskey(VK_TAB) 
    of_releasekey(VK_TAB) 
    Yield() 
    return 1 

//Simulates a SHIFT + TAB keystroke when the UP ARROW is pushed. 
//Kills the UP ARROW keypress 
elseif (key = KeyUpArrow!) then 

    ibl_noenter = true 

    //Simulating SHIFT + TAB Keystroke 
    of_presskey(VK_SHIFT) 
    of_presskey(VK_TAB) 
    of_releasekey(VK_SHIFT) 
    of_releasekey(VK_TAB) 
    Yield() 

//Allows a TAB keypress to go through 
elseif (key = KeyTab!) then 

    return 0 

end if 
+0

非常感謝你^^ – Cechinel

相關問題