Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What the f... is this now
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01048571
Message ID:
01048660
Vues:
23
Hi,

On difference:
In the first case loLarge is initialised to .F., in the second to .NULL.

>Arrrgh!
>
>I am trying to add additional functionality to my IconBuddy-Class. I want to give You the ability to extract asssociated Icons from a resource or file and save them to Bitmap-Files, so You can use them in VFP-Controls.
>
>Anyway it works from the command window and also from a test-PRG that looks like this:
>
>
>oiconBuddy = null
>oIconBuddy = newobject("iconbuddy", "iconbuddy")
>
>local loLarge, loSmall
>
>? oIconBuddy.GetassociconPairobjects(getfile("XLS"), @loLarge, @loSmall, .T.)
>
>? oIconbuddy.icon2bitmap( losmall.Handle, "Frank_Small.bmp" )
>? oIconbuddy.icon2bitmap( loLarge.Handle, "Frank_Large.bmp" )
>
>
>No rocket sience - works !
>
>So I wanted to add a HighLevel.Method for You, so that You can do that in one line of Code.
>
>And this is what we have in the new Method of IconBuddy:
>
>lparameters tcSourceFile, tcBitmapLarge, tcBitmapSmall
>LOCAL lnRetVal, loLarge, loSmall, lnX, lnIcons, loIB
>tcSouceFile   = iif(vartype(tcSouceFile)   = "C", tcSouceFile, "")
>tcBitmapLarge = iif(vartype(tcBitmapLarge) = "C", tcBitmapLarge, "IconBuddy"+ sys(2015)  +".bmp")
>tcBitmapSmall = iif(vartype(tcBitmapSmall) = "C", tcBitmapSmall, "IconBuddy"+ sys(2015)  +".bmp")
>
>lnRetVal       = -1
>
>if empty(tcSourceFile) or ! file(tcSourceFile)
>    this.cErrorText = IconBuddyErr_MissingSourceFile
>    return lnRetVal
>endif
>
>if empty(tcBitmapLarge) and empty(tcBitmapSmall)
>    this.cErrorText = IconBuddyErr_NoTargetFile
>    return lnRetVal
>endif
>
>loLarge = null
>loSmall = null
>
>*-- now get the Icon-Objects and keep the handles
>lnIcons = this.GetAssocIconPairObjects(tcSourceFile, @loLarge, @loSmall, .T.)
>
>if lnIcons <= 0
>    this.cErrorText = IconBuddyErr_NoIconsFound
>    return lnRetVal
>endif
>
>
>? loLarge.Handle  <- Error !!!!!!!!
>
>
>lnX = 0
>
>if ! empty(tcBitmapLarge) and ! isNull(loLarge)
>
>    *-- Save the large Icon
>    if this.icon2bitmap( loLarge.Handle, tcBitmapLarge, .T.)
>        lnX = lnX + 1
>    endif
>
>endif
>
>.....
>
>
>
>Looks pretty darn the same to me - even though it is sunday night half past one.
>
>However, I do get an OLE-error "Unknown name" when I try to access the icon's handle. If I click "Suspend" and hold the mouse-pointer over the line, "Trace" properly shows me the handle and I can open loLarge in "Locals" and do see the handle as well.
>
>Now what is this? This should be a 10 - minute code. Now I'm sitting on this for two hours and bang my head on the table. Arrrrgh.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform