Results for "Author: vesa piittinen"
Yes another control aimed for beginners (and why not for everyone else too!): include PictureView.ctl and cJpeg.cls to your project and you have a new nice picture viewing control you can use! *** You can view pictures easily in this control. It adds scrollbars when required, if not required centers the picture. With all the additional features of the control, you can easily create your own Paint program, for example. The control is able to save JPEG pictures thanks to John Korejwa's JPEG Encoder Class. You can define new picture to be created, get picture's DC so you can BitBlt or use any other GDI API to draw to the control... and much else :) *** Properties: borderstyle, cornerstyle, picture, scrollable. Functions: ClearPicture, NewPicture, OpenPicture, PictureDC, PictureHeight, PicturePaint, PictureWidth, SaveJPEG. Events: Click, DblClick, Key-events, Mouse-events, PicMouse-events, PictureLoaded *** Hope you like the control! This is the third public release of the control, first time at PSC. Comments, critics and improvements welcome! :)
The best progress bar on PSC: it's fast, it looks cool and it's stable. All you need when it comes to showing a progress. Includes: 1) colors and colorfades! 2) use any font, make it appears as you want 3) you can use seven different borderstyles 4) make the bar grow up, down, right or left 5) Blending (changes color opacity or CosSin mode makes weird colors!) 6) Set the caption just like you want it to be 7) ManualRefresh for optimal usage: if you change colors a lot or do other big changes at a time, you might want to refresh the bar only when you wish 8) Min, Max and Value as big or small as you want 9) You can change parent easily with SetParent 10) enough events: make it a command button as well! 11) clear, optimized code: learn how things can be done fast in VB. Also great example on how to make an ActiveX control with VB. If you like it, please vote & rate :)
Gradient label! And no, it's not the label's background that has the gradient: it's the text. This is just a control I spend some time with, I wanted a label that doesn't blink and which I could use for big headers. It can do word wrap, autosizing, gradient horizontally and vertically and it has Change and Resize events. The code is commented! Made with VB5CCE and the example program with VB6. Remove the Split function before compiling with VB6! Hope you like it.
A cool cave flying game engine. It's not complete, but it allows already quite much expanding with ease. Supports/includes: 1) random level generation 2) flying particles 3) gravity 4) objects (bullets and such) 5) explosions 6) destroyable terrain 7) automatic FPS control [it's not perfect, slow but works, tries to make the game playable even on an low end system] 8) gamepad/joystic support [in the future, this should help expanding multiplaying: ie. one uses keyboard, three players use USB gamepads] 9) original ship controlling [currently only one player] | My plans are to expand this engine so that it would be easy to create a full game. I'm also considering multiplaying over the internet, but that once I'm done with most of the other. And yes, better graphics would be nice :) | In the main module you can find all kinds of values you might want to edit. Try making the bullet bounce all around the terrain... :) [tip: set CollisionDie = False] | If you think you have something to offer to this little project, feel free to contact. I'm open to suggestions! I'm atleast thinking to add 1) computer players with AI 2) layered level 3) optimize performance [not to draw things not visible to the screen(s) etc.] | Reposted, instead of editing I managed to destroy the whole code. Expect updated and expanded version next month :)
This is a good collision detection that can be used in real time action games. Many, many game developers might find this one useful. I also included gravity and pressure (which you can disable). Enjoy. I'm making a better version of this to my Underground game which source code I'm going to update soon.
You probably have had a need for a unicode label sometime. And maybe need for a label that doesn't blink all the time. I made this usercontrol so you can easily without any hacks have unicode text in your programs. Just include the usercontrol in your project and you're ready to go with it. *** Features: unicode capability under NT4/2000/XP, all the events and properties the default VB label has, autoredraw to enabled/disable blinking. The code is fully commented and being a rather simple control, it should be easy to learn how to make usercontrols. One API call is also introduced. *** Comments and votes welcome - the more interest, the more likely I'm to do more FREE unicode controls :)
This is a new cool progress bar control. I've been doing it two days, based partly on my previos progress bar (I submitted it now already as I'm doing my military service and are therefore limited in time). Though this one is different by looks and is also improved by speed. At the moment the control is not complete, there are properties that are not yet finished. Despite this fact, the control does work. I wish you like that control and that it's customizable :) You can change borders' style, all the colors (15 different), direction (right, up, left, down), set text on it, custom done text and so on.
Second unicode control in the series, UniCommand is just as easy as an usercontrol can be: add .ctl to your project and you're ready to use it! *** Supports unicode under NT4/2000/XP and works under 9X series. You can choose from various borderstyles, define if the focus rectangle is shown and have all the neat functionality from the UniLabel as well! I made it work very much like VB's default command button. You are free to code the control further and repost it here! (possible additions could be solid one color border, Office XP style, graphics, caption padding, checkbox/option mode, Windows XP style...) *** Hope the control fits your needs. And again, the more interest, the more likely I'm to do more free unicode controls! :)
This code seeks from the end of a byte array trying to find a matching text. Why? Well, handling byte arrays is much faster than handling strings. So, if you needed to parse data real fast and a lot, it would be benefical to do it using a byte array instead of a string. My starting point to this was rather simple: do the search faster than InStr and InStrRev. Beating the latter was easy: InStrRev isn't of the fastest build-in functions in VB. With InStr I had to taste half of a defeat: it just is superb when it can search in BinaryCompare. But, what if we wanted to do TextCompare? Well, there InBArr and InBArrRev beat real badly both InStr and InStrRev! Anyways, I hope somebody finds this submission helpful. I'm sorry I didn't comment the code as well as I could/should have, but I hope it doesn't matter as the code should be rather flawless on what it does :) Comments and votes welcome, as always!
The main purpose of this code is to show an extremely fast method for displaying graphics. The progress bar is done as an OCX, which displays an 8-bit image done in to a byte array which is then made an API image and BitBlt'd to the custom control. It is about as fast you can get. The project includes a string.tlb Type Library which has an assembly optimized CopyMemory API replacement (I hope these are allowed here, if not, look for VBSpeed @ Google). The code is fairly commented and should be easy to follow, even as it uses some advanced techniques. It is very fast and it gets even faster when you compile the code! Hope you like it and find it useful for learning :)
This is the coolest Progress Bar control you have seen out there. Includes many nice features. Can do colorfading, text scrolling, borderstyles, can be set vertical...anything you can think of. Besides that, the code is very efficient and fast. A good example on how an ActiveX / OCX is made and what it needs.
A simple demo on how to 1) add many icons to the systray 2) scroll a custom text in the icons. From this example you can learn how to place icon to systray, learn how to use API (BitBlt used), how to convert a graphic to an icon, how to show a properly working popup menu in the systray icon and some other little coding tricks. The code is not optimized for speed, but is fully commented for your reading and learning pleasure. You are free to use this code in your programs and you don't need to mention my name anywhere (though it'd be great if you credited me or my site in your documentation). Vote if you feel so :)
An IRC client I'm making for my own use. At the moment supports IRC protocol near 100%, is fairly stable even though there are bugs to be resolved and includes most of the basic functions required for use. Supports multiple servers & channels with perform & autojoining. Main feature is to create it as easy to use as possible. I'm looking for any additional help people could provide, I really need proof-reading of the code and bug testing, with additional suggestions - any help will do. You can contact me through my site merri.net or at VBForums Project Request area. You are free to use the base IRC core in your own program, but you must create the looks completely by yourself. The code is free for use, the design is not. I don't want to see any cheap copies out there ;) Thanks to anyone who is willing to help!
This is quite a rare need, but here is a very fast solution for finding out whether there is a duplicate of any specific character within a string. Some people use InStr or InStrB as a solution for finding out a character duplicate, but the drawback is that InStr gets slow very fast if the first few characters are not duplicate characters. Also, if there are no duplicates then InStr loops the whole string the amount of length of the string, which can mean hundreds of times at worst case scenarios. The project provides two functions: HasDuplicates and HasDuplicatesM, the latter is class wrapped. The first one is a straightforward InStrB version. The second uses bitmasking in a Long array as well as safe array tricks to get Integer array access to the characters of the given string. Both functions return a character position of the first duplicate they find, however the results between the functions are always different, because InStrB version returns the first character while the safe array version returns the duplicate. InStrB version can be changed to work the same way. This code was requested at VBForums, I don't know why, but I made it anyway. The code should have enough comments for people to learn some advanced VB6 memory tricks.
I've seen many ways to check whether a certain control index exists in a control array, where all indexes are not filled. For example, you could have a control array of labels with indexes 0, 1 & 3. I guess one of the most common ways to check for this is to use On Error, but I've always found resorting to rising errors a bad habit to do. A much better another alternative is to loop through the control array using For Each and check for the Index property, but even this becomes a bit silly if you know the index you want to check for and loop the entire control array just to check if it is there or not. The solution: VarType() VarType returns the variable type of default property of a control, ie. VarType(MyLabels(1)) returns 8 (vbString), from Caption property. What makes this usable for sniffing for valid index is that VarType returns 9 (vbObject) for invalid indexes! There is no control that returns an object in their default property, making this a perfectly safe method to check if an index exists or not.
These functions convert hex strings from/to byte arrays. A quick introduction to each: HexStringToBytes_A1: one of the most common ways to turn hex string to byte string using "&H" string conversion to a byte value. HexStringToBytes_A2: an optimized version of A1, grabs bigger values in one go and reduces amount of strings created. HexStringToBytes_A1: fills byte array using AscW & MidB$ HexStringToBytes_A2: same as before, but uses the passed string as a buffer instead just for comparison. Slower as creates more strings than A1. HexStringToBytes_C1: uses Windows CryptStringToBinary API. HexStringToBytes_S1: uses a lot of advanced VB6 tricks to achieve the greatest speed. API just can't compete with this one. HexStringToBytes_F1: uses advanced VB6 tricks like last one, but allows for any formatting in the passed hex string (such as spaces, line changes or anything else – simply looks for any valid hex pairs it can find). Shortly put: the C1 and F1 functions can parse "41 00 42 00 43 00", with formatting. The others only accept "410042004300", no formatting. Those hex strings would convert into a byte array: B(0) = 65 B(1) = 0 B(2) = 66 B(3) = 0 B(4) = 67 B(5) = 0 Or "ABC" as a string (Dim S As String: S = B). There are also functions working the other way around, BytesToHexString_C1 & BytesToHexString_F1. C1 is a version using CryptBinaryToString API while F1 is an optimized function that allows for custom output formatting! You can have any kind of formatting: none at all, just spaces between each hex pair, HTML, XML, C notation, JSON... use your imagination. Not only that, the F1 version is way faster than the C1 version with the exact same output! The following tricks are generally used for speed in the S1 and F1 functions: Safe arrays: VB6 stores arrays internally as safe arrays. The function creates "fake" Long and Integer arrays. Integer array for accessing the string data (1 character = 2 bytes = Integer) and a Long array for memory manipulation (PutMem4 & GetMem4 replacement) as well as saving the decoded hex string to the byte array. SysAllocStringByteLen: this API creates a BSTR and it does that very fast, especially if pointer is set to 0, in which case you get any free point from memory. That memory is not touched in any way except for setting up the minimal BSTR structure information (4 bytes string length & 2 bytes null terminator). This memory is not given to a string however! Instead it is given to the resulting Byte array. Why? It saves an unnecessary step of nullifying all the bytes that are reserved, and this always happens if you just ReDim an array. Long is the fastest datatype in VB6 in current processors. This is why a Long array is used to store the new bytes into the Byte array instead of just using it directly. Summa summarum: these functions should give good knowledge for anyone who wants to understand how memory can be handled so that you achieve better performance code in VB6. It isn't pretty though.
There is a problem with most of the CSV parsers/readers out there: they do not follow RFC4180. Most handle quotes and comma delimiters properly, but can't handle line changes within quotes. Additionally most of the codes are on the slow side, practically dying if you happen to have a CSV file that goes a few megabytes in size. This procedure is somewhat optimized for speed so a few megabytes is a no-issue. Detailed information at http://www.vbforums.com/showthread.php?t=604031
This is a self-contained timer class module. This means there is only one class module required, thus no external module file. This has been achieved by adapting SelfCallback code by Paul Caton and LaVolpe, but this time around I've simplified the code as the requirements in this kind of a class are minimal. Thus the code is much shorter and may give a better picture for some people on what is required for SelfCallback. Naturally the timer is IDE safe so you can hit pause and stop without a worry of crashing. **** Update 1.1: the code is now shorter and faster, code adapter from Paul's Universal DLL Caller. Now all code of interest is in Private_Start and Private_Stop.
Unicode textbox and listbox. On these controls I've attempted to mimic the behavior and features of the native controls, but also give much more power by implementing much more of the native features provided by the Windows API. Despite the focus being on implementing Unicode aware versions of the native controls, you can find much more power than just the Unicode. **** These Release Candidates are released outside the main UniControls release for bug testing and comments - thus I'd like to hear of any problems or oddness you may encounter with the controls so that I can fix them before compiling the main UniControls release (thus the next UniControls release is to be considered stable). **** UniControls main release: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=69738&lngWId=1
This is the coolest Progress Bar control you have seen out there. Includes many nice features. Can do colorfading, text scrolling, borderstyles, can be set vertical...anything you can think of. Besides that, the code is very efficient and fast. A good example on how an ActiveX / OCX is made and what it needs.