Windows API for screenshot 
Author Message
 Windows API for screenshot

Hi

I need to shot the screen using windows API function (not pressing PrtScn
button or sending PrtScn key code).
Does anyone know which function to call to do this ???

Thanks

__________________
Micha Mazur



Mon, 12 Dec 2005 14:06:01 GMT  
 Windows API for screenshot
If you have CapeSoft Draw, you can simply call GrabScreen(), alternatively
it is very easy to create a screen device context and call GetPixel() to get
a block of pixels.

You can get a device context for the screen or a particular window quite
easily, for instance:

myDC        ulong
hWnd        ulong
pCol        ulong

    hWnd = thisWindow{PROP:ClientHandle}
    myDC = GetDC(hWnd)
    pcol = getPixel(myDC, x, y)            ! color of the pixel at (x,y)

! Or for the entire screen:

displayHandle        cstring(8)
hdcScreen           ulong

    displayHandle = 'DISPLAY'
    hdcScreen       = CreateDC(displayHandle, 0, 0, 0)
    pcol = getPixel(hdcScreen, x, y)

! call DeleteDC when you are finished with it

Some useful prototypes would be:

     DeleteDC(ulong HDC), byte, Pascal, raw, name('DeleteDC')
     GetDCEx(ulong hWnd, ulong hrgnClip, ulong flags), ulong, pascal, raw,
name('GetDCEx')
     GetDC(ulong hWnd), ulong, pascal, raw, name('GetDC')
     CreateCompatibleDC(ulong hdc), ulong, pascal, raw,
name('CreateCompatibleDC')
     CreateDC(*cstring lpszDriver, ulong lpszDevice, ulong lpszOutput, ulong
lpInitData), ulong, pascal, raw, name('CreateDCA')
     GetPixel( ulong hdc, long XPos, long nYPos), long, pascal, raw,
name('GetPixel')

Regards,

Sean Cameron
CapeSoft
www.capesoft.com


Quote:
> Hi

> I need to shot the screen using windows API function (not pressing PrtScn
> button or sending PrtScn key code).
> Does anyone know which function to call to do this ???

> Thanks

> __________________
> Micha Mazur



Mon, 12 Dec 2005 15:06:19 GMT  
 Windows API for screenshot
Greeate Sean!  Thanx for this information.

--
Ole-Morten Heien
HD Software
www.hdsoftware.no

ICQ: 72785878


Quote:
> If you have CapeSoft Draw, you can simply call GrabScreen(), alternatively
> it is very easy to create a screen device context and call GetPixel() to
get
> a block of pixels.

> You can get a device context for the screen or a particular window quite
> easily, for instance:

> myDC        ulong
> hWnd        ulong
> pCol        ulong

>     hWnd = thisWindow{PROP:ClientHandle}
>     myDC = GetDC(hWnd)
>     pcol = getPixel(myDC, x, y)            ! color of the pixel at (x,y)

> ! Or for the entire screen:

> displayHandle        cstring(8)
> hdcScreen           ulong

>     displayHandle = 'DISPLAY'
>     hdcScreen       = CreateDC(displayHandle, 0, 0, 0)
>     pcol = getPixel(hdcScreen, x, y)

> ! call DeleteDC when you are finished with it

> Some useful prototypes would be:

>      DeleteDC(ulong HDC), byte, pascal, raw, name('DeleteDC')
>      GetDCEx(ulong hWnd, ulong hrgnClip, ulong flags), ulong, pascal, raw,
> name('GetDCEx')
>      GetDC(ulong hWnd), ulong, pascal, raw, name('GetDC')
>      CreateCompatibleDC(ulong hdc), ulong, pascal, raw,
> name('CreateCompatibleDC')
>      CreateDC(*cstring lpszDriver, ulong lpszDevice, ulong lpszOutput,
ulong
> lpInitData), ulong, pascal, raw, name('CreateDCA')
>      GetPixel( ulong hdc, long XPos, long nYPos), long, pascal, raw,
> name('GetPixel')

> Regards,

> Sean Cameron
> CapeSoft
> www.capesoft.com



> > Hi

> > I need to shot the screen using windows API function (not pressing
PrtScn
> > button or sending PrtScn key code).
> > Does anyone know which function to call to do this ???

> > Thanks

> > __________________
> > Micha Mazur



Mon, 12 Dec 2005 17:00:31 GMT  
 Windows API for screenshot
major,
you might be interested in screen capture tools from keystone.
www.keystonecr.com/cw_sctools2.htm
regards
randy


Quote:
> Hi

> I need to shot the screen using windows API function (not pressing PrtScn
> button or sending PrtScn key code).
> Does anyone know which function to call to do this ???

> Thanks

> __________________
> Micha Mazur



Mon, 12 Dec 2005 22:10:14 GMT  
 Windows API for screenshot
Thanks for your answers.

I will take a look at it tonight.

Regards

 __________________
 Micha Mazur



Mon, 12 Dec 2005 23:57:57 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Calling Windows API functions involving windows?

2. some clear examples for FFI call to a Windows api function in Franz Allegro for Windows

3. GraphicsCcontext and bounds - screenshot.gif (0/1)

4. Silly Screenshot Capture Question

5. How to take a screenshot from REALbasic?

6. LogFlash & IMPEX - new screenshot pages

7. get an IE 5 screenshot

8. high-resolution RDE screenshot needed

9. fyi: screenshot of jEdit used to code Ada

10. Screenshot again

11. Screenshot in Tkinter

12. Coolest Tk Screenshot Contest: Win ActiveTcl Pro Studio!

 

 
Powered by phpBB® Forum Software