Results for "Author: lavolpe"
Repost with Search Function> Just a cheat-sheet of sorts. Over 200 windows messages with their values and brief descriptions. Add it to your toolbox for referencing when subclassing forms, hooking, etc. Not much of a project but should be useful. Feel free to use & abuse as desired. :)
AI pathfinder for large maps - 2nd try. This is a unique approach and is fastest version I have to date. Submitted for your suggestions & feedback. Well commented. If anyone has seen an approach like this, please let me know. I would like to compare distance & heuristic calculations. Unlike most pathfinders, this one does not require fixed objects and can be used for quickly plotting paths btwn moving objects. For those of you that have personally requested to be updated on improvements to this code, I have sent you a personal copy. For all others, I have re-posted this project simply because the update produces a significantly faster result & is far more accurate to providing a shorter path. I'm sure this project can be tweaked to provide even faster results, but keep in mind the trade-off between speed and overtasking memory resources. Updated again for to allow user-defined accuracy and speed (use the AccuracyPct variable in routine: CreatePaths) 1 Feb 20:10 CST -- Now can find shortest path 100% of time & quickly.
A way to share memory fonts between dozens of DCs without creating duplicate fonts for each DC & without forcing you to track them. Just drop the included module in your project, add 2 lines to your custom controls: 1 to return a font handle & another to delete the font. Sample project included and code is commented. The idea is simple, want to create a font but don't want to duplicate it if one is already created, the module will check fonts it is managing against the properties of the font you want created. If it exists, the handle to the existing font is returned, otherwise a new font is created with the appropriate properties & that handle is passed. Destroying fonts are only performed when all instances of the font have been decremented to zero. Advanced category only due to the unique tracking system I employed.
Rotating captions are hard but doable. Keeping track of an accelerator key is complicated. This example has portable routines to rotate captions at 90 or 270 degrees & properly display the underscore on the hot key. In addition, you dictate where text is displayed by passing the bounding parameters. This will be used for a soon-2b-released vertical version of my buttons, so if you see errors, please let me know. Thanx.
Example how to rotate transparent icons & keep transparency. This sample project goes further by allowing creation of transparent icons from non-icon resources. My take: Making 1 icon is better than calling transparent bitmap routines 100's of times. Another mini-project for the soon-2b-released vertical version of my buttons.
A compilation of region functions & examples. Included is probably the fastest window shaping routine on PSC. Regions used to create shaped windows, regions used for simple animation, rotating & stretching regions, and using regions similar to FloodFill are examples shown. All are heavily commented to assist in learning.
Contribution to Julien Lecomte's post. AI path finder now goes diagonally too, less memory intensive. All credit goes to original author; if you wish to comment on the diagonal path routine, please do; otherwise any voting should go to the original author at www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=31654&lngWId=1
Another contribution to existing code. Very quickly sort a two-dimensional array containing any amount of members (ex: vArray(5,1000) by simply identifying the member of the array to sort on. This routine has links to the original authors' posts in the source. My only contribution was to tweak for use in more than a 1-dimensional & 2-dimensional/2-member arrays. Please no voting on this one; 99% of it is the work of other coders. PS. Revised by switching the array elements around properly,i.e, from vArray(1000,5) to vArray(5,1000). Revised once again (21 Nov) to offer fast search on sorted array & to properly handle non-zero based arrays.
Do you need to draw a large gradient area during window resizing? The slowness! Maybe an answer is to draw faster in poorer quality then when done sizing (i.e., Button Up), redraw in fine quality. The attached sample, if nothing else, is a good routine for drawing gradients between 2 colors. The extra code in the routines allows user-supplied quality values which when used with the example can show a dramatic decrease in the number of loop iterations required to draw in the different qualities/roughness. RePosted: Reworked calcs to account for the uneven left/right edges of thick lines.
A sneaky way to have your program pause for a window to close (Modal) without disabling your project (non-Modal). Uses subclassing & hooks with 0% cpu usage. So the Do:DoEvents:Loop not used which hogs 95% CPU time. Can be used for all-API windows or standard VB windows. Heavily commented too.
Part 1. Prequel to a full-blown skinning application. This part does not skin but attempts to completely control the window non-client area. Provided in hopes you will help identify any bugs on different O/Ss. Works well on 98/2K. The other parts of this project will be submitted after bugs fixed in this part and feedback has been addressed. Part 2 will be skinned version compatible with MDIs, Part 3 will include routines for custom-drawn menus. Heavily subclassed and heavily commented; but still a work in progress. Feedback is definitely requested especially pertaining to bugs and suggestions.
While back I posted something like: 2 new borders for your picture boxes. Well how about 13 more? Trying to get a handle on the pixel measurement of borders, I was sometimes off by a pixel & couldn't figure out why. You know 1+3 should = 4, but interesting 'nuf thickframe(3)+staticedge(1)=2 and not 4. Anyway, if you wanted to know...
A tile blt'er with some added options. Out performs against CreatePatternBrush & may out perform most on PSC. Options include staggered alternating rows, tile over image, & can use transparent gifs, icons & cursors.
It appears this VB function can easily replace APIs like BitBlt, StretchBlt, DrawIconEx and others. So how do you use this function that no one seems to use? Included are a few ideas and "how to's". Hoping others more knowledgeable will add positive comments so others can learn too. Zip updated to include sample of portion Rendering. No BitBlt API used at all in examples.
Create a cool 3D shape from a 2D region. See screenshot which pretty much says it all. The direction of the 3D shape is hardcoded at 45deg angles. If you choose, you can modify to allow any angle. Updated to include sample of blt'ing an image over the plain shape.
How do you change the icon that appears in the Alt+Tab window? This is nothing new can be found on MSDN. The notes I added here are of interest. More info for skinning forms. Changing a form's icon doesn't affect the Alt+Tab window; you need to change the icon in an upper level, hidden window. Code below shows how. Notes to keep in mind.... The icon does NOT have to be one assigned to a form! If not, the only thing to remember is to cache that icon handle and don't destroy it until your application closes or you reassign using the same code below. Should you not cache the icon, and it is destroyed, the Alt+Tab will show a "blank/invisible" icon instead.
Asked how I might make a transparent frame or picture box? After a moment of wondering why, I realized that was a neat idea & one solution provided; there are more but this doesn't use custom controls. Would give credit to the person for the idea, but when he commented it was by a "No-Namer". Idea isn't mine; just the routines.
Don't have API Viewer freeware program? Don't bother downloading this. However, should you need or want to parse the API Viewer apv files from your code, a module is included in the zip. The parsing engine is fast & pretty well designed. The included interface to show a way of using the engine is not finished & no plans on finishing it. Required: API Viewer *.apv files (not included in zip)
Not your ordinary GIF viewer. Recognizes encoded animation loops, allows you to modify settings on the fly. With little effort, you can make the control appear transparent (screenshot), force transparency on non-transparent GIFs, skip frames, shift frames & a host of other options. A little unique in the fact that it does not use arrays of pictures, nor does it write the frames to a file. Putting this one on the backshelf for a couple months unless someone finds a serious bug or proposes a super idea/suggestion for improvement. Download the included GIFs into the same folder. You can get rid of them later, but project won't run without them. Last Updated: 11 Apr/14:35. Added cropping option to control & 2 more examples on the Test project. Tweaked ShowFrame routine. 12 Apr/10:40 Tweaked GetCustomBkgDC so users don't need to remember to stop animation b4 updating custom background to avoid leaks. Added BorderWidth & BorderHeight read only properties.
A usercontrol that mimics the selection/sizing tool like VB & MS Paint. It is a little unique, is flexible, and works well. Developed for a skinning engine I'm creating. I think it is pretty much done & offer it to you to play with. Read the remarks please. It isn't that big of a project.