--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/f0617a6a-c46e-4ed2-9dc0-1d1e41210957n%40googlegroups.com.
Hi Giovanni,on Windows (from XP) I'm using Gadwin PrintScreen; there are free and pro (to pay) versions from here GadwinPrintscreen
Ok.
DO_SnapShot()
p.s. you can also call DO_SnapShot() direct from your Code
HMG_CallDLL("User32.DLL", DLL_OSAPI, "RegisterHotKey", Form_1.HANDLE, 1, 0, VK_SNAPSHOT)
CREATE EVENT PROCNAME PrtScr_Detect() HWND Form_1.HANDLE STOREINDEX nIndex
EventProcessAllHookMessage( nIndex, .T. )
FUNCTION PrtScr_Detect()
LOCAL nHWnd := EventHWND()
LOCAL nMsg := EventMSG()
LOCAL nWParam := EventWPARAM()
LOCAL nLParam := EventLPARAM()
DO CASE
CASE nMsg == WM_HOTKEY
DO_SnapShot()
ENDCASE
RETURN NILPROCEDURE DO_SnapShot()
LOCAL Width := BT_DesktopWidth()
LOCAL Height := BT_DesktopHeight()
LOCAL Row := 0
LOCAL Col := 0
LOCAL nTypePicture := BT_FILEFORMAT_JPG
LOCAL cUser := GETENV( "USERPROFILE" )
LOCAL hBitmap
LOCAL cFileName
// %USERPROFILE%\Pictures\Screenshots
cFileName := cUser + "\Pictures\Err" + DTOS( DATE() ) + STRZERO( SECONDS(), 5 ) + ".JPG"
hBitmap := BT_BitmapCaptureDesktop( Row, Col, Width, Height )
// BT_BitmapCaptureWindow (Win, Row, Col, Width, Height)
// BT_BitmapCaptureClientArea (Win, Row, Col, Width, Height)
BT_BitmapSaveFile( hBitmap, cFileName, nTypePicture )
// here you can send email with Attachment
// don'nt forget to put Bitmap to Clipboard
BT_BitmapClipboardPut( Form_1.HANDLE, hBitmap )
FERASE( cFileName )
RETURN--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/f0617a6a-c46e-4ed2-9dc0-1d1e41210957n%40googlegroups.com.
Hi Giovanni, below my function derived by some contributions found on the web.
The major limitation is that the output file is a bitmap, thus I
introduced a parameter to limit the size of the saved file.
I'm calling it using:
The major limitation is that the output file is a bitmap, thus I introduced a parameter to limit the size of the saved file.
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/244ff7aa-2c87-4c01-9ff0-5d0b022d0e35o%40googlegroups.com.
Hi Pete,
thanks a lot for your suggestion.
I don't like so much to have DLLs in my app folder, thus until now I avoided FreeImage, but today I tried to apply the code you shown.
Unluckily something gone wrong because the jpg file isn't created at all (0 bytes long) and the png (42KB long) file is unreadable.
On Thursday, 10 September 2020 19:21:06 UTC+3, Maurizio la Cecilia wrote:Hi Pete,
thanks a lot for your suggestion.
I don't like so much to have DLLs in my app folder, thus until now I avoided FreeImage, but today I tried to apply the code you shown.
Unluckily something gone wrong because the jpg file isn't created at all (0 bytes long) and the png (42KB long) file is unreadable.
I must admit that I had not tested my suggestion and sadly I faced similar 'problem' today morning
when tried to combine your function with `hbfimage`. Mine failure though was worst, since I repeatedly
the sample I mad,e crashed with `Unrecoverable error 6005` , `ACCESS_VIOLATION` and such wonderful things
However, a plain hbfimage test code is working fine, doing flawlessly the 'conversion' from one format (bmp)
to another (jpg, png, etc) and vice-versa. I have no clue of what the root of problem might be.
Only a vague guess that the `bmp` produced by hbs_ScreenShot() might "have" something not compatible
to freeimage.
To be sure about hbs_ScreenShot() compatibility I did a simple test:
fi_Save( FIF_BMP, fi_Load( FIF_BMP, "hbs_ScreenShot.bmp", BMP_DEFAULT ), "freeimage.bmp", BMP_DEFAULT )
The produced freeimage.bmp is correctly open by graphical apps and is absolutely identical to the bmp file produced by the hbs_ScreenShot() function.
Maybe the conversion functions have some restriction (size?) on source image.
Best regards.
--
Maurizio
PS. I have the same view for the DLLs, particularly due to the fact that the absence of a dll
may lead the application to become unusable. I prefer the self-completeness and independence
from external modules. On the other hand, this "independence" has a price, which at times
can be undesirably high, which makes some DLLs 'best value for money' ;-)
regards,
Pete
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/0bb7198b-65bb-4b61-8af3-49f89da9063co%40googlegroups.com.
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/0bb7198b-65bb-4b61-8af3-49f89da9063co%40googlegroups.com.
Hi Pete,
I just returned on your suggestion and I found the solution was very simple.
My hbs_ScreenShot() doesn't render the bitmap in 8 or 24 bits depth, the needed depths by FreeImage conversion functions.Thus it's just enough to convert the bitmap before to save:
hbs_ScreenShot( Hb_GtInfo( HB_GTI_WINHANDLE ), cFileName + ".bmp" )fi_Save( FIF_PNG , fi_ConvertTo24Bits( fi_Load( FIF_BMP, cFileName + ".bmp", BMP_DEFAULT ) ), cFileName + ".png", PNG_DEFAULT ) // png format
The PNG format is the best for saving the screenshot (no artefacts and lesser size than JPG).
I hope this is useful for you.
hBitmap := BT_BitmapCaptureDesktop( Row, Col, Width, Height )
BT_BitmapSaveFile( hBitmap, cFileName, nTypePicture ) BT_BitmapCaptureWindow (Win, Row, Col, Width, Height)
BT_BitmapCaptureClientArea (Win, Row, Col, Width, Height)--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/75a8b6f7-3c60-4cc8-a0fa-ff83be2c9138o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/64c59182-a3f2-4436-8d0d-1dc07dc5eda4n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/b7d387eb-5dcd-4967-8b53-f8d5001f6fa5n%40googlegroups.com.