Coding a screen capture app

Status
Not open for further replies.

office politics

It's all just 1s and 0s
Messages
6,555
Location
in the lab
We currently use freeware to run a screencap utility. It's pretty handy and a lightweight app. I'm wondering what it would take to code something like this.

What could be done to complete these features? Choose any language.

Show icon in the systray

Listen for the Printscreen or Alt+ Printscreen Key Press. Optionally you could check the clipboard for the copied image.

Show that image in a window and present options
-->save image
-->grab new image with rubberband
-->edit image
-->print image
 
I am sure it wouldnt be to hard. But with the selection out there like WinSnap and SnagIt, what would be the draw of coming up with such a app that isnt already out there? I mean the Snipping Tool built into Vista/Win7/Win8 can do almost all of that already and is built right in.
 
@SOUL - Yes, user selectable area. I refer to the box that appears during the click n drag as the "rubberband".

@Mak - The draw is to gain experience. Starting with a project that is small. I've tried a few different apps before but usually like the one we currently use the best. However, the current app occasionally errors out when running on win7. The error is hard to decipher; probably some memory access crap.


I guess I'll start by starting a app that shows the icon in the systray. prolly write it in c# (which I'm most familar with). Have it pop up a blank window when clicked.
 
this is a proposed class design

feel free to suggest changes

Code:
screencap

attributes

  int    imgTopLeft
  int    imgBottomRight

  string whichPrinter

methods

  startApp()
  closeApp()

  down2Tray()
  upFromTray()

  grabImage(int topleft, int bottomright)

  saveImage(string filePath)

  printImage(string printerName)

  pickRubberband()
 
Only the most trivial of applications would be suitable for developing in a single class and this is definitely not such an application. Here is an example layout that I might start with if I were to write it in java. Note that this is a directory hierarchy and that each .java file represents a class or an interface. Also note that there is almost definitely things missing and probably a couple that it doesn't need, but it should give you a better idea of the scale.

com/example/apps/screencap/Main.java
com/example/apps/screencap/configuration/ConfigController.java
com/example/apps/screencap/configuration/ConfigModel.java
com/example/apps/screencap/configuration/ConfigPanel.java
com/example/apps/screencap/file/print/PrintController.java
com/example/apps/screencap/file/print/PrintModel.java
com/example/apps/screencap/file/print/PrintPanel.java
com/example/apps/screencap/file/save/SaveController.java
com/example/apps/screencap/file/save/SaveModel.java
com/example/apps/screencap/file/save/SavePanel.java
com/example/apps/screencap/image/ImageEncoder.java
com/example/apps/screencap/screen/Screen.java
com/example/apps/screencap/screen/ScreenData.java
com/example/apps/screencap/selection/SelectionArea.java
com/example/apps/screencap/system/Tray.java
com/example/apps/screencap/system/TrayStatus.java
 
What's wrong with a single class with multiple methods? I don't know many good coding practices, genuine question lol.
 
The question that you've just asked is effectively the same as "what's wrong with procedural programming?". The answer is: nothing if the program is trivial or the developer(s) are very experienced and understand completely the state of the entire application at any given time. Bear in mind that while my outline may seem more intimidating than office politic's, both approaches require roughly the same number of lines of code and that the result of his would be one enormous file which would be very intimidating indeed.
 
i think we could gain benefit from segmentation as well. The files described by kmote could be used by several different programs. Thereby, not needed to reinvent the wheel each time a new program is developed. If you need to update a class because of some other dependancy (OS upgrade, Java Version upgrade, etc), then you only need to update one file and recompile.
 
I will appreciate if there is a way to programm the application to take an screen shot at a fixed rate (30 per second, 2 per second, 1 each 5 seconds...) and save the files in a given folder. If possible it could be a screen video streaming recorder that solves some issues of the commercial ones.
 
Status
Not open for further replies.
Back
Top Bottom