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


Comments
on Sep 22, 2005
I have nearly broken google with days of queries.




Have you tried the various developer forums? Usenet?


Posted via WinCustomize Browser/Stardock Central
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.
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


Posted via WinCustomize Browser/Stardock Central
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
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!