#188 vb6 craching encountered problem

None
open
None
5
2014-03-23
2011-10-10
No

I opened my project for the first time since April and it crashes "VB6 has encountered a problem and needs to close"
The last exe I made in April 2011 still functions fine
I tracked the problem down to this line:
imgToDraw(0) = FreeImage_Composite(imgEditScaled, , , imgBack(backgroundIndex))
including the third argument (appBackColor) as 0 fixes the problem
imgToDraw(0) = FreeImage_Composite(imgEditScaled, , 0, imgBack(backgroundIndex))
Any ideas about why this argument should suddenly change from being optional to compulsory?

Discussion

  • Hervé Drolon

    Hervé Drolon - 2011-10-11

    Hi,

    The last version of the VB wrapper is dated from March 13, 2011.
    This version added a very minor fix to the August 11, 2010 version.
    I don't think the problem is related to the wrapper.
    If this is the case, could you provide a patch for the current version ?

    Hervé

     
  • Glenn Thorpe

    Glenn Thorpe - 2011-10-13

    Hello Herve
    The fix that I suggested fixes the VB6 crashing error but does not fix the problem.
    It removes transparency and replaces transparent areas with a black background.
    I am no expert on function declarations so am sure that I do not understand what is happening!
    If I move back in the MfreeImage3130 wrapper (keeping the 3151 dll) it works OK (but have not reverted my code back to remove the “0” 's) – so this may mean that the problem is in the wrapper..
    The difference in the function declaration between 3130 and 3151 is that all four arguments have been changed, the name of fg has been changed to bitmap (still long) and the name of bg has been changed to BackgroundBitmap (still long).
    The UseFileBg argument has had its name changed to UseFileBackColor, it has had the type changed from boolean to long and it has had the default “= False” removed
    The appBackColor argument has had its name changed to AppBackColor and it has had its type changed from Long to Any.
    Within the 3151 bas, if I use the 3130 declaration it is OK if I change the type of useFileBkg from “Boolean” to “Long”.
    There are three results from appBkColor type, depending on whether I use the 3130 or the 3151 declaration as the base.
    For both the 3130 and 3151 declarations if I have the type as “any” and the function call is blank (without the “0” argument) I get the VB6 crash error.
    If I use the 3130 declaration with a type of of “any” and I include the “0” in the function call I get a compile error.
    If I use the 3151 declaration with a type of of “any” and I include the “0” in the function call I get a black background instead of the transparency I want.
    As I said I have no expertise with function calls and do not know what is going on?
    Thanks

    Glenn

     
  • Glenn Thorpe

    Glenn Thorpe - 2011-10-13

    Hello Herve
    I looked into this a little more and can get it to work for my purposes with two changes. Both changes are to the AppBackColor argument of the FreeImage_Composite declaration.
    While this fixes the problem for my limited use it does not work in other cases. My limited use is that I always require a transparent background. To get this to work I have to change byRef to byVal and also explicitly pass null (0& in VB6). The argument line in the declaration then becomes:
    Optional ByVal AppBackColor As Any = 0&, _
    However there is now a Type mismatch error if I try to include an rgbQuad or a numeric value in the function call.
    I have tried various combinations of byRef/byVal & numeric & null values passed by function calls but cannot get it work for both transparent and background cases – it either works for one or the other
    Thanks
    Glenn

     
  • Hervé Drolon

    Hervé Drolon - 2014-03-23
    • assigned_to: Hervé Drolon --> Carsten Klein
    • Group: -->
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks