-
i have aprogram that uses hotkeys to copy info in the program to the clipboard and pastes it using Sendkeys "^{V}" [and i tried Sendkeys "+{INSERT", too]
the ^{V} just doesn't work, just makes my numlock flicker, the ={INSERT} works once then wont work again until i bring myprogram back to the front...
anyone know of an alternate way of pasting or a work-around?
-
I am not sure exactly what you are looking for. Reading your post, it seems like you want to paste something while your application is active.
You should use something like this
Code:
App.Activate "Your Application", true
Sendkeys "^V",True
You might want to look into "DoEvents" too.
Nitro Out
[Edited by Nitro on 04-22-2000 at 08:35 PM]
-
ok:
i want to be IN internet explorer while my program is running in the background, when i press the hotkey my program will paste text from my program TO internet explorer.
that's what i want it to do.
-
In that case, "Sendkeys" and "App.Activate" are wrong methods to use. You should be using a couple of API which I kind of forgot at this moment. If you have an API book, look up "Keyevent", "Capture Key", and "Release Key".
When I get home tonight, I will look up the API in more detail for you.
If you need this right away, here is an alternative. Place a timer in your program and make it check the clipboard. If it has something in it, use "Clipboard.Get".
-
the program already has a timer that checks the clipboard... but i don't see how that helps me paste...
i'll go look on the internet for those api commands...
-
Good!
Look up those API and let me know how you do with them.
Also look this up in the MSDN "Clipboard.Get". It should be equivalent to paste and that is why you can use this in your timer.
If you can't solve the problem, I will help you when I get home 1 a.m. tonight.
Nitro Out for good.
-
i aint seein' this clipboard.get command anywhere...
-
man, is it 1 a.m. yet? =D
-
Sorry!
Kind of stayed out a bit late lastnight.
It is call
Text1.text = Clipboard.GetText(vbCFText)
Let me look up my other projects and what did you find out on the key thing?
-
Sorry i didn't reply to this sooner, Nitro, i've been a bit sick =P
anyway, that isn't what i need, i don't need the text on the clipboard to go into my program, i need it to go into other programs... like internet explorer...
-
Hellow CWM!
Sorry to hear that you are sick.
Anyway, I am sorry to misled you about the Release and Set. It actually applies to mouse actions not keyboard action.
Let me get one thing clear up. So while you are in your application, you want to press a hot key and it will send to your IE?
Open up a copy of notepad and try this code in a module. Notepad cannot be minimize.
Code:
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Sub Main()
Dim lng_AwtWindow As Long
lng_AwtWindow = FindWindow("NotePad", vbNullString)
DoEvents
Call SetWindowPos(lng_AwtWindow, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
SendKeys "^(V)", True
End Sub
[Edited by Nitro on 04-25-2000 at 05:18 PM]
-
nope, while i'm in IE i want to hit a hot key and paste into IE...
here, it'd be a lot easier if you used my program (it's a damn good program anyway =])
here's a screenshot:
http://thedam.com/cwm/programs/cbss.gif
http://thedam.com/cwm/programs/ClipboardSaverS.exe
configure it like i have it there, just put some text in the top box and click save then select a hotkey (ctrl+shift+any key) and put it in the little box...
then open notepad and press the hotkey combination...
then try it in IE and you'll see what i mean
-