473,287 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Not able to take screen shots of "S to make presentation

Hello there,

I am relatively new to the newsgroups and C#. I have never been disappointed
with the groups and always got the prompt replies to my queries.This is yet
another strange issue, I am facing. Please please help me to solve this as
soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...

using System;
using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

using System.Reflection;

using Microsoft.Win32 ;

using System.Runtime.InteropServices;

namespace WindowsApplication1

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.Timer timer1;

private System.ComponentModel.IContainer components;

private System.Windows.Forms.Button button1;

int i;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

i=0;

//

// TODO: Add any constructor code after InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

[System.Runtime.InteropServices.DllImportAttribute( "gdi32.dll")]

private static extern bool BitBlt

(

IntPtr hdcDest, // handle to destination DC

int nXDest, // x-coord of destination upper-left corner

int nYDest, // y-coord of destination upper-left corner

int nWidth, // width of destination rectangle

int nHeight, // height of destination rectangle

IntPtr hdcSrc, // handle to source DC

int nXSrc, // x-coordinate of source upper-left corner

int nYSrc, // y-coordinate of source upper-left corner

System.Int32 dwRop // raster operation code

);

private void Capture_Screen(string filename)

{

Graphics g1 = this.CreateGraphics();

Image MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

Graphics g2 = Graphics.FromImage(MyImage);

IntPtr dc1 = g1.GetHdc();

IntPtr dc2 = g2.GetHdc();

BitBlt(dc2, 0, 0, this.ClientRectangle.Width,

this.ClientRectangle.Height, dc1, 0, 0, 13369376);

g1.ReleaseHdc(dc1);

g2.ReleaseHdc(dc2);

MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.button1 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 1000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

// button1

//

this.button1.Location = new System.Drawing.Point(80, 32);

this.button1.Name = "button1";

this.button1.TabIndex = 0;

this.button1.Text = "button1";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// Form1

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.ClientSize = new System.Drawing.Size(232, 101);

this.Controls.Add(this.button1);

this.Name = "Form1";

this.Text = "Form1";

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

this.Load += new System.EventHandler(this.Form1_Load);

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void Form1_Load(object sender, System.EventArgs e)

{

this.Hide();

}

private void Connecticon_Click(object sender, System.EventArgs e)

{
}

private void timer1_Tick(object sender, System.EventArgs e)

{
string filename;

try

{

i=i+1;

filename= "img" + i.ToString() ;
Capture_Screen(filename);

}

catch(Exception exx)

{

MessageBox.Show(exx.Message.ToString());
this.Dispose();

Application.Exit();

}

}

private void button1_Click(object sender, System.EventArgs e)

{
}

}

}
Problem Description
----------------------

These programs are taking the screenshots of the wallpaper behind the
windows application along with the mouse cursor .So it is apparent that
mouse is clicking on the particular points of screen where menus or button
exist in my application but doesn't take the screen shot of form. Isn't it
strange? Also these programs are taking the snapshot of other windows based
application.

I am able to take the snapshot of my application (which is not visible to
above programs) using "PrintScreen" and pasting it in the paint.Also I am
able to take the snapshots of some of the forms of application (using above
4 programs), which have a label to display the message and some background
image setup at runtime.

Let me tell you that my windows application uses the skins which can be
changed dynamically using XML and there are few background images setup at
runtime for the forms. I think that the problem is because of some property
of the application or windows form.

I believe that I have described the problem well enough to understand. Now
the ball is in your court. Please help me..........
Regards,

Rajat Tandon.
A DotNet Learner.
Nov 16 '05 #1
9 2790
"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Hello there,

I am relatively new to the newsgroups and C#. I have never been
disappointed
with the groups and always got the prompt replies to my queries.This is
yet
another strange issue, I am facing. Please please help me to solve this as
soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...


How about
5) Hit [Prt Scr], launch mspaint and paste.

David
Nov 16 '05 #2
I suspect that the poster meant programmatically when he said "at runtime"
so I doubt print screen is going to meet his needs.

But, that said, it occurs to me that a simple way (and I haven't tested
this, so I may be wrong), might be to simply send the print-screen keystroke
via the Win32 SendInput() API function and then get the bitmap out of the
clipboard.

Pete

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:OP**************@TK2MSFTNGP14.phx.gbl...
"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Hello there,

I am relatively new to the newsgroups and C#. I have never been
disappointed
with the groups and always got the prompt replies to my queries.This is
yet
another strange issue, I am facing. Please please help me to solve this as soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...


How about
5) Hit [Prt Scr], launch mspaint and paste.

David

Nov 16 '05 #3
Hi David and everybody,

Thank you for early reply. Of course PrintScreen is an option but not a good
one, As I have to make presentation. Print Screen and paste will require me
to do this for thousands of time.Hence I want the automated way.

Looking for more replies

Bye
Rajat Tandon
A DotNet Learner

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:OP**************@TK2MSFTNGP14.phx.gbl...
"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Hello there,

I am relatively new to the newsgroups and C#. I have never been
disappointed
with the groups and always got the prompt replies to my queries.This is
yet
another strange issue, I am facing. Please please help me to solve this as soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...


How about
5) Hit [Prt Scr], launch mspaint and paste.

David

Nov 16 '05 #4
If you have Windows XP, you can use the "PrintWindow" API. It will take a
snapshot of a window and put it into a DC.

Look in MSDN for info on the PrintWindow() API. You should be able to
replace the BitBlt() call with a PrintWindow call, and then your code should
work. It would probably look something like this (UNTESTED CODE):

[System.Runtime.InteropServices.DllImportAttribute( "user32.dll")]
private static extern bool PrintWindow
(
IntPtr hWnd,
IntPtr hDC,
int nFlags
);

private void Capture_Screen(string filename)
{
Image MyImage = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(MyImage);
IntPtr dc = g.GetHdc();

PrintWindow(this.Handle,dc,0);
g.ReleaseHdc(dc);
MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);
}

If you don't have XP - well, I'm not sure what to tell you there.

HTH

- Scott

"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Hello there,

I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am facing. Please please help me to solve this as
soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...

using System;
using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

using System.Reflection;

using Microsoft.Win32 ;

using System.Runtime.InteropServices;

namespace WindowsApplication1

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.Timer timer1;

private System.ComponentModel.IContainer components;

private System.Windows.Forms.Button button1;

int i;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

i=0;

//

// TODO: Add any constructor code after InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

[System.Runtime.InteropServices.DllImportAttribute( "gdi32.dll")]

private static extern bool BitBlt

(

IntPtr hdcDest, // handle to destination DC

int nXDest, // x-coord of destination upper-left corner

int nYDest, // y-coord of destination upper-left corner

int nWidth, // width of destination rectangle

int nHeight, // height of destination rectangle

IntPtr hdcSrc, // handle to source DC

int nXSrc, // x-coordinate of source upper-left corner

int nYSrc, // y-coordinate of source upper-left corner

System.Int32 dwRop // raster operation code

);

private void Capture_Screen(string filename)

{

Graphics g1 = this.CreateGraphics();

Image MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

Graphics g2 = Graphics.FromImage(MyImage);

IntPtr dc1 = g1.GetHdc();

IntPtr dc2 = g2.GetHdc();

BitBlt(dc2, 0, 0, this.ClientRectangle.Width,

this.ClientRectangle.Height, dc1, 0, 0, 13369376);

g1.ReleaseHdc(dc1);

g2.ReleaseHdc(dc2);

MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.button1 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 1000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

// button1

//

this.button1.Location = new System.Drawing.Point(80, 32);

this.button1.Name = "button1";

this.button1.TabIndex = 0;

this.button1.Text = "button1";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// Form1

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.ClientSize = new System.Drawing.Size(232, 101);

this.Controls.Add(this.button1);

this.Name = "Form1";

this.Text = "Form1";

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

this.Load += new System.EventHandler(this.Form1_Load);

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void Form1_Load(object sender, System.EventArgs e)

{

this.Hide();

}

private void Connecticon_Click(object sender, System.EventArgs e)

{
}

private void timer1_Tick(object sender, System.EventArgs e)

{
string filename;

try

{

i=i+1;

filename= "img" + i.ToString() ;
Capture_Screen(filename);

}

catch(Exception exx)

{

MessageBox.Show(exx.Message.ToString());
this.Dispose();

Application.Exit();

}

}

private void button1_Click(object sender, System.EventArgs e)

{
}

}

}
Problem Description
----------------------

These programs are taking the screenshots of the wallpaper behind the
windows application along with the mouse cursor .So it is apparent that
mouse is clicking on the particular points of screen where menus or button
exist in my application but doesn't take the screen shot of form. Isn't it
strange? Also these programs are taking the snapshot of other windows based application.

I am able to take the snapshot of my application (which is not visible to
above programs) using "PrintScreen" and pasting it in the paint.Also I am
able to take the snapshots of some of the forms of application (using above 4 programs), which have a label to display the message and some background
image setup at runtime.

Let me tell you that my windows application uses the skins which can be
changed dynamically using XML and there are few background images setup at
runtime for the forms. I think that the problem is because of some property of the application or windows form.

I believe that I have described the problem well enough to understand. Now
the ball is in your court. Please help me..........
Regards,

Rajat Tandon.
A DotNet Learner.

Nov 16 '05 #5
Scott, As you suggested about using the PrintWindow API . It is a good step
for Windows XP and to write my own code.Thank you for adding this to my
knowledge but I am more interested with the defect (if any) in my
application. Is there any property of the Window's form/.Net Framework which
is giving us trouble.

There are already a no. of good programs available to capture the screen and
I have already tried 3 of them as written
earlier(Camastasia,Snagit,Irfanview) and one of my own code.All of them were
unsuccessful because of some problem with the application itself. I am very
much sure that all of the new code will only add into the unsuccessful list.

Hence please suggest the possible causes of the failure in the application
itself...

"Scott McChesney" <sc*******************@us.army.mil> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
If you have Windows XP, you can use the "PrintWindow" API. It will take a
snapshot of a window and put it into a DC.

Look in MSDN for info on the PrintWindow() API. You should be able to
replace the BitBlt() call with a PrintWindow call, and then your code should work. It would probably look something like this (UNTESTED CODE):

[System.Runtime.InteropServices.DllImportAttribute( "user32.dll")]
private static extern bool PrintWindow
(
IntPtr hWnd,
IntPtr hDC,
int nFlags
);

private void Capture_Screen(string filename)
{
Image MyImage = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(MyImage);
IntPtr dc = g.GetHdc();

PrintWindow(this.Handle,dc,0);
g.ReleaseHdc(dc);
MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);
}

If you don't have XP - well, I'm not sure what to tell you there.

HTH

- Scott

"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Hello there,

I am relatively new to the newsgroups and C#. I have never been

disappointed
with the groups and always got the prompt replies to my queries.This is

yet
another strange issue, I am facing. Please please help me to solve this as soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...

using System;
using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

using System.Reflection;

using Microsoft.Win32 ;

using System.Runtime.InteropServices;

namespace WindowsApplication1

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.Timer timer1;

private System.ComponentModel.IContainer components;

private System.Windows.Forms.Button button1;

int i;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

i=0;

//

// TODO: Add any constructor code after InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

[System.Runtime.InteropServices.DllImportAttribute( "gdi32.dll")]

private static extern bool BitBlt

(

IntPtr hdcDest, // handle to destination DC

int nXDest, // x-coord of destination upper-left corner

int nYDest, // y-coord of destination upper-left corner

int nWidth, // width of destination rectangle

int nHeight, // height of destination rectangle

IntPtr hdcSrc, // handle to source DC

int nXSrc, // x-coordinate of source upper-left corner

int nYSrc, // y-coordinate of source upper-left corner

System.Int32 dwRop // raster operation code

);

private void Capture_Screen(string filename)

{

Graphics g1 = this.CreateGraphics();

Image MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

Graphics g2 = Graphics.FromImage(MyImage);

IntPtr dc1 = g1.GetHdc();

IntPtr dc2 = g2.GetHdc();

BitBlt(dc2, 0, 0, this.ClientRectangle.Width,

this.ClientRectangle.Height, dc1, 0, 0, 13369376);

g1.ReleaseHdc(dc1);

g2.ReleaseHdc(dc2);

MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.button1 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 1000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

// button1

//

this.button1.Location = new System.Drawing.Point(80, 32);

this.button1.Name = "button1";

this.button1.TabIndex = 0;

this.button1.Text = "button1";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// Form1

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.ClientSize = new System.Drawing.Size(232, 101);

this.Controls.Add(this.button1);

this.Name = "Form1";

this.Text = "Form1";

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

this.Load += new System.EventHandler(this.Form1_Load);

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void Form1_Load(object sender, System.EventArgs e)

{

this.Hide();

}

private void Connecticon_Click(object sender, System.EventArgs e)

{
}

private void timer1_Tick(object sender, System.EventArgs e)

{
string filename;

try

{

i=i+1;

filename= "img" + i.ToString() ;
Capture_Screen(filename);

}

catch(Exception exx)

{

MessageBox.Show(exx.Message.ToString());
this.Dispose();

Application.Exit();

}

}

private void button1_Click(object sender, System.EventArgs e)

{
}

}

}
Problem Description
----------------------

These programs are taking the screenshots of the wallpaper behind the
windows application along with the mouse cursor .So it is apparent that
mouse is clicking on the particular points of screen where menus or button exist in my application but doesn't take the screen shot of form. Isn't it strange? Also these programs are taking the snapshot of other windows

based
application.

I am able to take the snapshot of my application (which is not visible to above programs) using "PrintScreen" and pasting it in the paint.Also I am able to take the snapshots of some of the forms of application (using

above
4 programs), which have a label to display the message and some background image setup at runtime.

Let me tell you that my windows application uses the skins which can be
changed dynamically using XML and there are few background images setup at runtime for the forms. I think that the problem is because of some

property
of the application or windows form.

I believe that I have described the problem well enough to understand. Now the ball is in your court. Please help me..........
Regards,

Rajat Tandon.
A DotNet Learner.


Nov 16 '05 #6
Just to add, Right now I am working on Windows 2000 Professional.

"Scott McChesney" <sc*******************@us.army.mil> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
If you have Windows XP, you can use the "PrintWindow" API. It will take a
snapshot of a window and put it into a DC.

Look in MSDN for info on the PrintWindow() API. You should be able to
replace the BitBlt() call with a PrintWindow call, and then your code should work. It would probably look something like this (UNTESTED CODE):

[System.Runtime.InteropServices.DllImportAttribute( "user32.dll")]
private static extern bool PrintWindow
(
IntPtr hWnd,
IntPtr hDC,
int nFlags
);

private void Capture_Screen(string filename)
{
Image MyImage = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(MyImage);
IntPtr dc = g.GetHdc();

PrintWindow(this.Handle,dc,0);
g.ReleaseHdc(dc);
MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);
}

If you don't have XP - well, I'm not sure what to tell you there.

HTH

- Scott

"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Hello there,

I am relatively new to the newsgroups and C#. I have never been

disappointed
with the groups and always got the prompt replies to my queries.This is

yet
another strange issue, I am facing. Please please help me to solve this as soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...

using System;
using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

using System.Reflection;

using Microsoft.Win32 ;

using System.Runtime.InteropServices;

namespace WindowsApplication1

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.Timer timer1;

private System.ComponentModel.IContainer components;

private System.Windows.Forms.Button button1;

int i;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

i=0;

//

// TODO: Add any constructor code after InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

[System.Runtime.InteropServices.DllImportAttribute( "gdi32.dll")]

private static extern bool BitBlt

(

IntPtr hdcDest, // handle to destination DC

int nXDest, // x-coord of destination upper-left corner

int nYDest, // y-coord of destination upper-left corner

int nWidth, // width of destination rectangle

int nHeight, // height of destination rectangle

IntPtr hdcSrc, // handle to source DC

int nXSrc, // x-coordinate of source upper-left corner

int nYSrc, // y-coordinate of source upper-left corner

System.Int32 dwRop // raster operation code

);

private void Capture_Screen(string filename)

{

Graphics g1 = this.CreateGraphics();

Image MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

Graphics g2 = Graphics.FromImage(MyImage);

IntPtr dc1 = g1.GetHdc();

IntPtr dc2 = g2.GetHdc();

BitBlt(dc2, 0, 0, this.ClientRectangle.Width,

this.ClientRectangle.Height, dc1, 0, 0, 13369376);

g1.ReleaseHdc(dc1);

g2.ReleaseHdc(dc2);

MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.button1 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 1000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

// button1

//

this.button1.Location = new System.Drawing.Point(80, 32);

this.button1.Name = "button1";

this.button1.TabIndex = 0;

this.button1.Text = "button1";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// Form1

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.ClientSize = new System.Drawing.Size(232, 101);

this.Controls.Add(this.button1);

this.Name = "Form1";

this.Text = "Form1";

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

this.Load += new System.EventHandler(this.Form1_Load);

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void Form1_Load(object sender, System.EventArgs e)

{

this.Hide();

}

private void Connecticon_Click(object sender, System.EventArgs e)

{
}

private void timer1_Tick(object sender, System.EventArgs e)

{
string filename;

try

{

i=i+1;

filename= "img" + i.ToString() ;
Capture_Screen(filename);

}

catch(Exception exx)

{

MessageBox.Show(exx.Message.ToString());
this.Dispose();

Application.Exit();

}

}

private void button1_Click(object sender, System.EventArgs e)

{
}

}

}
Problem Description
----------------------

These programs are taking the screenshots of the wallpaper behind the
windows application along with the mouse cursor .So it is apparent that
mouse is clicking on the particular points of screen where menus or button exist in my application but doesn't take the screen shot of form. Isn't it strange? Also these programs are taking the snapshot of other windows

based
application.

I am able to take the snapshot of my application (which is not visible to above programs) using "PrintScreen" and pasting it in the paint.Also I am able to take the snapshots of some of the forms of application (using

above
4 programs), which have a label to display the message and some background image setup at runtime.

Let me tell you that my windows application uses the skins which can be
changed dynamically using XML and there are few background images setup at runtime for the forms. I think that the problem is because of some

property
of the application or windows form.

I believe that I have described the problem well enough to understand. Now the ball is in your court. Please help me..........
Regards,

Rajat Tandon.
A DotNet Learner.


Nov 16 '05 #7
I found out the solution of the problem...

It is as simple as

this.AllowTransparency = false; in the loading of forms which are creating
the trouble.

I read somewhere that there is some known bug related to windows 2000 which
is related to the transparency of application but it is still not clear.I
would appreciate if someone could explain this in detail or direct me
towards a good tutorial

Regards,
Rajat Tandon.


"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Hello there,

I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am facing. Please please help me to solve this as
soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...

using System;
using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

using System.Reflection;

using Microsoft.Win32 ;

using System.Runtime.InteropServices;

namespace WindowsApplication1

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.Timer timer1;

private System.ComponentModel.IContainer components;

private System.Windows.Forms.Button button1;

int i;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

i=0;

//

// TODO: Add any constructor code after InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

[System.Runtime.InteropServices.DllImportAttribute( "gdi32.dll")]

private static extern bool BitBlt

(

IntPtr hdcDest, // handle to destination DC

int nXDest, // x-coord of destination upper-left corner

int nYDest, // y-coord of destination upper-left corner

int nWidth, // width of destination rectangle

int nHeight, // height of destination rectangle

IntPtr hdcSrc, // handle to source DC

int nXSrc, // x-coordinate of source upper-left corner

int nYSrc, // y-coordinate of source upper-left corner

System.Int32 dwRop // raster operation code

);

private void Capture_Screen(string filename)

{

Graphics g1 = this.CreateGraphics();

Image MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

Graphics g2 = Graphics.FromImage(MyImage);

IntPtr dc1 = g1.GetHdc();

IntPtr dc2 = g2.GetHdc();

BitBlt(dc2, 0, 0, this.ClientRectangle.Width,

this.ClientRectangle.Height, dc1, 0, 0, 13369376);

g1.ReleaseHdc(dc1);

g2.ReleaseHdc(dc2);

MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.button1 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 1000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

// button1

//

this.button1.Location = new System.Drawing.Point(80, 32);

this.button1.Name = "button1";

this.button1.TabIndex = 0;

this.button1.Text = "button1";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// Form1

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.ClientSize = new System.Drawing.Size(232, 101);

this.Controls.Add(this.button1);

this.Name = "Form1";

this.Text = "Form1";

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

this.Load += new System.EventHandler(this.Form1_Load);

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void Form1_Load(object sender, System.EventArgs e)

{

this.Hide();

}

private void Connecticon_Click(object sender, System.EventArgs e)

{
}

private void timer1_Tick(object sender, System.EventArgs e)

{
string filename;

try

{

i=i+1;

filename= "img" + i.ToString() ;
Capture_Screen(filename);

}

catch(Exception exx)

{

MessageBox.Show(exx.Message.ToString());
this.Dispose();

Application.Exit();

}

}

private void button1_Click(object sender, System.EventArgs e)

{
}

}

}
Problem Description
----------------------

These programs are taking the screenshots of the wallpaper behind the
windows application along with the mouse cursor .So it is apparent that
mouse is clicking on the particular points of screen where menus or button
exist in my application but doesn't take the screen shot of form. Isn't it
strange? Also these programs are taking the snapshot of other windows based application.

I am able to take the snapshot of my application (which is not visible to
above programs) using "PrintScreen" and pasting it in the paint.Also I am
able to take the snapshots of some of the forms of application (using above 4 programs), which have a label to display the message and some background
image setup at runtime.

Let me tell you that my windows application uses the skins which can be
changed dynamically using XML and there are few background images setup at
runtime for the forms. I think that the problem is because of some property of the application or windows form.

I believe that I have described the problem well enough to understand. Now
the ball is in your court. Please help me..........
Regards,

Rajat Tandon.
A DotNet Learner.

Nov 16 '05 #8
Well, I can't comment on why the commercial programs wouldn't work. As for
the code you have, I don't see anything wrong with it on the surface, in the
sense that it should run. I don't know of anything in the .NET framework
that would keep this from running, but I'm not a GDI+ expert. In truth, you
probably would get a better response if you posted this to the
"microsoft.public.dotnet.framework.drawing" newsgroup, since this is right
up their alley.

That said, there is a "quirk" to the code here: you will only be capturing
the client area of the form. Traditional screen-capture programs copy the
entire form. If you want to capture the entire form, you'll probably have
to use the desktop as your source DC, and your source rectangle would be the
screen position & size of the entire form.

You also don't need the "MyImage = new
Bitmap(this.ClientRectangle.Width,this.ClientRecta ngle.Height, g1);" line -
you create and initialize your MyImage variable all in one line, so this
line does the same thing as the one before it. But that shouldn't hurt
anything.

I don't know what you're seeing, or what you're getting in your JPG file, so
I don't know exactly what your problem is. As I said, I see nothing in the
code that shouldn't work. If you can provide some more detail as to what
you're experiencing, we may be able to help some more.

Beyond this, and posting to the other NG I mentioned, I would check out Bob
Powell's GDI+ site - he's about the smartest guy I've seen in the NG's when
it comes to this stuff. A quick check of his site reveals a page that looks
like it will solve your problem:

http://www.bobpowell.net/capture.htm

Between that and my suggestion about using the screen as your source, you
should be able to get there with some small modifications to this code.

HTH

- Scott

"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:O6**************@TK2MSFTNGP09.phx.gbl...
Scott, As you suggested about using the PrintWindow API . It is a good
step
for Windows XP and to write my own code.Thank you for adding this to my
knowledge but I am more interested with the defect (if any) in my
application. Is there any property of the Window's form/.Net Framework
which
is giving us trouble.

There are already a no. of good programs available to capture the screen
and
I have already tried 3 of them as written
earlier(Camastasia,Snagit,Irfanview) and one of my own code.All of them
were
unsuccessful because of some problem with the application itself. I am
very
much sure that all of the new code will only add into the unsuccessful
list.

Hence please suggest the possible causes of the failure in the application
itself...

"Scott McChesney" <sc*******************@us.army.mil> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
If you have Windows XP, you can use the "PrintWindow" API. It will take
a
snapshot of a window and put it into a DC.

Look in MSDN for info on the PrintWindow() API. You should be able to
replace the BitBlt() call with a PrintWindow call, and then your code

should
work. It would probably look something like this (UNTESTED CODE):

[System.Runtime.InteropServices.DllImportAttribute( "user32.dll")]
private static extern bool PrintWindow
(
IntPtr hWnd,
IntPtr hDC,
int nFlags
);

private void Capture_Screen(string filename)
{
Image MyImage = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(MyImage);
IntPtr dc = g.GetHdc();

PrintWindow(this.Handle,dc,0);
g.ReleaseHdc(dc);
MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);
}

If you don't have XP - well, I'm not sure what to tell you there.

HTH

- Scott

"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
> Hello there,
>
> I am relatively new to the newsgroups and C#. I have never been

disappointed
> with the groups and always got the prompt replies to my queries.This is

yet
> another strange issue, I am facing. Please please help me to solve this as > soon as possible.
>
> So here we go ...
>
> I am not able to take the screen shot of the windows form based "Smart
> Client" application at run time.This is urgently required for making
> the
> presentation .
>
> Till now I have tried 4 methods...
> --------------------------------
> 1) Using IrfanView software
> 2) Using Snag-it
> 3) Using Camtasia_Capture&menumaker
> 4) Using the program which is given below...
>
> using System;
> using System.Drawing;
>
> using System.Collections;
>
> using System.ComponentModel;
>
> using System.Windows.Forms;
>
> using System.Data;
>
> using System.Reflection;
>
> using Microsoft.Win32 ;
>
> using System.Runtime.InteropServices;
>
> namespace WindowsApplication1
>
> {
>
> /// <summary>
>
> /// Summary description for Form1.
>
> /// </summary>
>
> public class Form1 : System.Windows.Forms.Form
>
> {
>
> private System.Windows.Forms.Timer timer1;
>
> private System.ComponentModel.IContainer components;
>
> private System.Windows.Forms.Button button1;
>
>
>
> int i;
>
>
>
> public Form1()
>
> {
>
> //
>
> // Required for Windows Form Designer support
>
> //
>
> InitializeComponent();
>
> i=0;
>
> //
>
> // TODO: Add any constructor code after InitializeComponent call
>
> //
>
> }
>
> /// <summary>
>
> /// Clean up any resources being used.
>
> /// </summary>
>
> protected override void Dispose( bool disposing )
>
> {
>
> if( disposing )
>
> {
>
> if (components != null)
>
> {
>
> components.Dispose();
>
> }
>
> }
>
> base.Dispose( disposing );
>
> }
>
>
>
> [System.Runtime.InteropServices.DllImportAttribute( "gdi32.dll")]
>
> private static extern bool BitBlt
>
> (
>
> IntPtr hdcDest, // handle to destination DC
>
> int nXDest, // x-coord of destination upper-left corner
>
> int nYDest, // y-coord of destination upper-left corner
>
> int nWidth, // width of destination rectangle
>
> int nHeight, // height of destination rectangle
>
> IntPtr hdcSrc, // handle to source DC
>
> int nXSrc, // x-coordinate of source upper-left corner
>
> int nYSrc, // y-coordinate of source upper-left corner
>
> System.Int32 dwRop // raster operation code
>
> );
>
> private void Capture_Screen(string filename)
>
> {
>
> Graphics g1 = this.CreateGraphics();
>
> Image MyImage = new Bitmap(this.ClientRectangle.Width,
>
> this.ClientRectangle.Height, g1);
>
> MyImage = new Bitmap(this.ClientRectangle.Width,
>
> this.ClientRectangle.Height, g1);
>
> Graphics g2 = Graphics.FromImage(MyImage);
>
> IntPtr dc1 = g1.GetHdc();
>
> IntPtr dc2 = g2.GetHdc();
>
> BitBlt(dc2, 0, 0, this.ClientRectangle.Width,
>
> this.ClientRectangle.Height, dc1, 0, 0, 13369376);
>
> g1.ReleaseHdc(dc1);
>
> g2.ReleaseHdc(dc2);
>
> MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
> ,System.Drawing.Imaging.ImageFormat.Jpeg);
>
> }
>
>
>
> #region Windows Form Designer generated code
>
> /// <summary>
>
> /// Required method for Designer support - do not modify
>
> /// the contents of this method with the code editor.
>
> /// </summary>
>
> private void InitializeComponent()
>
> {
>
> this.components = new System.ComponentModel.Container();
>
> this.timer1 = new System.Windows.Forms.Timer(this.components);
>
> this.button1 = new System.Windows.Forms.Button();
>
> this.SuspendLayout();
>
> //
>
> // timer1
>
> //
>
> this.timer1.Enabled = true;
>
> this.timer1.Interval = 1000;
>
> this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
>
> //
>
> // button1
>
> //
>
> this.button1.Location = new System.Drawing.Point(80, 32);
>
> this.button1.Name = "button1";
>
> this.button1.TabIndex = 0;
>
> this.button1.Text = "button1";
>
> this.button1.Click += new System.EventHandler(this.button1_Click);
>
> //
>
> // Form1
>
> //
>
> this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
>
> this.ClientSize = new System.Drawing.Size(232, 101);
>
> this.Controls.Add(this.button1);
>
> this.Name = "Form1";
>
> this.Text = "Form1";
>
> this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
>
> this.Load += new System.EventHandler(this.Form1_Load);
>
> this.ResumeLayout(false);
>
> }
>
> #endregion
>
> /// <summary>
>
> /// The main entry point for the application.
>
> /// </summary>
>
> [STAThread]
>
> static void Main()
>
> {
>
> Application.Run(new Form1());
>
> }
>
> private void Form1_Load(object sender, System.EventArgs e)
>
> {
>
> this.Hide();
>
> }
>
> private void Connecticon_Click(object sender, System.EventArgs e)
>
> {
>
>
> }
>
>
>
> private void timer1_Tick(object sender, System.EventArgs e)
>
> {
>
>
> string filename;
>
> try
>
> {
>
> i=i+1;
>
> filename= "img" + i.ToString() ;
>
>
> Capture_Screen(filename);
>
> }
>
> catch(Exception exx)
>
> {
>
> MessageBox.Show(exx.Message.ToString());
>
>
> this.Dispose();
>
> Application.Exit();
>
> }
>
>
>
> }
>
> private void button1_Click(object sender, System.EventArgs e)
>
> {
>
>
> }
>
> }
>
> }
>
>
> Problem Description
> ----------------------
>
> These programs are taking the screenshots of the wallpaper behind the
> windows application along with the mouse cursor .So it is apparent that
> mouse is clicking on the particular points of screen where menus or button > exist in my application but doesn't take the screen shot of form. Isn't it > strange? Also these programs are taking the snapshot of other windows

based
> application.
>
> I am able to take the snapshot of my application (which is not visible to > above programs) using "PrintScreen" and pasting it in the paint.Also I am > able to take the snapshots of some of the forms of application (using

above
> 4 programs), which have a label to display the message and some background > image setup at runtime.
>
> Let me tell you that my windows application uses the skins which can be
> changed dynamically using XML and there are few background images setup at > runtime for the forms. I think that the problem is because of some

property
> of the application or windows form.
>
> I believe that I have described the problem well enough to understand. Now > the ball is in your court. Please help me..........
>
>
> Regards,
>
> Rajat Tandon.
> A DotNet Learner.
>
>



Nov 16 '05 #9
As far as I have tried, the BitBlt method of grabbing doesn't capture
Layered windows (windows that have WS_EX_LAYERED flag set, .NET sets this
when color keying or semi-transparency is activated).

What's wrong about the PrtSc method, anyway? It seems to work all right...

HTH,
Stefan

"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Hello there,

I am relatively new to the newsgroups and C#. I have never been
disappointed
with the groups and always got the prompt replies to my queries.This is
yet
another strange issue, I am facing. Please please help me to solve this as
soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...

using System;
using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

using System.Reflection;

using Microsoft.Win32 ;

using System.Runtime.InteropServices;

namespace WindowsApplication1

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.Timer timer1;

private System.ComponentModel.IContainer components;

private System.Windows.Forms.Button button1;

int i;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

i=0;

//

// TODO: Add any constructor code after InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

[System.Runtime.InteropServices.DllImportAttribute( "gdi32.dll")]

private static extern bool BitBlt

(

IntPtr hdcDest, // handle to destination DC

int nXDest, // x-coord of destination upper-left corner

int nYDest, // y-coord of destination upper-left corner

int nWidth, // width of destination rectangle

int nHeight, // height of destination rectangle

IntPtr hdcSrc, // handle to source DC

int nXSrc, // x-coordinate of source upper-left corner

int nYSrc, // y-coordinate of source upper-left corner

System.Int32 dwRop // raster operation code

);

private void Capture_Screen(string filename)

{

Graphics g1 = this.CreateGraphics();

Image MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

Graphics g2 = Graphics.FromImage(MyImage);

IntPtr dc1 = g1.GetHdc();

IntPtr dc2 = g2.GetHdc();

BitBlt(dc2, 0, 0, this.ClientRectangle.Width,

this.ClientRectangle.Height, dc1, 0, 0, 13369376);

g1.ReleaseHdc(dc1);

g2.ReleaseHdc(dc2);

MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.button1 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 1000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

// button1

//

this.button1.Location = new System.Drawing.Point(80, 32);

this.button1.Name = "button1";

this.button1.TabIndex = 0;

this.button1.Text = "button1";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// Form1

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.ClientSize = new System.Drawing.Size(232, 101);

this.Controls.Add(this.button1);

this.Name = "Form1";

this.Text = "Form1";

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

this.Load += new System.EventHandler(this.Form1_Load);

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void Form1_Load(object sender, System.EventArgs e)

{

this.Hide();

}

private void Connecticon_Click(object sender, System.EventArgs e)

{
}

private void timer1_Tick(object sender, System.EventArgs e)

{
string filename;

try

{

i=i+1;

filename= "img" + i.ToString() ;
Capture_Screen(filename);

}

catch(Exception exx)

{

MessageBox.Show(exx.Message.ToString());
this.Dispose();

Application.Exit();

}

}

private void button1_Click(object sender, System.EventArgs e)

{
}

}

}
Problem Description
----------------------

These programs are taking the screenshots of the wallpaper behind the
windows application along with the mouse cursor .So it is apparent that
mouse is clicking on the particular points of screen where menus or button
exist in my application but doesn't take the screen shot of form. Isn't it
strange? Also these programs are taking the snapshot of other windows
based
application.

I am able to take the snapshot of my application (which is not visible to
above programs) using "PrintScreen" and pasting it in the paint.Also I am
able to take the snapshots of some of the forms of application (using
above
4 programs), which have a label to display the message and some background
image setup at runtime.

Let me tell you that my windows application uses the skins which can be
changed dynamically using XML and there are few background images setup at
runtime for the forms. I think that the problem is because of some
property
of the application or windows form.

I believe that I have described the problem well enough to understand. Now
the ball is in your court. Please help me..........
Regards,

Rajat Tandon.
A DotNet Learner.

Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: dave | last post by:
I want to include numerous screen prints about printing, date time settings, regional settings in the help files I will distribute with my application. Must I obtain written permission from...
0
by: topbooks | last post by:
I need find of which software is the best one you ever used that can capture screen shots and then let you add some comments, then combine them into a demo. The demo can be a set of web pages or...
5
by: Analysis&Solutions | last post by:
Hey Folks: I'm probably dreaming here, but perhaps there's a way... I just gave a presentation. It's in XHTML and uses CSS for making things look nice. Right now there's a small navigation...
24
by: Charles Crume | last post by:
Hello; My "index.htm" page has 3 frames (content, navigation bar, and logo). I set the "SRC" of the "logo" frame to a blank gif image and then want to change it's contents after the other two...
0
by: Sinan Nalkaya | last post by:
hi i have some python practice and want to develop tiny prgramme that takes screen shots from command line, im using gnome now but my programme should support the others especially pure X - window....
5
by: Stan Shankman | last post by:
C# -- Visual Studio.Net – Windows Application Greetings all, How do I copy a Form’s image to a bitmap? – And do so before it gets to the screen. I haven’t been able to find anyone that knows...
1
by: Daren Hawes | last post by:
Hi, I need some code that will create web site screen shots on the fly like this URL. http://search.ninemsn.com.au/previewx.aspx?q=www&FORM=CBPW&first=1&noredir=1 Any ideas where to start? ...
1
by: yatin | last post by:
i urgently want to know how can i take a screen shots of the video in the php, plz give me a suitable example or link. i am using a flb player on this i have to show the screen shots of videos.
4
mfshake
by: mfshake | last post by:
i need help on trying to print screen shots and put them on powerpoint with a timer. I tried to used the robot package and i couldn't get it to work. Can someone help me get started on this program....
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.