Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5291
  • Last Modified:

Screenshot--No taskbar

Hello all,

I need to get a screenshot of the desktop...without the taskbar...
Thanks
0
Form_Glow
Asked:
Form_Glow
  • 9
  • 5
  • 2
1 Solution
 
andysalihCommented:
ill tell you the way how to without vb code,

i asume thats what you want

click on START

SETTINGS

TASKBAR

tick AUTOHIDE.

then go to your desk top and press


press PRINT SCREEN BUTTON (PRTSCN)

THEN CLICK ON START

RUN

TYPE write in the open dialog box

then into EDIT & PASTE

presto

you have a copy of your desk top
0
 
andysalihCommented:
ps if you want a piece of code then download the following,

A Nice Looking Screen Capturing Tool. Use this camera take pictures of your desktop screen. You can take screenshots for your works using this


http://www.planetsourcecode.com/xq/ASP/txtCodeId.25287/lngWId.1/qx/vb/scripts/ShowCode.htm

cheers
Andy
0
 
Form_GlowAuthor Commented:
The planet code....won't even load...I don't have time to mess with it.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
andysalihCommented:
are you after a vb code to do it then ??

cheers

andy
0
 
andysalihCommented:


Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long


Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)


Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
    (LpVersionInformation As OSVERSIONINFO) As Long
    Public Const VK_MENU = &H12
    Public Const KEYEVENTF_KEYUP = &H2


Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128 ' Maintenance string for PSS usage
    End Type
         
         
'**************************************
' Name: GetWindowSnapShot
' Description:This allows a VB program t
'     o capture either the screen or the progr
'     am window.
It has been tested under Win95 and NT4.0. It derives from a routine by Dan Appleman (VisualBasic 5.0 Programmer's Guide to the WIN32 API.



Private Sub Command1_Click()
    GetWindowSnapShot 0, Image1
End Sub


Private Sub Command2_Click()
    GetWindowSnapShot 1, Image1
End Sub






'Insert this in a module:


Public Sub GetWindowSnapShot(Mode As Long, ThisImage As Image)
   
    ' mode = 0 -> Screen snapshot
    ' mode = 1 -> Window snapshot
   
    Dim altscan%, NT As Boolean, nmode As Long
   
    NT = IsNT


    If Not NT Then
        If Mode = 0& Then Mode = 1& Else Mode = 0&
    End If
   


    If NT And Mode = 0 Then
        keybd_event vbKeySnapshot, 0&, 0&, 0&
    Else
        altscan = MapVirtualKey(VK_MENU, 0)
        keybd_event VK_MENU, altscan, 0, 0


        DoEvents
            keybd_event vbKeySnapshot, Mode, 0&, 0&
        End If


        DoEvents
            ThisImage = Clipboard.GetData(vbCFBitmap)
            keybd_event VK_MENU, altscan, KEYEVENTF_KEYUP, 0
        End Sub


Public Function IsNT() As Boolean
    Dim verinfo As OSVERSIONINFO
    verinfo.dwOSVersionInfoSize = Len(verinfo)
    If (GetVersionEx(verinfo)) = 0 Then Exit Function
    If verinfo.dwPlatformId = 2 Then IsNT = True
End Function


hope this helps. it will not hide the taskbar though, but it will snap shot the desktop.

cheers
Andy
0
 
Form_GlowAuthor Commented:
The planet code....won't even load...I don't have time to mess with it.
0
 
Form_GlowAuthor Commented:
no taskbar...is the question. I have screen capture code.
0
 
andysalihCommented:
okey i can give you some code to hide the task bar which you will need to add to your code will that do??
0
 
andysalihCommented:
if you have code to snap shot the desktop before it does that then insert this code


Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal
lpWindowName As String) As Long


Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal
hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long


that will then hide the taskbar before you take the snap

thats the only way your gonna do it

cheers
Andy
0
 
andysalihCommented:
add this to the end
Sub Show_TaskBar()
   ShowWindow FindWindow("Shell_TrayWnd", vbNullString), 5
End Sub


sorry forgot to copy it from my code

cheers
Andy
0
 
Form_GlowAuthor Commented:
Sorry...I can't hide the taskbar. I just need to get the RECT of the taskbar...and not include that portion in the screenshot.
0
 
andysalihCommented:
FORGET ALL THE ABOVE CODE

sorry its late

do this

insert this into your code before it takes a shot of the desktop

Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub form_load()
ShowWindow FindWindow("Shell_TrayWnd", vbNullString), 0
End Sub


cheers
Andy
0
 
andysalihCommented:
i cant do it for you then , the code ive given which is :-

Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Private Sub form_load()
ShowWindow FindWindow("Shell_TrayWnd", vbNullString), 0
End Sub

that will hide the task bar, but i don't know how to get the task bar and not show it in your snap, i dont think you can, without hiding it first.

why not make it hide, then snap, then show task bar. back to normal state.

good luck with your project sorry i couldnt help

andy

0
 
sharmonCommented:
Here is an example of an idea I had while reading your question.  Give it a try, it seems to be what you are asking for as long as I am reading it correctly.  If you have any questions, please let me know.

Option Explicit

'Constants
Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source

'Types
Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

'Windows API declarations
Private Declare Function BitBlt Lib "gdi32" _
    (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, _
    ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
    ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function FindWindowEx Lib "user32" _
    Alias "FindWindowExA" (ByVal hWnd1 As Long, _
    ByVal hWnd2 As Long, ByVal lpsz1 As String, _
    ByVal lpsz2 As String) As Long

Private Declare Function GetDesktopWindow Lib "user32" () As Long

Private Declare Function GetWindowDC Lib "user32" _
    (ByVal hwnd As Long) As Long

Private Declare Function GetWindowRect Lib "user32" _
    (ByVal hwnd As Long, lpRect As RECT) As Long
   
   
Private Sub Form_Load()
    'Setup form and picture
    'Make sure you added one picture box to the form
    'named Picture1
    Me.ScaleMode = vbPixels
    Picture1.AutoRedraw = True
    Picture1.ScaleMode = vbPixels
   
    Dim lngSysListView As Long
    Dim lngRet As Long
    Dim lngDesktop As Long
    Dim lngDesktopDC As Long
    Dim rc As RECT
   
    'Find the system listview window it will give us a rectangle
    'that is equal to the desktop's position without the taskbar
    lngRet = FindWindow("Progman", "Program Manager")
    lngRet = FindWindowEx(lngRet, 0&, "SHELLDLL_DefView", "")
    lngSysListView = FindWindowEx(lngRet, 0&, "SysListView32", "")
   
    'Get the rectangle of the system listview
    lngRet = GetWindowRect(lngSysListView, rc)
   
    'Get our desktop hdc so we can bitblt the screen to the
    'picture box
    lngDesktop = GetDesktopWindow()
    lngDesktopDC = GetWindowDC(lngDesktop)
       
    'Resize our picture box to fit the rectangle
    Picture1.Height = rc.Bottom - rc.Top
    Picture1.Width = rc.Right - rc.Left
       
    'Copy the image to our picture box...
    BitBlt Picture1.hDC, 0, 0, rc.Right - rc.Left, rc.Bottom - rc.Top, _
        lngDesktopDC, rc.Left, rc.Top, SRCCOPY
   
    'Save the picture out to a file for testing...whatever.
    SavePicture Picture1.Image, "c:\temp.bmp"
End Sub
0
 
Form_GlowAuthor Commented:
Works great...(might chop a pixel or two)

I figured another way...

Dim rc As RECT
Just get the available desktop real estate:
Call SystemParametersInfo(SPI_GETWORKAREA, 0&, rc, 0&)


0
 
sharmonCommented:
Yeah, I thought about that just a few minutes after I posted:)  I was going to update it for that, but you beat me to it.  What I gave you was the first thing that popped in my head, but I am glad it helped you take care of the problem.  Take care...

Shannon
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now