DropIt
Re: DropIt
I made a new test version with some error messages (let me know if you see something or not before the crash, thanks!):
http://www.lupopensuite.com/files/dropi ... table5.zip
The new system to store settings allowed to extent some features. You can find old versions here:
http://sourceforge.net/projects/dropit/files/DropIt/
http://www.lupopensuite.com/files/dropi ... table5.zip
The new system to store settings allowed to extent some features. You can find old versions here:
http://sourceforge.net/projects/dropit/files/DropIt/
Re: DropIt
It doesn't give me any messages before crashing.Lupo73 wrote: I made a new test version with some error messages (let me know if you see something or not before the crash, thanks!):
http://www.lupopensuite.com/files/dropi ... table5.zip
My YouTube channel | Release date of my 13th playlist: August 24, 2020
Re: DropIt
The function that cause the crash is _GDIPlus_ImageGetGraphicsContext(). Now the problem is to determinate the reason of the crash in this main function (maybe guinness or other AutoIt coders have an idea about it):
Code: Select all
Func __SetItemImage($gImageFile, $gIndex, $gHandle = 0, $gType = 1, $gResource = 1, $gWidth = 20, $gHeight = 20)
#cs
Description: Set Image To GUI/Tray Context Menu.
Returns: Converted Image.
#ce
If __IsWindowsVersion() = 0 Or __IsClassicTheme() Then
Return SetError(1, 0, 0)
EndIf
Local $gImage
Switch $gType
Case 0 ; Native GUI ContextMenu.
$gHandle = GUICtrlGetHandle($gHandle)
Case 1 ; Native TrayMenu ContextMenu.
$gHandle = TrayItemGetHandle($gHandle)
Case 2
$gHandle = $gHandle ; UDF Functions.
EndSwitch
Switch $gResource
Case 1
$gImage = _ResourceGetAsBitmap($gImageFile)
_GUICtrlMenu_SetItemBmp($gHandle, $gIndex, $gImage)
Return SetError(0, 0, $gImage)
Case Else
Local $gBitmap, $gContext, $gIcon, $gImageHeight, $gImageWidth
$gImage = _GDIPlus_BitmapCreateFromFile($gImageFile)
$gImageWidth = _GDIPlus_ImageGetWidth($gImage)
$gImageHeight = _GDIPlus_ImageGetHeight($gImage)
If $gImageWidth < 0 Or $gImageHeight < 0 Then
Return SetError(1, 0, 0)
EndIf
If $gImageWidth < $gImageHeight Then
$gImageWidth = $gWidth * $gImageWidth / $gImageHeight
$gImageHeight = $gHeight
Else
$gImageHeight = $gHeight * $gImageHeight / $gImageWidth
$gImageWidth = $gWidth
EndIf
$gBitmap = _GDIPlus_BitmapCreateFromScan0($gWidth, $gHeight)
$gContext = _GDIPlus_ImageGetGraphicsContext($gBitmap) ; <<<<<<<<<<<<<<<<<<<<<<<
_GDIPlus_GraphicsDrawImageRect($gContext, $gImage, 0, 0, $gWidth, $gHeight)
$gIcon = _GDIPlus_BitmapCreateHBITMAPFromBitmap($gBitmap)
_GUICtrlMenu_SetItemBmp($gHandle, $gIndex, $gIcon)
_GDIPlus_GraphicsDispose($gContext)
_GDIPlus_BitmapDispose($gBitmap)
_GDIPlus_BitmapDispose($gImage)
Return SetError(0, 0, $gIcon)
EndSwitch
EndFunc ;==>__SetItemImage
Re: DropIt
Provide a reproducer i.e. something small and runnable.
Re: DropIt
I'm trying to do it, even if this example (taken from the Help) works fine and so I'm a little confused of what could be the cause.
ps: do you think the __SetItemImage() function may be improved? Because for example I'm not sure if the following lines are needed.
Code: Select all
#include <GDIPlus.au3>
Example()
Func Example()
_GDIPlus_Startup()
Local Const $iW = 460, $iH = 100
Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) ;create an empty bitmap
Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;get the graphics context of the bitmap
_GDIPlus_GraphicsSetSmoothingMode($hBmpCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
_GDIPlus_GraphicsClear($hBmpCtxt, 0xFFFFFFFF) ;clear bitmap with color white
_GDIPlus_GraphicsDrawString($hBmpCtxt, "DropIt Test", 0, 0, "Comic Sans MS", 52) ;draw some text to the bitmap
Local $sFile = @TempDir & "\Test.jpg"
_GDIPlus_ImageSaveToFile($hBitmap, $sFile) ;save bitmap to disk
;cleanup GDI+ resources
_GDIPlus_GraphicsDispose($hBmpCtxt)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_Shutdown()
ShellExecute($sFile) ;open bitmap with default app
EndFunc ;==>Example
Code: Select all
$gImageWidth = _GDIPlus_ImageGetWidth($gImage)
$gImageHeight = _GDIPlus_ImageGetHeight($gImage)
If $gImageWidth < 0 Or $gImageHeight < 0 Then
Return SetError(1, 0, 0)
EndIf
If $gImageWidth < $gImageHeight Then
$gImageWidth = $gWidth * $gImageWidth / $gImageHeight
$gImageHeight = $gHeight
Else
$gImageHeight = $gHeight * $gImageHeight / $gImageWidth
$gImageWidth = $gWidth
EndIf
Re: DropIt
Well will the graphic sizes be the same?
Also, the repository on SourceForge is outdated by a year. I was just thinking of having a look at the code and committing some potential fixes.
Also, the repository on SourceForge is outdated by a year. I was just thinking of having a look at the code and committing some potential fixes.
Re: DropIt
I interrupted the SVN use given that I was the only developer (now I'm trying to restore it, even if I have some problems with TortoiseSVN). You can find the updated code here:
http://www.lupopensuite.com/files/dropi ... Source.zip
Thanks for your help with the code, this 64bit issue is incomprehensible for me! I have a 32bit system and so I'm asking tests to some users. The last bad news is that disabling __SetItemImage() function doesn't bypass the crash (or maybe it crashes somewhere else, I'm sending an updated test version to verify it).
About the lines I reported, the graphic sizes may be different. The fact is that $gImageWidth and $gImageHeight are not used in next lines, while probably they may replace $gWidth and $gHeight.
http://www.lupopensuite.com/files/dropi ... Source.zip
Thanks for your help with the code, this 64bit issue is incomprehensible for me! I have a 32bit system and so I'm asking tests to some users. The last bad news is that disabling __SetItemImage() function doesn't bypass the crash (or maybe it crashes somewhere else, I'm sending an updated test version to verify it).
About the lines I reported, the graphic sizes may be different. The fact is that $gImageWidth and $gImageHeight are not used in next lines, while probably they may replace $gWidth and $gHeight.
Re: DropIt
When I left development everything was working on 64bit. I will see if I can find time to have a look outside of AutoIt development.
Re: DropIt
Thanks, any fix or improvement is welcome. The problem started from version 5.3 and one of the changes is the use of the next AutoIt beta. As said, I'm not sure it is the cause of the issue, I'll try to compile a version with previous stable version to test it.
ps: I'm not able to restore the SVN system on my computer, maybe we could use dropbox to share updates together
ps: I'm not able to restore the SVN system on my computer, maybe we could use dropbox to share updates together
Re: DropIt
The problem was that _GDIPlus_BitmapCreateFromScan0() didn't support 64bit OS, this is a text version that may correctly works: http://www.lupopensuite.com/files/dropi ... table3.zip
I made few minor changes and updated also the source code. I'm considering to immediately release this fix and then go on with development.
I made few minor changes and updated also the source code. I'm considering to immediately release this fix and then go on with development.
Re: DropIt
I don't have dropbox and when we worked like that in the past it was inefficient.Lupo73 wrote:I'm not able to restore the SVN system on my computer, maybe we could use dropbox to share updates together
Re: DropIt
What solution do you propose for best efficiency? I'll try to configure SVN, or something else is better?
Re: DropIt
Git?
Re: DropIt
SVN repository fixed (the last tortoisesvn update didn't recognize my authentication settings, I needed to manually remove them from registry and fix repository configs to make it working).. it may simplify the collaboration!
I'm publishing current version 5.3.1 to immediately have a fixed version available, then the plan is to do some more improvements and release version 5.4 with updated translations too.
I'm publishing current version 5.3.1 to immediately have a fixed version available, then the plan is to do some more improvements and release version 5.4 with updated translations too.
Re: DropIt
Still problems. Now DropIt 64bit crashes during file processing (I'm considering to go back to the previous compiler version). If someone would like to help with tests, this is a version with "step messages" to help me to detect the crash position: http://www.lupopensuite.com/files/dropi ... table4.zip