Home |
Search |
Today's Posts |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
OK, if that is acceptable to your users.
NickHK "Francis Ang" wrote in message ... Yes, you are right. It will not be possible to copy/paste when the code is running. "NickHK" wrote: So it's impossible to copy/paste anything when you code is running ? NickHK "Francis Ang" wrote in message ... I won't know when the user press PrtScr. The code will run continuously and clear the clipboard. This code takes about 1% or less of the CPU resources. This is how I use the code. Sub YourCode StartTimer Your other codes ... End Sub I must say this is not the best way to do it, but I achived my objective. "NickHK" wrote: So how do you know when the user pressed PrtScr ? NickHK "Francis Ang" wrote in message ... Here is the code ... Declare Function CloseClipboard Lib "user32" () As Long Declare Function EmptyClipboard Lib "user32" () As Long Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long Public RunWhen As Double Public Const cProc = "ClrSub" Sub ClearClipboard() OpenClipboard 0& EmptyClipboard CloseClipboard End Sub Sub StartTimer() RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime earliesttime:=RunWhen, procedu=cProc, _ schedule:=True End Sub Sub ClrSub() ClearClipboard StartTimer End Sub "NickHK" wrote: Can you post the code. NickHK "Francis Ang" wrote in message ... Thanks a lot guys for all your help. Just for your information, I have managed to circumvent the 'PrtScr' issue by using a timer and clear clipboard procedures. "NickHK" wrote: I'm guessing this is connected to the OP's previous request to prevent PrtScr rather than call it. NickHK "Halim" wrote in message ... Hi, If you want to capture the screen, maybe more simple if use API calls : Option Explicit Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _ bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Const VK_SNAPSHOT = &H2C Sub PRTSCR() keybd_event VK_SNAPSHOT, 1, 0, 0 End Sub Rgds, Halim "Francis Ang" wrote: The keys on a keyboard are assigned with 'KeyCode'. Is there a KeyCode for 'PrtScr'? I cannot seem to find this KeyCode. If there is no such KeyCode, can VBA codes detect when the 'PrtScr' key is pressed? Thanks. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Keycode description creator | Excel Discussion (Misc queries) | |||
TextBox and KeyCode | Excel Programming | |||
detecting keycode internationally | Excel Programming |