|
|
|
|
![]() ![]() |
Jan 25 2006, 10:57 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 407 Joined: 13-December 04 Member No.: 2,696 |
I am having a problem with a windows console application on an NMR imaging instrument. The software is a console that takes control of the user’s screen. The problem is that the saving of the data we need causes crashes commonly. The program is not open source and specific to the scanner. I cannot replace the computer or change the operating system – it is an instrument used by others too who do not use the same imaging technique that I do. What works is taking screenshots every so many seconds and processing them, although this is a horrible time consuming method. I already have written a converter that reads the part of a BMP which contains data and convert to a workable format and store it in a separate file.
What I think will work is the following: Automatically make a screenshot just as if the key has been pressed every so many seconds Access the image in the clipboard (.BMP I suppose, hence the data is accessible easily) Append to file (I already have the code that will do this) However, I do not use windows so much and have no idea how to make screenshots from software and access the clipboard other than pressing ctrl-v in the paint program. Can anyone help me out here? |
|
|
|
Jan 29 2006, 05:44 AM
Post
#2
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 178 Joined: 13-October 04 From: NSW, Australia Member No.: 1,713 |
Firstly, it always helps to search the MSDN documentation for stuff like this. You would need to use Windows-specific commands (probably) to access the clipboard and take screenshots.
The way I'd do it is: 1) simulate a PrintScreen keypress (I'm pretty sure you could do this with the SendMessage() Function; send the WM_KEYDOWN Message with VK_SNAPSHOT as a parameter). If you wanted to find other Key Codes for any other steps, the MSDN library has an article titled 'Virtual-Key Codes' which has every code listed. 2) Use the Clipboard Win32 function/message set (MSDN article here: http://msdn.microsoft.com/library/default....e/clipboard.asp) to retrieve the data. The MSDN library has info on it all. You can easily find the articles in step 1 by simply searching for furthur reference. Good Luck mate! |
|
|
|
Feb 17 2006, 05:24 AM
Post
#3
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 67 Joined: 16-November 05 Member No.: 14,373 |
There is an API i think in order to get a screenshot of the screen. Check MSDN (http://msdn.microsoft.com) for the specific API and its usage. I wrote something like this a while ago to capture screenshots while playing a game and save them into a file in a directory. It will be a lot easier to create a new file or overwrite the old file instead of appending to it, because you would have to increase the size of the image.
|
|
|
|
Apr 23 2008, 03:00 PM
Post
#4
|
|
|
Trap Double Mocha Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,360 Joined: 21-September 07 Member No.: 50,369 |
Replying to kvarnerexpress
I'm not sure if this is exactly what you need, but I've had great success with [url=http://www.16software.Com/autoscreen]AutoScreen[/url]. It allows for saving of the screenshot in many different image formats (including BMP, which you wanted). I don't think simulating a PrintScreen keypress would be a good idea, because that would cause any data in the clipboard to be lost; this could of course be fixed by saving the data before you send the keypress, and then restoring it, but this could be inefficient, and there's always the possibility of a race condition (user tries to paste something they copied to the clipboard at the exact moment the clipboard data was temporarily replaced with a screenshot after simulating a PrintScreen keypress). -reply by jjnak |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 26th July 2008 - 08:10 AM |