.net - Take a screenshot with program minimized -



.net - Take a screenshot with program minimized -

i wrote code programme making take screenshot when programme minimized. thing wrong code , not sure is. whenever take screenshot programme taking image application , not minimized.

so need minimize application take screenshot , reopen programme after taken screenshot.

sorry noob question brand new vb , been coding in less day.

dim screenimage new bitmap(my.computer.screen.bounds.width, my.computer.screen.bounds.height) dim g system.drawing.graphics = system.drawing.graphics.fromimage(screenimage) g.copyfromscreen(new point(0, 0), new point(0, 0), new size(my.computer.screen.bounds.width, my.computer.screen.bounds.height)) me.hide() screenimage.save("c:\screenimage.jpg", system.drawing.imaging.imageformat.jpeg) dim tspan timespan = timespan.fromseconds(system.datetime.now.second) dim tspan2 timespan = timespan.fromseconds(system.datetime.now.second) while math.abs(tspan.subtract(tspan2).seconds) < 2 tspan2 = timespan.fromseconds(system.datetime.now.second) loop me.show()

any help great.

you calling hide after you've taken screenshot :)

try this:

class="lang-vb prettyprint-override">dim screenimage new bitmap(my.computer.screen.bounds.width, my.computer.screen.bounds.height) dim g system.drawing.graphics = system.drawing.graphics.fromimage(screenimage) me.hide() me.application.doevents() ' <-- might not necessary; seek without first. g.copyfromscreen(new point(0, 0), new point(0, 0), new size(my.computer.screen.bounds.width, my.computer.screen.bounds.height)) screenimage.save("c:\screenimage.jpg", system.drawing.imaging.imageformat.jpeg) dim tspan timespan = timespan.fromseconds(system.datetime.now.second) dim tspan2 timespan = timespan.fromseconds(system.datetime.now.second) while math.abs(tspan.subtract(tspan2).seconds) < 2 tspan2 = timespan.fromseconds(system.datetime.now.second) loop me.show()

.net vb.net

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -