Link to home
Start Free TrialLog in
Avatar of Form_Glow
Form_Glow

asked on

Screenshot--No taskbar

Hello all,

I need to get a screenshot of the desktop...without the taskbar...
Thanks
Avatar of andysalih
andysalih

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
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
Avatar of Form_Glow

ASKER

The planet code....won't even load...I don't have time to mess with it.
are you after a vb code to do it then ??

cheers

andy


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
The planet code....won't even load...I don't have time to mess with it.
no taskbar...is the question. I have screen capture code.
okey i can give you some code to hide the task bar which you will need to add to your code will that do??
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
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
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.
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
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

ASKER CERTIFIED SOLUTION
Avatar of sharmon
sharmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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&)


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