Skip to content
⌘ NSIS Forum Archive

Screenshot Plugin?

21 posts

lzandman#edited
Well, now there is... 🙂

I've just created a NSIS plugin that can save screenshots. It supports taking full-screen screenshots and screenshots of the NSIS window (but I think it has to be visible for this). Check it out:



I've included an NSI-file that should explain how it works.
lzandman#
But even though I created it, why would anyone want to use it? Why take a screenshot during install? 🧟

For me it was just practicing writing NSIS plugins, but I'm really interested in why anyone would use it...
Joost Verburg#
killahbite: You can get the size of the file.

lzandman: I've added your plug-in to the archive download section (http://nsis.sourceforge.net/archive/download.php). Please create an archive page for your plug-in. If possible, also try reduce the size of your plug-in.
Yathosho#
i'm asking cause i don't see it in this plugins notexistent documentation :P

i'd like to capture the avs window (avswnd), but this plugin seems only to capture fullscreen or nsis installer window.
Joost Verburg#
I don't think this plug-in supports it. You can ask the author to add this feature.
lzandman#
Thanx for all the comments. I've read them and changed nsScreenshot a little. I've removed the NSIS-window-capture function and replaced it by a more generic function that takes a window handle and captures that window. Just use the FindWindow function to get the window handle of a window and supply it to my plugin. To capture the NSIS window you can use $HWNDPARENT.

I've also reduced the plugin's size by removing some unused resources that Delphi stuffed in the DLL. And I've also compressed it using UPX. It's now 65 kB, which is still large but not as much as it used to be. Creating small code using Delphi is still a big problem...

For more information about nsScreenshot look at the archive page that I've just created 🙂

Killahbite: I don't think it is necessary for me to add support for file size to the plugin. There are other ways to determine this. Just search the forums for a way to get the file size.
Joost Verburg#
Please link to http://nsis.sourceforge.net/archive/...Screenshot.zip

I will update that file today.
lzandman#
Originally posted by Joost Verburg
Please link to http://nsis.sourceforge.net/archive/...Screenshot.zip

I will update that file today.
I've added that URL as a alternative to my own server, because it currently still holds the previous version.

By the way: I've named my plugin "nsScreenshot". You named the ZIP-file "Screenshot.zip" (without the 'ns'-prefix). Was that a mistake or don't you like the prefix? I'd rather you name it "nsScreenshot.zip", because that's more consistent. So could you please change it? 😁

P.S. Joost, ben jij een Nederlander?
Yathosho#
Originally posted by lzandman
I don't think it is necessary for me to add support for file size to the plugin. There are other ways to determine this. Just search the forums for a way to get the file size.
i was speaking of the image size (width x height), not filesize.
Yathosho#
i tried capturing the window of the winamp plugin avs (handle is avswnd). i get an error when i do so.
lzandman#edited
Originally posted by killahbite
i tried capturing the window of the winamp plugin avs (handle is avswnd). i get an error when i do so.
I can't test the AVS plugin here myself, but there are two things that might explain the error:
  • The window you want to capture isn't a top-level window. So you have to use the FindWindow function multiple times. You first have to get the handle to the top-level window and from there descent to the window you want to capture.

    For example, to capture the tray windows contents: The tray window is a child of the taskbar. See this picture:



    First we have to get the handle of the "Shell_TrayWnd" window and then we have to get the handle of the "TrayNotifyWnd" window. We can use the following code for this:

    FindWindow $R0 "Shell_TrayWnd"
    FindWindow $R0 "TrayNotifyWnd" "" $R0
    The first line returns a handle to the taskbar. The second line uses this handle to get the handle of the tray area. You can use programs like Spy++ or Winsight32 to determine window classes and parent-child relations.
  • AVS uses hardware acceleration (DirectX, OpenGL) to create the graphics. This way all graphic data is sent directly to the screen hardware without using Windows. This is much faster, but it also means that nsScreenshot can't capture it, because Windows doesn't know anything about it. When capturing such graphics you usually end up with a window containing nothing but blackness. But in this case nsScreenshot will not return "error" though...

I hope this helps you solve your problem 🙂

BTW.: I could put the image dimensions onto the stack, but unfortunately I can't FTP from here. So you have to wait a couple of hours for a new version of nsScreenshot to arrive 🙄
lzandman#
I've put the updated version online. It now includes support for returning image dimensions (width and height). When nsScreenshot returns "ok" (only then!) it has put two additional values onto the stack. Those values are the width and height of the captured image.

Currently you can only download it here, because the ZIP-file on the NSIS server isn't updated.

Question for Joost or Kichik: can I upload the latest version of my plugin to the NSIS archive server myself or do I have to signal you to update it?
kichik#
Originally posted by lzandman
Question for Joost or Kichik: can I upload the latest version of my plugin to the NSIS archive server myself or do I have to signal you to update it?
Not yet I'm afraid. We do want to enable it eventually but can't find the time to update the Archive.