Log In
Sign Up and Get Started Blogging!
JoeUser is completely free to use! By Signing Up on JoeUser, you can create your own blog and participate on the blogs of others!
rabidrobot XTreme!
Simulate PrtScr key
Published on September 22, 2005 By
rabidrobot
In
DesktopX Development
I had this widget idea I thought would be a great simple thing to make and learn with. I wanted to have a My Computer shortcut, and as part of the graphic there would be a thumbnail of an actual recent screenshot.
Well, I have banged my head on this for a couple weeks now. I have nearly broken google with days of queries.
My problem is getting the screenshot to work with and having it accessable to a script for cropping, resizing, and so on. I will list some of the things I have tried, but am open to any suggestions!
First I wanted to have the object take a shot and manipulate it when the user pressed the Prt Scr key. So I tried making Prt Acr a hotkey. I was able to define that key as a hotkey in the script, and have the script respond, but when the function of Prt Scr was redefined, it lost the function of capturing the screen. So my script would see Prt Scr be pressed, but the clipboard was empty. I also tried OnKeyUp variations, but the DX Object would only see these if the object was active, which meant that the object would have to be in the screenshot, because it was the last thing you clicked on. (Maybe there is a way around that, but I don't want too many steps required by the user).
I looked into a SendKeys function (if my lingo is a bit off I apologize, I'm picking all this scripting up as I go). But SendKeys can't send the Prt Scr key. No dice there.
So I thought I could just replicate the Prt Scr functionality somehow. I searched and looked until I realized I could add ocxs or dlls that could be used with CreateObject. Eventually I found a couple of these--there are many out there that claim to get screenshots, but only a couple were free and distruibutable. In any case, they all seem to work the same, and screenshots grabbed by them don't show any widgets or docks or bars. Just the Desktop Explorer Window. That's no good for a screenshot grabbing widget, to not grab widgets!
I thought about using SendKeys again, and telling MSPaint to do some stuff, but MSPaint itself won't grab the screen. The user would have to press Prt Scr, then activate the script. I was hoping for more automation (and such control would be helpful in more complex screenshot widgets).
I considered IrfanView. I could send it the commands (as long as user has it on their machine!) to grab the screen, and more. But again, the screengrabs by IrfanView didn't show widgets or docks. That's a good thing to check to see what I mean.
Now, this may show my ignorance, but it seems to me that when you press the Prt Scr key,
something
happens. Maybe a system executable is executed or a dll is accessed or something, but there's got to be a step between pressing the key & screenshot on clipboard. Like with the Show Desktop shortcut. That isn't magic, it is a call to a script which runs with wsh. Well, what
happens
when you press the Prt Scr key, and how can I simulate that or make it happen by other means?
thanks in advance, rr
Popular Articles in this Category
3d rotation (dynamic - sorta) video
Popular Articles from rabidrobot
Leaps of logic.
Comments
1
Chris TH
on Sep 22, 2005
I have nearly broken google with days of queries.
Have you tried the various developer forums? Usenet?
2
rabidrobot
on Sep 22, 2005
I haven't asked on any vbscript forums, but did search through several for similar questions. I also used Google Groups for archived usenet, but I don't yet subscribe to any newsgroups myself.
If you know of any particularly good forums or newsgroups I should subscribe to, please let me know! There are quite a few and I often have trouble finding the one everybody actually uses.
3
Chris TH
on Sep 22, 2005
I only check around very infrequently - coding's not something I usually do a lot of these days
Sometimes you just get lucky with your searches
4
MountainDragon
on Sep 22, 2005
Here's a link to a project that may help:
Link
And here's one with some info on different techniques:
Link
Here's another project that looks interesting:
Link
And yet another:
Link
5
rabidrobot
on Sep 23, 2005
Thanks, Mountain Dragon! I hadn't looked too closely at anything C++, but maybe I can pull something out of some of that code. If not, I can eventually learn C++ I guess!
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
Richer content, access to many features that are disabled for guests like commenting on the forums.
Access to a great community, with a massive database of many, many areas of interest.
Access to contests & subscription offers like exclusive emails.
It's simple, and FREE!
Sign Up Now!
Meta
Views
» 6647
Comments
»
5
Category
»
DesktopX Development
Comment
Recent Article Comments
A day in the Life of Odditie...
Safe and free software downl...
LightStar Design Windowblind...
Veterans Day
Let's start a New Jammin Thr...
A new and more functional PC...
Post your joy
Let's see your political mem...
AI Art Thread: 2022
WD Black Internal and Extern...
Sponsored Links