Results for "Author: lavolpe"
Work in progress & posted for your suggestions. This is a good PNG reader (includes progressive display/interlacing--rare indeed) & the writer is in progress & will be posted next month, hopefully. In order to use this, you'll need ZLIB.DLL and a link for a VB-friendly version of that free DLL is near the top of the main class. Currently not Win95/NT4 capable, but working on that too. Again, this is a work in progress. The PNG format contains many color-related "chunks" that I don't currently have the knowledge to implement. If you know how to handle any chunks that are unhandled in the project, please email me. In IDE, this thing crawls, but compiled it is up to 10x faster & can display full screen PNGs very quickly. Hoping to hear from you all. When the PNG Writer is ready, will repost with the changes--expected to be massive. Added step-by-step instructions at top of stdPNG class for using the zlib DLL. Tweaked to fix minor errors I mentioned in remarks below. Added a readme file, more properties/options (like global AlphaBlend), and more comments. I think the reader is now good to go pending any bug reports & my TODO list I added at top of the main class. The writer is next.
A mini-tutorial highlighting some things you may want to look out for when coding. Also included is a somewhat simplified approach to preventing, detecting and locating memory leaks. Updated... expanded/clarified a few points.
(Updated) Carles posted a very excellent alphablend & stretch routine that did not rely on the AlphaBlend API. Original post is txtCodeId=60424. This is my spin on his code adding some functionality not previously available. Changes include blending non-32bit images, using clipping to speed up some stretched images, adding options to stretch portions of images, offering a global alpha blend option along with per pixel alphas. However, the added overhead can prove to be slightly slower than Carles' original routines. You should test & compare against his original code. ALL VOTES SHOULD GO to his post (txtCodeId=60424). Modified 23Jan/22:30zulu to handle negative DC offsets & fix known calculation errors. Tweaked 24Jan/1609z for speed. 26Jan/1700z: final safety checks added; minor speed improvements
With a little trickery and subclassing, we can make a picture box look and feel as if it was a transparent frame. For XP manifest lovers, I know how much frames are a pain; this could be a nice substitute. This project isn't overly commented, but it isn't very big either. Uses Paul Caton's excellent subclassing thunks. 27Jan05: Didn't refresh when frame size reduced by code. 28Jan05: Modified to allow a no border option.
Updated. Want a custom button usercontrol shell? I am re-thinking a custom button & this time thought I'd write a shell that I can reuse over & over again. The attached contains a primitive example of using the shell and also contains the shell in another subfolder you can copy to your VB template's folder so it shows up when you select to "Add a Custom Control" to your project. Just thought I'd share it. I will post fixes for any bugs, but will not customize it to a point where it is no longer generic. See top of usercontrol for change history. Recent changes 20 Feb 09: Added Value property, support for Default button property, changed order of rendering/events in UpdateState routine, minor tweaks of some other stuff.
The intent is to show a way usercontrols (compiled or not) can access their host's RES files, compiled or not. This project contains the main class which reads from compiled & uncompiled project's RES files. The usercontrol has a property page that displays RES file images during design time -- kinda niffty. Please don't ask for updates to the usercontrol, it is only a test project for the cResReader class. For you UC lovers, take this and run -- if you need some advice on this technique, ask away, I'm already about 2 months ahead of you I think.
Hmmm, another one for usercontrol lovers maybe. I wanted a way for a UC to get the resources from a host's RES file during IDE. This way the UC can use host images and display them during design time. The biggest problem was parsing the res file, the 2nd biggest problem is being able to access it during IDE design, IDE Run, and Compiled all from a UC and not the host. For a UC during IDE, you would need to have a way for the user to supply you the path to their RES file and, in a few days, I will be posting an example of that along with other methods too. The functions in the attached class allow image resources to be extracted as stdPictures or arrays -- this way I can use my c32bppDIB class with it too :)
A little project to help explain how to read SafeArray structures just from the pointer. The project shows how you can determine if the array contains longs, dates, variants, etc, the number of dimensions, and more. Additionally, the code does not use VarPtrArray API to get the SafeArray address - neat trick. This is not groundbreaking code, but would be of interest to those that like the behind the scenes stuff. Included are "how to's" on creating your own and using them.
Add unicode filename support to VB when dropping files or pasting files. Making attempts to understand unicode support, I am discovering some shortfalls within VB. And in this specific case have not found a workaround for the problem so I thought I'd post my attempts. The problem can be experienced when a file name or path name has unicode characters (see screenshot). Unicode support is rather new to me and I am learning as I go. I think this mini-project may help others too. 23Apr07: Removed TLB requirement; no TLB used. 23Apr07: Found logic error. Assumed AddRef was being called by DispCallFunc but it was not; therefore, fixed error that would be calling Release when it shouldn't which could crash IDE.
Hooks END safe now, added Paul's CDECL class to project so we don't lose that one either. Continuing on where Paul Caton left off. Paul has moved on from VB and his thunks are too good to let die. The attached contains a complete revamping of his subclassing thunks and significant enhancements to other thunks. The subclassing thunks, I believe are now 100% IDE-safe. I have even placed END statements inside of the subclass procedure and IDE did not die. The usercontrol (UC) crashes occurring when subclassing parent by multiple UCs is now history too. See the top remarks in cSelfSubHookCallBk_Template for overview. The assembly code is provided in .ASM files and can be opened with notepad. 18Jul07: Minor tweak in subclass.asm to attempt crash on compiled app when END executed. 21Jul07: Believe hook thunks now 100% END safe, added CDECL class allowing one to call C++ APIs or ASM thunks. Workaround for making Hook thunks more END-safe is commented in remarks at top of Template class.
Win2K & above only. A simple example of using updatelayeredwindow (ULW) and setlayeredwindowattributes (SLWA) APIs to create a semi-transparent form capable of "hosting" controls. The word "hosting" is not correct. This example shows one way of creating a host form for controls and overlaying it on the semitransparent background. Kinda neat. I will be expanding this off and on as I go along. This is NOT a fully functional project, a demo for proof of concept only.
Updated, faster renderings. Based on of my c32bppDIB suite, supports pngs, xp/vista icons, and other common graphics. One control that supports multiple imagelists (same/different sizes). THIS IS NOT TRULY DESIGNED to be added uncompiled to a project, rather it is designed to be a stand-alone OCX. The property page is optional if you just need a runtime-only imagelist. 15Nov07:: Added optional image compression if GDI+/zLib not on O/S, added optional image key/tag compression, added multi-select browse, multi-file drag&drop, multi-file Copy&Paste abilities, added image re-ordering via dragging, added importing from VB imagelists, and fixed some minor bugs. 23Nov07: Masks were not kept with multi-selected files, added several more properties/methods, more examples. 3Dec07: Overhauled class structure, fixed minor errors with property page, added more to the RTF file. Barring bugs, moving on to something new. 8Jan08: Significantly faster rendering from the imagelist. GDI+ would process entire DIB at times to render one image. When imagelist is massive size, slow down noticable. Using a rendering-only DIB can improve drawing multiple images over 30x faster for large lists. Open with Group1.vbg. See Usage_ImageList.RTF file for overview.
Example using GDI+ to warp string paths. GDI+ has two warping options but one is buggy. The attached code is basically a revised c++ post found on codeguru and combined with other ideas. Limited to simple paths only, the class can be modified by you to include other things like shapes, images, etc. Must have GDI+ to run project. 17Jan08: Added more path functions, added another Warp mode (common skew), a few more examples, and minor stuff.
Updated:: Fixed mem leak save routine (oops); added minimal unicode support to sample form for playing & as promised, SaveAs Jpg/Png/Bmp capable. A project I wrote to learn more about GDI+ graphics paths. Think it can be useful for others who want to explore paths. I thought I was going to make this a full-blown WordArt-clone but have since lost interest. This project may be updated in the future, but it will remain low on my priorities. Graphic paths are fun to play with, but short of creating a Paint-like application or using paths to manipulated direction/speed of some animated object I can't find much use for them. Have fun playing with it. 26Mar08: Added ability to save a GDI+ path to JPG, Bitmap and/or PNG formats. 27Mar08: Found & fixed mem leak in save routine. In sample form, added some unicode support for playing.
Ability to use shapes for a focus "rectangle". The DrawFocusRect API only draws rectangles, but what if you want some other shape? Well, this example can show you how. Also included is an example on how to dictate the color of the rectangle drawn by DrawFocusRect API and also how to draw a custom focus rect in the XOR fashion. BTW I don't really like the quality of the shaped focus. Drawing every other pixel on a shape looks pretty poor in my opinion. Thought I could use this but, oh well. I offer it to you should you care to use it, modify it, or find a way to make it better. For shaped regions, maybe a blended/soft solid shape would serve better and certainly would look better. One thing I did learn, was how to create an XOR-like brush and use it to paint something & then remove the painted something; so not all is lost :)
Generic thunk class added. Using it will negate crash described below and can be used to start GDI+... GDI+ when not shut down properly can crash IDE (maybe XP only. See comments below on test results). For those of you that use unsafe subclassing while in IDE, this effect is very familiar. Read the article below and to test a crash, you can run the zipped project. I, and others, can replicate the crash every time on XP Pro. May be a DLL version issue, may be something else.
Another project using my c32bppDIB classes. This is a custom image list that supports alpha images and has one neat property that haven't seen before. This custom image list control can be made part of your custom usercontrol so you don't have to ship 2 different controls. Two sample projects are included in zip, so unzip with "Use Folders" checked. Some highlights: supports alpha images, mulitple image sizes, allows scaling when adding to imagelists, and many more. I am planning on using this for multiple custom controls in the near future. Still have some things that I want this to do or be compatible with. I am not completely done with this project but offer it to you for your suggestions and comments.
Use Windows to word break captions. Display text at zero, 90 & 270 degree rotations. Neat method of wordbreaking unicode text using Windows own wordbreaking algorithms vs trying to create your own. Added several properties to mimic DrawText to include clipping, accelerator keys, and more. Project nearly 100% complete. The API created unicode textbox is not subclassed, so it isn't controlled by the project, however, you can type and cut/copy/paste as needed. Next major addition will be a class version. Hmmm, a usercontrol-less, class-based unicode textbox would be a nice project ;)
I know this is not truly a programming article. But I wanted to thank all of PSC for your continuous and generous feedback. Even negative feedback is positive when taken as an opportunity to improve weaknesses.
Updated posted bad example in previous upload. For your personal use. A slightly different method of exporting/importing a ListView. When I said listview, I mean all that pertains to it: This includes listview properties, its column headers & their props, its listitems & their props, the listitems' subitems & their props, the imagelists bound to the listview and its props, each image in the imagelist and its props. Additionally, you can pick and choose portions of what will be exported/imported. Note. The previous upload example for importing the reportview example did not ask to include control formatting, it should have. My mistake. No change to the class.