Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,769,569 Members 44,516 Now Online
XDA Developers Android and Mobile Development Forum

[XAP] Screen capture program (Based on "The DllImport Project")

Tip us?
 
fiinix
Old
(Last edited by fiinix; 12th December 2011 at 12:40 AM.)
#1  
fiinix's Avatar
Retired Recognized Developer - OP
Thanks Meter 224
Posts: 568
Join Date: Oct 2010
Location: Stockholm

 
DONATE TO ME
Arrow [XAP] Screen capture program (Based on "The DllImport Project")

WP7 Screen capture program
[OBSOLETE, INSTEAD USE Screen Capturer v3]


Program structure

At application start Jaxbot's dehydrate hack, its enabled automatic by setting some registry values (that enables sort of multitasking). So that you can just run this app, go to home, enter the wanted app of you choice that you want to capture.

Brief info about how this app has functionality to take captures.: Uses The DllImport Project to talk to the system that enables C# code to call C++ for me.

The app is actually only an infinitive loop that listen for [Focus]-key.
As you can see below, a Sleep is enabled of 500ms to spare your battery so that is does not spam the system cpu with a while loop that runs forever, draining your battery fast.

Code:
public static void StartHook()
{
    Phone.Screen.init();

    bw = new BackgroundWorker();
    bw.DoWork += bw_DoWork;
    bw.RunWorkerAsync();
}

static void bw_DoWork(object sender, DoWorkEventArgs e)
{
    int key = (int)Phone.KeyboardHook.PhysicalKeys.Focus;
    while (true)
    {
        if (DllImportCaller.lib.GetAsyncKeyState7(key) != 0)
        {
            Phone.Screen.Capture cap = Phone.Screen.CaptureScreenToPictures();

            var str = string.Format("PictureName: {0}\nTimeElapsed: {1}ms\nPictureByteSize: {2}", 
                cap.PictureName, cap.TimeElapsed.TotalMilliseconds, cap.PictureByteSize);

            int res;
            DllImportCaller.lib.MessageBox7(str, "Screen Capture", (uint)MB.MB_OK, out res);
        }
        System.Threading.Thread.Sleep(500);
    }
}
In App instructions (Web)

[Checkbox] Jaxbot' Dehydrate hack (On / Off)
- This is for yourself, so you can toggle the "multitask" after capturing the app.
- Automatic activate on app launch (this)

"How to":
- Enter this app

- Navigate to the app you want to capture (no more than 2 apps in between (this app will be killed by "Watchdog"))

- Hold "focus" (not click, >focus), for at least 500ms
- Wait for messagebox to verify capture
- (SUCCESS) > Located under "Pictures > All > Saved Pictures"



Extras comments by me

(100% Verified to work (on mine lol))
Test pictures made at the moment: 460!

Fixed-list

- (1.0.1) Collision with real "Dll Import" when the guids are the same
- (1.0.2) GUI + Standalone + No collision with overwrite whats so ever (Same GUID)
- (1.0.3) "In-app dehydration toggler" + "better experience", EPIC release
- (1.0.4) Fail-safe, for sure no more multiple capture bug (2-4). (Test: I Can hold focus for 1 min and only one is captured).
- (1.0.4.0.0.0.1) For some random reason without debugger it took 1-6 captures, but WITH the debugger i could hold it for a minute and only one would be captured. Fixed now with a "Sleep()" to prevent 1+.
- (1.0.5) Now, problem with 2 msg box are 100000% GONE NOW! Ill pay you money else if 2 come up lol, jk
> Problem was located in "CSharp___DllImport.MainPage(); .ctor" that ALSO hooked to key-press.
- (1.0.5, HD2 edition) Now supports HD2, works now because its binded to "Search" instead of "Focus" -button; Aka "Search version".

Thanks for my time
Samsung Omnia 7
- ATO MAGLDR v2
Windows Phone 7

The hottest geek girl in the world SassiBoB, SassyBoB, Sassy BoB, sassibob
May the Thanks's button be with me at all time Luke Skywalker
The Following 36 Users Say Thank You to fiinix For This Useful Post: [ Click to Expand ]
 
Heathcliff74
Old
#2  
Heathcliff74's Avatar
Recognized Developer
Thanks Meter 2054
Posts: 1,439
Join Date: Dec 2010

 
DONATE TO ME
Thanks!

Feature request: disable / enable dehydration from within the app. Maybe an option to automatically reenable dehydration after the screenshot. I don't want to leave dehydration on, because of performance and batterylife.

Well done!
Heathcliff74

www.wp7roottools.com

Developer of "WP7 Root Tools"
Pioneer of "Interop Unlock"
Pioneer in Native Code Development on WP7


Also look at some of my other work:
Collection of all official WP7 updates, language packs and OEM updates
Guide for deploying files to your WP7 device


If you have questions about unlocking, please read this before you start mailing me, because my mailboxes are full

 
fiinix
Old
#3  
fiinix's Avatar
Retired Recognized Developer - OP
Thanks Meter 224
Posts: 568
Join Date: Oct 2010
Location: Stockholm

 
DONATE TO ME
Quote:
Originally Posted by Heathcliff74 View Post
Thanks!

Feature request: disable / enable dehydration from within the app. Maybe an option to automatically reenable dehydration after the screenshot. I don't want to leave dehydration on, because of performance and batterylife.

Well done!
Heathcliff74
Is there a good cross device that can toggle dehydrate? Because of how i see it its device specific (root access). Is there a basic lib out there that i know exist somewhere, ill implent it.
Thanks for criticism
Samsung Omnia 7
- ATO MAGLDR v2
Windows Phone 7

The hottest geek girl in the world SassiBoB, SassyBoB, Sassy BoB, sassibob
May the Thanks's button be with me at all time Luke Skywalker
 
contable
Old
#4  
contable's Avatar
Senior Member
Thanks Meter 953
Posts: 1,690
Join Date: Oct 2009

 
DONATE TO ME
Fantastic ! Thanks for this app. Confirmed working on my HD7.

Attached some screenies.
Attached Thumbnails
Click image for larger version

Name:	ScreenDump_2011-31-23 1131227330 .jpg
Views:	1376
Size:	47.4 KB
ID:	605274   Click image for larger version

Name:	ScreenDump_2011-31-23 1131452420 .jpg
Views:	731
Size:	48.8 KB
ID:	605275   Click image for larger version

Name:	ScreenDump_2011-35-23 1135573090 .jpg
Views:	619
Size:	33.5 KB
ID:	605276  
The Following 2 Users Say Thank You to contable For This Useful Post: [ Click to Expand ]
 
fiinix
Old
#5  
fiinix's Avatar
Retired Recognized Developer - OP
Thanks Meter 224
Posts: 568
Join Date: Oct 2010
Location: Stockholm

 
DONATE TO ME
Quote:
Originally Posted by contable View Post
Fantastic ! Thanks for this app. Confirmed working on my HD7.

Attached some screenies.
Thanks for reporting (cross compiled anyways (device non-specific)).

> One "thanks" for you
Samsung Omnia 7
- ATO MAGLDR v2
Windows Phone 7

The hottest geek girl in the world SassiBoB, SassyBoB, Sassy BoB, sassibob
May the Thanks's button be with me at all time Luke Skywalker
 
Heathcliff74
Old
#6  
Heathcliff74's Avatar
Recognized Developer
Thanks Meter 2054
Posts: 1,439
Join Date: Dec 2010

 
DONATE TO ME
Quote:
Originally Posted by fiinix View Post
Is there a good cross device that can toggle dehydrate? Because of how i see it its device specific (root access). Is there a basic lib out there that i know exist somewhere, ill implent it.
Thanks for criticism
I'm not sure, but I believe the registry value that needs to be set can be changed with the normal registry api (no root access required). I could be wrong though. If it doesn't work, then the COM dll's from Samsung and HTC will work for sure. But you need to add the COM dll's for all the different brands and they have different interfaces. It isn't too hard though.

By the way, the criticism was meant as "constructive criticism" I appreciate your work.

Ciao,
Heathcliff74

www.wp7roottools.com

Developer of "WP7 Root Tools"
Pioneer of "Interop Unlock"
Pioneer in Native Code Development on WP7


Also look at some of my other work:
Collection of all official WP7 updates, language packs and OEM updates
Guide for deploying files to your WP7 device


If you have questions about unlocking, please read this before you start mailing me, because my mailboxes are full

 
fiinix
Old
#7  
fiinix's Avatar
Retired Recognized Developer - OP
Thanks Meter 224
Posts: 568
Join Date: Oct 2010
Location: Stockholm

 
DONATE TO ME
Quote:
Originally Posted by Heathcliff74 View Post
I'm not sure, but I believe the registry value that needs to be set can be changed with the normal registry api (no root access required). I could be wrong though. If it doesn't work, then the COM dll's from Samsung and HTC will work for sure. But you need to add the COM dll's for all the different brands and they have different interfaces. It isn't too hard though.

By the way, the criticism was meant as "constructive criticism" I appreciate your work.

Ciao,
Heathcliff74
Yep thats what i tried to say, "constructive criticism", forgot how to call if fully out
Samsung Omnia 7
- ATO MAGLDR v2
Windows Phone 7

The hottest geek girl in the world SassiBoB, SassyBoB, Sassy BoB, sassibob
May the Thanks's button be with me at all time Luke Skywalker
 
contable
Old
#8  
contable's Avatar
Senior Member
Thanks Meter 953
Posts: 1,690
Join Date: Oct 2009

 
DONATE TO ME
Also working fine on my OMNIA 7. I can enable/disable dehydration with advanced config tool on both devices.

@Heathcliff:

After testing the HD7 for some weeks now I decided to go back to the OMNIA 7 when you have finished your work. The HD7 isnīt nearly as good as the OMNIA 7 but atm the best choice if you wanna do some customizations...
Attached Thumbnails
Click image for larger version

Name:	ScreenDump_2011-12-24 1212552060 .jpg
Views:	313
Size:	55.3 KB
ID:	605332  
 
Dyskmaster
Old
#9  
Senior Member
Thanks Meter 8
Posts: 166
Join Date: Jul 2010
wow, thanks for the app! Here are some of my own screenshots
Attached Thumbnails
Click image for larger version

Name:	4460 PM.jpg
Views:	271
Size:	47.2 KB
ID:	605542   Click image for larger version

Name:	Photo_0994C899-D49A-508C-BE4B-BDFE976E9FB2.jpg
Views:	261
Size:	58.5 KB
ID:	605543  
Devices that I own or owned:
Iphone 3g, HTC Pure, Samsung Focus, ipod touch 2g 8gb, zune HD 64gb, Apple Ipad 1st gen 16gb wifi, Asus Transformer tablet (32gb) and dock, Samsung Galaxy Player 5
 
Ddriver
Old
#10  
Ddriver's Avatar
Senior Member
Thanks Meter 23
Posts: 382
Join Date: Mar 2005
Thanks for your work, but I have now the same problem like this tread.
Greets Ddriver.

Nokia Lumia 925 32GB GER ORG CH Amber
Nokia Lumia 820 - 8.0.10328.78 - WP8
HTC Titan 16GB 7.10.8858.136 Dynamics v2.0 - 7.8 TOP!!!
HTC Mozart 8GB "Mango" 7.10.8107.79 Chevron loose GER / Now with "Ansar-Tech-ROM"
HTC Mozart 16GB "Tango" 7.10.8773.98 Chevron 9$ and loose GER/RUS
HTC T5353 Diamond2 GER
HTC T8282 HD GER
HTC P3700 Diamond GER

Tags
capture, screen, wp7
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes