Page 15 of 18 FirstFirst ... 512131415161718 LastLast
Results 561 to 600 of 710

Thread: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

  1. #561

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    What I suspect you are experiencing is a little known behavior of VB.

    1) Loading WMF,EMF by handle isn't supported in this version of the control. Just send the picture object.

    2) When you load a bmp/jpg by the object, you should not experience any quality issues.

    3) When you load GIF by handle, compiled or not, or by object, when compiled, you will lose transparency

    4) When you load icon by object, when compiled, you would lose quality if I didn't foresee that problem.

    For #3 & #4 above, here is why. During design-time, uncompiled project, VB caches the original image data when it creates a stdPicture object. I believe this is simply so that VB can save the original data with the project in the .frx, ctx, and other project files. But when your project is compiled, VB does not save this data any longer when it creates the stdPicture object, it doesn't need to, for its purposes, because it knows that data is not needed for saving to project files.

    Ok? When you pass the picture object to be loaded, my control's logic works like this:

    1) Icon? Always load by the object's Handle to avoid VB's color reduction

    2) Anything else: If VB kept the original data, use that data to load the image (as mentioned VB doesn't save this data when compiled)

    3) If no original data exists, code asks VB to create the data. This is where VB is really bad with icons and GIFs. GIFs/JPGs are saved in bitmap format. GIFs lose transparency because internally by VB/COM, they are bitmaps not GIFs. Icons are color reduced down to 16 colors resulting in poor quality. You should see these quality issues if you viewed the result of the image file created by VB with: SavePicture "c:\test images\filename.ext", Image1

    Note: Even if the original metafile data is not provided in the picture object, VB can recreate metafiles flawlessly

    This behavior of VB needs to be understood if passing picture objects to anything, to be used as image source data.

    Suggestions if these formats will be used by the alpha image control (AIC) after your project is compiled:
    1) GIFs. Load these into a resource file. Pass them via LoadResData()
    :: doing so, ensures all frames are available & transparency is preserved
    2) Icons. Same as GIFs. You could also use VB's image control since the AIC uses the icon handle
    :: using res file ensures all sub-icons are available if more than 1 icon exists
    3) Bitmaps. Any method you want
    :: stdPicture objects processed by ignoring alpha channel. If channel is used, pass by handle
    4) JPGs. Load these via resource file if the original image data is needed by you. Otherwise, any method will work
    :: saving a JPG loaded by VB to JPG format causes recompression of original data
    5) WMF/EMF. Any method you want, but don't try to load metafiles by handle
    :: see notes below
    6) Any format not supported by VB: use the resource file method or disk file

    Edited: I see you use this quite a bit: LaVolpeAlphaImg.AICGlobals....
    Just FYI, shouldn't be necessary if you don't want to: Set AlphaImgCtl1.Picture = LoadPictureGDIplus(Image1.Picture)

    Edited Again. A bit more about metafiles if trying to pass by handle
    EMFs can be processed a couple different ways from its handle. This is not a major issue to support passing EMF by handle. However, WMFs are a different story...

    When you have a WMF handle, you have a handle to its bits, its drawing commands. Without analyzing each command to determine where & what dimensions each command is attempting to draw to, there is no way I can think of to get the dimensions, nor aspect ratio of a WMF strictly from its handle. With the handle only, what we have is basically a non-placeable WMF -- no dimensions, no aspect ratio. In my own version of this control, WMFs passed by handle are treated as non-placeable and user has option to set dimensions. GetObjectType API helps identify type of image handle.
    Last edited by LaVolpe; Dec 16th, 2015 at 08:24 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  2. #562
    New Member
    Join Date
    Jan 2016
    Posts
    2

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by LaVolpe View Post
    I'll take a look, but not likely in the next day or two. I am always interested in errors and bug reports.

    In the mean-time, try passing the handle: Image1.Picture.Handle

    Edited. A quick look, I was able to replicate the problem twice in a row. Then problem went away without doing a thing. I think I have it narrowed down, but will have to perform more tests. If I do figure it out (and I will), you will have to make the change to your copy of the control & recompile it. If this is the only issue and if passing only picture objects that contain bitmaps or jpegs, would recommend passing by handle vs the picture object. That way you won't have to modify the code, recompile, & redistribute the ocx.

    Follow-up. To patch the bug:
    Method: modCommon.pvProcessStdPicSource
    Add this: bSaveMemCopy = True
    Where:
    Code:
    ... 
    If IPic.KeepOriginalData Then
        ....
    Else
        bSaveMemCopy = True ' << insert here
        IPic.SaveAsFile ByVal ObjPtr(IStream), bSaveMemCopy, lResult
    End If
    ...
    Hi

    Same problem here, seems strange, I have two developer machines, the first one with Windows 10+VB6 runs ok, the oher with Windows XP+VB6 shows error 481 loading the same JPG.

    I've tried to apply your patch but that piece of code does not apperas in pvProcessStdPicSource:
    Code:
    ... 
    If IPic.KeepOriginalData Then
        ....
    Else
        bSaveMemCopy = True ' << insert here
        IPic.SaveAsFile ByVal ObjPtr(IStream), bSaveMemCopy, lResult
    End If
    ...
    I've found this:

    Code:
    If ipic.KeepOriginalFormat Then
            ipic.SaveAsFile ByVal ObjPtr(IStream), False, lResult
            If lResult = 0& Then ipic.SaveAsFile ByVal ObjPtr(IStream), bSaveMemCopy, lResult
        Else
            ipic.SaveAsFile ByVal ObjPtr(IStream), bSaveMemCopy, lResult
        End If
    Anyway I've added the line there and still error 481

  3. #563

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    @tbote. Instead of True,False, try using 1&,0& respectively. That appears to work well in a recent project I uploaded to the codebank
    Code:
    If IPic.KeepOriginalFormat Then  ' from COM-cached data
        IPic.SaveAsFile ByVal ObjPtr(IStream), 0&, lResult
    Else                             ' from COM-created data
        IPic.SaveAsFile ByVal ObjPtr(IStream), 1&, lResult
    End If
    Edited: If the error is still occurring, please let me know. In this version of the control, I have no low level code to manipulate the IStream (COM interface). Continued failure would likely result in a need to reset the stream's Read/Write pointer to the 1st byte before attempting to call IPic.SaveAsFile. Hoping that passing 1& vs True (-1) will nip this annoying inconsistency.

    P.S. That error is self-generated in the code. If the LoadPictureGDIplus fails to return an image, it raises the error.
    Last edited by LaVolpe; Jan 16th, 2016 at 12:10 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #564
    New Member
    Join Date
    Mar 2016
    Posts
    2

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Hi LaVolpe,
    I have been looking at using the excellent alphaimage in some of my vb6 apps, and wondered what the situation is with using it in a commercial application, i.e. if I choose to sell an app.
    Is it allowed? And how am I best to credit you as the author in my code/application?
    Many thanks

    Craggus2000

  5. #565
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Does who know the status of Lavolpe? He was offline since 5 march 2016.

  6. #566
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    drawing on transparent OCX

    Hi Lavolpe.

    I can't thanks you enough for your contribution for Vb6.
    if you could allow myself to benefit once more from your knowledge, I would greatly apreciate it.

    How do you manage to "draw" on a transparent OCX ?
    I'm using the "bonus code" (of another of your project) to draw a transparent png on a form.
    it work perfectly.

    but when I try to make an OCX out of it, (I'm forced to use Transparent background of the OCX properties)
    the image doesn't show.

    So I was wondering how you do it in AlphaImage control. This control is so huge, it is hard for me to trace how you do it. if you could just spare some of your time to made me benefit from your knowledge. plz.

  7. #567
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control (PNG, AniGIFs, TIFF, & more) [7 Nov 2011]

    Quote Originally Posted by LaVolpe View Post
    P.S. If you find a bug, especially one that annoys you, don't wait a month. I'm very receptive to bug reports
    Hi Lavolpe,
    I follow you on other forum and continu to appreciate your knowledge and wisdom.
    I know this project is not updated anymore. But I though... maybe a bug report would revive your flame about it

    (but if not, thanks anyway for all you gave us in the past)

    I'm really trying to fix this for a project of mine...

    if I take an image (png) of let's say 1(width) per 20(height) composed of 1 color (mine is more complicated, but this does same thing)

    and apply the following:

    Aspect: 1- lvicStretch
    Interpolation: 3- lvicNearestNeighbor

    Then on the form, I stretch the picture to let's say 200pixel using

    then here the problem...
    I try to apply an effect:
    Call aicLine.Effects.CreateColorBalanceEffect(16, 0, 100)
    aicLine.Effect = lvicColorBalanceFX

    The first (about) 16 pixel (width) are totally white (all height)

    any idea for a quick fix ?

    if you're interested in the challenge, I can post my code and the image on an ftp.
    thanks again.

  8. #568
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control (PNG, AniGIFs, TIFF, & more) [7 Nov 2011]

    Quote Originally Posted by VbNetMatrix View Post

    Aspect: 1- lvicStretch

    I forget to add that if you don't stretch the image and use an already proper size picture, it work as intended.

  9. #569
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    hi again.
    can u help me about this ? https://stackoverflow.com/questions/...nt-form-in-vb6

    i posted here too http://www.vbforums.com/showthread.p...75#post5127975

    i want read psd file and layers in it and then show on dekstop (on a transparented form). i found source for read psd and show layers in form but cant show on desketop like transparented form.alpha image control can not support psd format and layers?
    Last edited by Black_Storm; Jan 14th, 2017 at 09:05 PM. Reason: added link

  10. #570
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Hi

    I want to try to help you.
    can you explain more because I'm not sure what you're trying to achieve. First, you need to understand PSD ARE NOT IMAGE. It's a DOCUMENT. it's not like a BMP (image) wich can be opened in paint and wich property DIDN'T change since the creation of this image format in the 1980. PSD is a propriatary form of document that has no fixed property. That mean, a PSD file from let's say Adobe Photoshop 4 is completely different then a PSD file from Adobe Photoshop 10.

    What I need is to know what you're trying to achieve.... Show "each" layer of the PSD document on the desktop? or show the "resulted" end layer ? (visible image) ?

    if you're tying to show the end result, it would be better to export the PSD as a PNG file and then you'll have an alpha transparency image you can show on the desktop. (It can be achieve with some API)
    Last edited by VbNetMatrix; Jan 16th, 2017 at 11:07 PM.

  11. #571
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    i want use PSD file format only because matter for me and a simple version of adobe so for example adobe photoshop 8.
    my steps are :
    1- designed a psd file in photoshop with more than 1 layers for example 2 or 3 or 4 or more.... and saved like sample.psd.
    2- in vb6 can read sample.psd and can read layers and then show each layers in one form or can read all layers and show all layers on one form and then i want transparent form becase i like show just layers without form like show on dekstop effect.
    3- i want cam hv been event for example when a layer shown then can click on layer on when moure overed show another layer.

    and can u explain this in other forums about alpha control and psd format:
    "Maybe you missed that the control is provide with full source code, so you should add your code to read PSD files among the other formats. Take as example the cFunctionsTGA.cls and do the same with the PSD. " what that means do u hv any example to i can understand this means?!!!
    my language is not english.

  12. #572
    Addicted Member
    Join Date
    Jun 2009
    Location
    C:\Windows\SysWOW64\
    Posts
    227

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Again, as VbNetMatrix said, you can't use a psd file in any way in VB. It is a proprietary file format, created by Adobe for use specifically by Photoshop.

    http://www.makeuseof.com/tag/the-bes...out-photoshop/
    The problem is that PSD is not an open format. While PNGs, JPGs, and BMPs can be opened in nearly every image editor out there, PSD is special — and it needs special support.
    If you want to make a psd reader in VB, you are free to analyze the File Format Specification provided by Adobe.

  13. #573
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    As Cube8 mentionned, PSD is propriatary... meaning, Adobe can stop supporting a specific format. For example, you can't open PSD version 1 anymore because they were in conflict with the new design model they later develop. if for example, you currently build an application supporting PSD v8 and in 3-4 years Adobe decide to stop supporting this version, no program will be able to "save" in that version, meaning what you're currently developping will be broken. this will never happen with an open Image format (look at BMP, obsolete but still usable)

    better export that PSD in PNG (many if you need separate layer) and use thoses. It will be faster and you won't need to support a format or programming a read method.
    Last edited by VbNetMatrix; Jan 16th, 2017 at 11:07 PM.

  14. #574
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Smile Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by VbNetMatrix View Post
    and as Cube8 mentionned, PSD is propriatary... meaning, Adobe can stop supporting a specific format. For example, you can't open PSD version 1 anymore because they were in conflict with the new design model they later develop. if for example, you currently build an application supporting PSD v8 and in 3-4 years Adobe decide to stop supporting this version, no program will be able to "save" in that version, meaning what you're currently developping will be broken. this will never happen with an open Image format (look at BMP, obsolete but still usable)
    better export that PSD in PNG (many if you need separate layer) and use thoses. It will be faster and you won't need to support a format or programming a read method.

    BUT i can tell you we can open and read psd format in vb6--> check attachment sample,but my problem asked,i need open and read and show on transpraneted form,i can read and show on form but i cant show on transparented form, i am waiting to can find a way.
    Attached Files Attached Files

  15. #575
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    this picture can show what i want :
    Name:  needed.jpg
Views: 1446
Size:  89.9 KB
    Last edited by Black_Storm; Jan 16th, 2017 at 08:43 AM.

  16. #576
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    now you confuse me... you showed on right image you CAN DO IT.
    if you can show the image on Vb6 form, where is the problem ??
    just use SetLayeredWindowAttributes API
    https://bytes.com/topic/visual-basic...6-transparency

    I thought the problem was to show the PSD layer ?
    Last edited by VbNetMatrix; Jan 16th, 2017 at 11:06 PM.

  17. #577
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    i used SetLayeredWindowAttributes API but result was been this image (not good).
    i checked source code and can find this code :
    Code:
    SetPixelA theHdc, x + FLeft, y + FTop, r, g, b, a
    this is main command for read from layer data and theHdc is same form.hdc .
    i added SetLayeredWindowAttributes API after form load and checked and added after end of show layers and checked but result was been like attached my image,how can make good quality with shadows or ... ?


    Name:  error2.PNG
Views: 1231
Size:  253.1 KB


    can i send source code and maybe u can fix it for me?
    Last edited by Black_Storm; Jan 16th, 2017 at 02:52 PM.

  18. #578
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    post this to the other thread, I don't want to pollute Lavolpe AIC place. I'll help you solve this with AIC

  19. #579
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    i sent source code in this thread [http://www.vbforums.com/showthread.p...7#post5129607]

  20. #580
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    i hv 2 question about this thread too (alpha image control).
    1-how can make smooth animation (other way not use for next commands) and want show that animation on desktop with mouse event too?(can click on animation or drag and drop)?!!! possible?

    i want show animation (smooth) on desktop like attached image but png format and transparented :


    if possible can attach source code or sample code ? thanks


    2-this control can support apng format?if not how can simulate this format with png ?
    Last edited by Black_Storm; Jan 17th, 2017 at 04:26 PM.

  21. #581
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Lavolpe AIC support APNG, and mouse driven event. if you use your program with the previously discussed API, you can make your form transparent while supporting event on the image.

  22. #582
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Question Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    can u send a sample source code animation merged with form controls and show on desktop use by AIC?
    i have source for show animation on desktop with AIC but i can not merge controls like textbox or button or shape or ...
    i dont want use trick like show animation on one form and show controls like as top form on animation.i want just use one form with aic control and form's controls.

    Name:  sample bug.PNG
Views: 1112
Size:  17.1 KB
    Last edited by Black_Storm; Jan 18th, 2017 at 11:17 PM.

  23. #583
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by Black_Storm View Post
    can u send a sample source code animation merged with form controls and show on desktop use by AIC?
    Use eitheir an animated GIF or an aPNG (animated PNG) when you need the animation, you use:
    aicPng.Animate lvicAniCmdStart

    as simple as that. (1 line of code)

    did you installed the AIC ? if so, you can get nice APNG here: http://voormedia.com/blog/2016/09/an...ng-compression

  24. #584
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Question Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    my means was been about sample source code animation merged with form controls and show on desktop use by AIC?
    i have source for show animation on desktop with AIC but i can not merge controls like textbox or button or shape or ...
    my problem is about merge controls like text boxes or command buttons or shape or ... when i use aic and then maked transparent.
    did u see picture attached in #582?


    see this result (how can fix it?): http://s.pictub.club/2017/01/27/sr2WTY.gif or

    and i have another question
    1- i have a animation with 20 frames and dont need loop animation just need 1 loop time.
    2-how can start animation from frame 3 when form loaded or show.
    3-then play from frame 3 to frame 12 with my custom speed?
    4-when frame was been 12 then stop 2 second.
    5-then start animation resume from frame 12 to frame 15
    6-then animation jump to frame 18
    7-play animation resume from frame 18 to end frame(frame 20)
    Last edited by Black_Storm; Jan 26th, 2017 at 08:01 AM.

  25. #585
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    simple apng images needed for vbnetmatrix request :sampleframes.zip

  26. #586
    Addicted Member
    Join Date
    Sep 2015
    Posts
    225

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    I have a project which uses Alpha Image Control (AIC), it works fine on my development machine and clients who have Windows 7 but AIC does not show the image (blank control) on "some" Windows 10 machines, any clue?!

  27. #587

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Any clue? Gonna need a lot more info than that. I have Windows 10 and no problems. It might help to know whether this problem is for every instance of the control? Whether you are talking about the control displaying or using one of its functions to draw to a picturebox or other DC? Whether this seems related to a specific image format? etc, etc. Without far more details, I am not gonna be able to venture any guesses or suggestions.

    Also, for the control(s) that don't display correctly, post the LoadPictureGDIplus statement you are using. See if post 553 & 554 on previous page apply, along with post 561, 562 & 563 on this page.
    Last edited by LaVolpe; Aug 6th, 2017 at 06:59 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  28. #588
    Addicted Member
    Join Date
    Sep 2015
    Posts
    225

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Thanks Lavolpe!

    Actually I am loading an AVI file not a picture, though I am using LoadPictureGDIplus() to load it into the Picture property of the AIC.
    I have like a custom made thumbnail viewer and using the following code to populate it :
    Code:
    Private Sub ThumbnailViewer()
    
        On Error Resume Next
        Dim tmpFL As String
        Dim n     As Integer
    
        For n = 0 To 4
            With imgThum(n)
                tmpFL = CURRPATH & "\" & flAviFiles.List(n + SlideIndex)
                If Right$(tmpFL, 1) <> "\" Then
                    .Picture = LoadPictureGDIplus(tmpFL)
                    .ToolTipText = "   " & Lang(20) + " :" + Str$(n + SlideIndex + 1) & "   "
                    If Dir$(Replace$(tmpFL, ".avi", ".ini")) <> "" Then .BorderColor = vbRed Else .BorderColor = vbBlack
                    .Visible = True
                Else
                    .Visible = False
                End If        
            End With
        Next
    
    End Sub
    Normally it should look like this when all is OK :

    Name:  Good.jpg
Views: 917
Size:  9.6 KB

    On some versions of Windows it looks like this :

    Name:  Empty.jpg
Views: 842
Size:  8.1 KB

    P.S. :
    * The DivX codec is installed on all clients machines.
    * flAviFiles is a 'FileListBox' control with a pattern of *.AVI
    * Lang() is an array which loaded with different languages text
    I know you will figure out the the above two lines but I had to write them anyway
    Last edited by labmany; Aug 7th, 2017 at 01:19 AM.

  29. #589

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    When you have the the time, open this class module within the AIC project: cFunctionsAVI. Read the comments at top of the class and see if they apply.

    Also regarding this line: .Picture = LoadPictureGDIplus(tmpFL)
    After that statement returns, test to see if .Picture.Handle = 0. If it does, the AVI failed to load using the AVIStreamOpenFromFile API or the AVIFileInit API failed (not likely).

    Also ensure this line is true: If Right$(tmpFL, 1) <> "\" Then

    I can play with this further if you can't get it working based on the comments in that class. But I'll need the AVI and a link where to get the codec. I can't guarantee I'll get to play real soon; have other things on my plate right now. My 1969 Mach I Mustang just died on the way to work and dealing with that today, off and on.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  30. #590
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by LaVolpe View Post
    My 1969 Mach I Mustang just died on the way to work and dealing with that today
    I feel you man.

    wich part broken ? did u succeed to get replacment ?


    in the meanwhile, I wanted to ask you a question about the AIC. In a project of mine, I add the reference to the component but I didn't used it (yet). Inside the IDE, I was debugging the app wich also use the MsFlexGrid and WinHttp component. All 3 component I used in different application (but never all together) and I never had any problem. In this particular project, the AIC was referenced but not put on any form. the IDE experienced "Out of Memory" error from time to time when the program "end" normally or "stop" from the IDE.

    removing the AIC reference, fixed the problem, but I fail to see how a reference to AIC without initializing it or using it on form could lead to that.
    Did you ever experienced similar problem ? Seem a rather unexplained problem. I didn't tried too "reproduce" it since I had to deliver the application in a hurry.

    any idea ?

    thanks for any feedback

  31. #591

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Out of Memory isn't related to the AIC as far as I can see. I've taken great efforts to ensure no memory leaks. The control, when first used or any of its global methods are used, will create a GDI+ token.

    If a control is used, then other items may be created like a GDI+ image and/or bitmap, depending on options/settings of the control. However, even if there is a memory leak, I'd think one would need 100s of controls to cause that problem. Again, as far as I know, there are no leaks and with 1000's of downloads, this was never brought up previously. A quick test, using Task Manager, shows that the GDI count before a project run with the AIC, increases while the project is running (expected), and returns to that value after the project is closed. Pretty confident no leaks.

    Out of memory can occur in a recursive routine also. If you have any recursive routines look at those. In the AIC control there are 3 places where recursion can occur. Those routines include async downloads via URL, creating adaptive palette option when saving image in low color depth, and when autosize of the control is set to true and a potential of resizing entering an infinite loop. In all of those, I've included code to prevent unexpected recursion.

    Are you by chance running any code that tries to resize controls based on form_resize? Maybe that could be an odd case that could cause an infinite loop if your code is forcing one size while the control's AutoSize feature is forcing another, maybe just a pixel off? But if you don't even have any controls sited on the form, that won't be in play.

    but I fail to see how a reference to AIC without initializing it or using it on form could lead to that.
    That is odd indeed and may be coincidence. Maybe you can try it in reverse order. Add the AIC first, then the other references, one by one. Do you get the same results? If the control is not even sited on a form, no code is running so this is unusual. If you can reproduce the problem on demand, that could be helpful. Maybe there is some sort of race-condition being created between the AIC and the other references?

    Edited: When you get that message box, is it possible to break into the code to see what line is being executed? That would help.

    The only issue I know that can happen is addressed at this posting. However, this problem is not specific to this AIC, it is applicable to any VB-created usercontrol when environment is manifested.

    BTW: Mustang will need a new dizzy. Been waiting for the makeshift one I am using to fail so I can spend the money to buy a high performance custom-made replacement. Last one lasted about 5 years and finally crapped out -- good for me, now bad for my budget: $370
    Last edited by LaVolpe; Aug 7th, 2017 at 03:37 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  32. #592
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Thanks a lot Lavolpe, I apreciate the cue. I'm reading the link you provide, I'm not sure I understand why the IDE would crash with that configuration.
    I'll try to reproduce it to see if it apply, I'm not using the shell but if I can understand the reason why it does, it might give me a cue on my own problem.

    I'll also investigate more by reproducing the problem with the AIC, for now I have simply removed the AIC reference from the project as it was not mandatory. (I had hoped to skin my project in a later version)

    again your work is excellent and I always apreciate your input.

    I'm glad you came back on the forum, I had posted some other bug in your absence but it is not really important. some were strange though (putting 2 AIC control over each other with transparency caused a race condition and the image became weird - zoomed in)

    Do you still intend to produce a new version with DPI awareness ? I'm asking with sincere interest but I understand how busy our regular life keep us from doing everything we wish

    wish you the best for your car... didn't know you were fan of antique I failed to translate the name of the part you are talking about, is it part of the carburator ? It is a wonderfull car... Wish I had one like that. I wouldn't mind if you post some picture of her online

    thanks for all.

    <<<When you get that message box, is it possible to break into the code to see what line is being executed? That would help.
    Edit: When it happen, I can't even save the project (it raise the out of memory error), I got to exit the IDE and load back. fortunately, my setting are set to save project before every run. But the problem don't raise while running. It raise AFTER I hit STOP (while the program is on waiting) or when I EXIT the program and return to IDE
    Last edited by VbNetMatrix; Aug 8th, 2017 at 01:00 AM. Reason: missing info

  33. #593

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by VbNetMatrix View Post
    ...I had posted some other bug in your absence but it is not really important. some were strange though (putting 2 AIC control over each other with transparency caused a race condition and the image became weird - zoomed in)
    The control only draws itself under a few conditions: VB tells it to, user calls refresh, animation frame changed, user changes some drawing options or changes the assigned picture. For windowless controls, if 3 controls were overlapped with each other for example, a redrawing of one would trigger redrawing of all 3, where they intersect. VB clips the dirty area of the DC, sends control lowest in ZOrder a paint event, passes the repainted DC to the next in ZOrder, and so on. Once all have painted, VB updates the screen. As far as the effect you experienced, that would need to be troubleshot. Could be a logic error within the AIC. But in post #3 (1st page), twice I recommended not to overlap controls.

    Quote Originally Posted by VbNetMatrix View Post
    Do you still intend to produce a new version with DPI awareness ? I'm asking with sincere interest but I understand how busy our regular life keep us from doing everything we wish
    Yes, I thought I was nearly done with it, but after learning more about DPI awareness, I wasn't happy with the logic and will need to start fresh.

    Quote Originally Posted by VbNetMatrix View Post
    wish you the best for your car... didn't know you were fan of antique I failed to translate the name of the part you are talking about, is it part of the carburator ?
    Dizzy = nickname for Distributor
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  34. #594
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by LaVolpe View Post
    in post #3 (1st page), twice I recommended not to overlap controls.
    Yes, that's what I opted in to fix the problem although, the problem (in my case) was not the primary redraw when the control overlap, but when I move the mouse over the control. Then, the image under the second control became zommed in... anyway, like you said... fixed by not overlapping

    The other bugs was a scale bug where not all pixel get the proper color. (having a region completely white for some reason)

    Quote Originally Posted by LaVolpe View Post
    --AIC v3 -- Yes, I thought I was nearly done with it, but after learning more about DPI awareness, I wasn't happy with the logic and will need to start fresh.
    I wanted to ask you to take something into consideration... It is YOUR control, so the decision is yours... why not make the control in a way we can "remove" easyly part of it ? For example, let's say someone intend to use it only for PNG and JPG, if we could remove module we could compile a control easier to "debug/diagnose" under some condition.

    While attempting to fix a bug by my own in past, I have attempted to unload the class related to other image format... the task reveal itself to be almost impossible because of the intresec interraction with one another... So I had this thought... but I understand it would require some work.
    anyway... like I said... just a thought.

    Quote Originally Posted by LaVolpe View Post
    Dizzy = nickname for Distributor
    that's the cap with electrode spinning to give fire to candle in proper order right ?
    I had this piece broken down on me on a Dodge 72

  35. #595

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by VbNetMatrix View Post
    I wanted to ask you to take something into consideration... It is YOUR control, so the decision is yours... why not make the control in a way we can "remove" easyly part of it ? For example, let's say someone intend to use it only for PNG and JPG, if we could remove module we could compile a control easier to "debug/diagnose" under some condition.
    I will consider options where the user can customize the ocx before they compile it.

    that's the cap with electrode spinning to give fire to candle in proper order right ?
    Yes. Though the order is always one way: clockwise or counter-clockwise. The cables from the cap to the engine result in the proper firing order if the cables applied properly.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  36. #596
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by LaVolpe View Post
    I will consider options where the user can customize the ocx before they compile it.
    thanks

    Quote Originally Posted by LaVolpe View Post
    Yes. Though the order is always one way: clockwise or counter-clockwise. The cables from the cap to the engine result in the proper firing order if the cables applied properly.
    What I meant was : while rotating, it hit candle specific order like 1, 4, 3, 8, 2, 5, 7, 6 depending of motor configuration, eitheir in V or in line (like jaguar).
    but yeah, we're speaking about the same part.

  37. #597
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Hi Lavolpe,

    I'm in a dead end with something, I hope you can help.

    basiquely what I'm trying to do is:
    Set pngLavolpe1.Picture = LoadPictureGDIplus(picVb6PictureBox.picture)

    I received error 481, incorrect format.
    I look at documentation from your component, didn't find anything unusual.

    However, I found something that let me skeptical about eitheir or not your AIC can do this in that particular case.

    When my program start, I got a white rectangle in the picturebox frim a file (BMP). Nothing fancy

    on some subroutine, I do a

    1. picturebox.cls
    2. ... some modification with DrawText Api
    3. picturebox.refresh
    4. set picturebox.picture = picturebox.image

    then I try:
    Set pngLavolpe1.Picture = LoadPictureGDIplus(picturebox.picture)

    tha'ts where it'S crashing with error 481.

    Is there a way I can manipulate my image with DrawText and then put it back in AIC control ?
    I'm using picturebox because AIC doesn'T expose hDc


    picturebox.ScaleMode is 3 'Pixel
    picturebox.AutoRedraw = True

    Thanks for any input...

    ps. glad you found your car part. hope you'll travel the road long before winter

  38. #598

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Crashing should not be happening and I suspect it is due to not handling errors. If LoadPictureGDIplus fails, it generates an error. Use On Error statement before calling that function. Ok, that fixes any crashing.

    Now regarding incorrect format error. That error only occurs if LoadPictureGDIplus. Long story short... When passing the Picture object, AIC tries to get VB to give it the image data via a stream. This obviously is a problem on some systems, based on previous posts. I've offered some possible tweaks in those previous posts, but not all may apply. One workaround that should work is to pass the handle, ie., Set pngLavolpe1.Picture = LoadPictureGDIplus(picturebox.picture.handle). Hopefully that gets past that error.

    Regarding the AIC not exposing it's hDC. But it does through the WantPrePostEvents property and responding to the PostPaint (in your case). However, and this could be a problem, GDI+ should always be used to draw text. This is because the hDC passed in that event may be holding a 32bit image and DrawText/TextOut does not render correctly on 32bit bitmaps. The alpha channel can become invalid.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  39. #599
    Addicted Member
    Join Date
    May 2011
    Posts
    230

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by LaVolpe View Post
    Crashing should not be happening and I suspect it is due to not handling errors.
    I'm still in developping phase... by crashing I meant not doing what we expect... throw error 481 instead of loading image...
    sorry to have mislead you... I'm not handling error at this point.

    Quote Originally Posted by LaVolpe View Post
    Now regarding incorrect format error. That error only occurs if LoadPictureGDIplus. Long story short... When passing the Picture object, AIC tries to get VB to give it the image data via a stream. This obviously is a problem on some systems, based on previous posts.
    I would be interested to read thoses post... although I don't think it's the issue here (some systems...) Never had ANY problem with your component except "some" minor glitch in rendering...

    Quote Originally Posted by LaVolpe View Post
    I've offered some possible tweaks in those previous posts
    I'll try to find them. Do you remember some content to facilitate the search ?

    Quote Originally Posted by LaVolpe View Post
    One workaround that should work is to pass the handle,
    ie., Set pngLavolpe1.Picture = LoadPictureGDIplus(picturebox.picture.handle)
    instant fixe! thanks.


    Quote Originally Posted by LaVolpe View Post
    GDI+ should always be used to draw text. This is because the hDC passed in that event may be holding a 32bit image and DrawText/TextOut does not render correctly on 32bit bitmaps. The alpha channel can become invalid.
    Thanks for the information. I'm writing directly onto a picturebox then passing the picture to the AIC control. It doesn'T need transparency, it's simply a BMP, then I save it to PNG or JPG, depending of the image.

    The program I do simply put and order image in an Access Database for VR on sales, with the program, you can add, remove and manage the VR that are or not on sales... Then the program create Thumbnail and the resulting Access Database.

    The result is displayed as a web page I have created in the form of a "book" where you can turn page, click thumbnail...

    an image is worth 1000 words:
    http://www.campingbaiedudiable.ca/roulottes_vendre.html

  40. #600

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

    Quote Originally Posted by VbNetMatrix View Post
    I would be interested to read thoses post... although I don't think it's the issue here (some systems...) Never had ANY problem with your component except "some" minor glitch in rendering...

    I'll try to find them. Do you remember some content to facilitate the search ?
    Start with the last few posts on previous page and post #562 on this page.

    instant fixe! thanks.
    If passing the handle worked but passing the picture object did not work, then what I described in my previous reply is the reason. Just FYI.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Page 15 of 18 FirstFirst ... 512131415161718 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width