Results for "Author: clint lafever"
Just some VB Tech Tips, nothing fancy, but informative.
Ok, in my last posting, once again, somebody requested another article, this time on how to make a DLL. so.... here it is. I hope it fairs well with all.
A little while ago somebody posted a listview that will automatically display a file listing for you. I thought this was a good idea and downloaded it. While it was nice, it had some bugs. Instead of just fixing that code, today I decided to make one myself. 90% of it was made simply using the Active X Control Wizard. I then added some code to read the icons for the files to dispaly in the ListView and few other tweaks to what the wizard made. In the end I have this control for you. While it is functional and easy to understand, you may wish to add/alter the code a bit to make it a bit more robust for all needs. Have fun with it. Simply set the Path property to a full path you wish to display files of and presto. On ItemClick or DblClick you can check and read the ItemType property to determine if the user clicked or double clicked on a Folder or a File ListItem and perform the logic you desire.
Just wanted to stab at this contest...I know a lot more can be added to this to make it more...complex yet fun...but I am at work and this is what I could through together during lunch. This program will just tell you the number of times the program was ran by using a custom control to access a ASP page on an external website which connects to a database to read the hit count then the ASP formats the results in INI format then the custom control saves that dowloaded ASP page to an INI file on the users hard drive then uses simple API calls tor read the value and display it. Just wanted to start of the contest with a little something that uses the web as well. BTW: The custom control code is included since I know you are not supposed to upload OCX's. The control was made by me and you can find a compiled version at http://lafever.iscool.net if you like it.
Example code that will show how you can use the custom section (and LoadResData) of the resource file to store misc. files into your executable. Along with that, if one of the files is a .WAV file, to play it directly from the resource file without extracting it. Other parts of the code will show how you can embed JPG files into the resource file instead of .BMP files and use those files for your images in your program. This will help lower the size of your program if you love to use images in your program. Using the same code it will also show how you can extract out files to the users hard drive that were put in the resource file. A good usage of this is lets say you have a DB application and would like to give the ability to make a new DB file, but you want to make sure the DB has the write structure and filled with default data. Just embed your DB file into the resource and extract it out to a new file when the user wants a new file. I know a few days ago somebody else posted code similar, but I had this up here on PSC a long time ago (been removed since) and thought that since resource files can provide so much, it would be a good idea to post again for those who missed the other authors post. KEYWORDS: WAVE WAV RESOURCE LOADRESDATA CUSTOM SOUND PLAY EMBED SNDPLAYSOUND SND_ASYNC SND_LOOP
From time to time I write some little application or game for me and my co-workers to use and in the program I am using some new control I made or downloaded. I already know they have the VB runtimes so I dont really feel like making an install for them so I just embed the OCX into the EXE using the resource file, then on the program start up it checks for the files existance. If it cannot find it [like on the first time] it will extract the OCX from the EXE to their hard drive and register it. Then it will open the form(s) that use it. This project shows how I do it. While I would never do this in a professional application, some of you may like this. However, I know this code can show some of you malicious programmers out there how to embed a virus or something like that. I had to think long and hard before I shared this. It is not all that advanced and if you are any good you would of figured out this on your own. So I decided there are enough legitimate reasons that others may like this code so I posted it. Please everyone who is responsible...please get a Project Scanner to scan source code projects for code like this (like the one listed here on PSC or mine at http://vbasic.iscool.net )
The demo will show you how to use ADO to connect to a database hosted on a web server. From there all standard uses of ADO recordsets and what not are possible. I see this question asked a lot in newsgroups so I thought I would share this code here to to help refer them to a working example. Note, the web server has to be a server you have rights to and not just some free web hoster like GeoCities so don't get too excited if you thought that is what this was. This demo will connect to my web server and read data from the NorthWind database found in SQL Server. Also note, my web server cannot handle a lot of traffic so depending on how many people download this and try it, you may have some slow responses or errors on connection. Sorry, but this is just a demo. This code is really not advanced, but many people do not know you can use ADO like this so I just wanted a demo up to point people to later on. Hope it helps some. KEYWORDS: REMOTE DB DATABASE ADO RECORDSET WEB SERVER WEBSERVER CONNECTION SQL IIS
I posted this code yesterday but I had comments on it and emails sent directly to me from my web site asking how to use it. Guess that is the problem when you only post the sub routine. So, here is the code again, but this time with a demo project. This uses the API to simulate the minimize effect you see of a form shrinking to the taskbar, but with this code you can shrink it to any place you want, like itself to show it imploding, or the tray, or to the mouse. KEYWORDS: FORM ANIMATION DRAWANIMATEDRECTS FOLD IMPLODE MOUSE TASKBAR EFFECT EFFECTS
Small program made to remember all those who lost their lives on Sept. 11, 2001. For all those who have never taken the time to look at the complete list of names of those who died on that day, this program will show you the magnitude of people killed on that day. I got the list of names from http://www.washingtonpost.com/wp-adv/marketing/911/front.html and apologize in advance if anybody out there finds that a name is missing. God Bless America.
This is very beginner stuff. Today I needed some graph paper but could not find any in the office so I very quickly just slapped this together to make some. There really is nothing fancy in here other than some sample code of how to use the Line method which is very VERY basic. Not really expecting any votes but just thought I would share it in case anybody else out there needs some graph paper or wants to use this for something more advanced. KEYWORDS: LINE METHOD, GRAPH PAPER. ADDED NOTES: Since I have had a comment about it, this code also does include a class module that can be reused as is in any other application that will allow the developer to call the common dialog control WITHOUT having to have a reference to the control or have to have a form for it. The class module will just use what ever version is available on the system thus you do not have to include the common dialog in an install. Just thought I would add that since some may not download this because they do not care about graph paper.
I am a guy who still loves the tradition of putting easter eggs in programs. I know some think they are a waste of code but hey, they are a fun way of letting a developer personalize his work. The form in this demo is just a fun example of one that I added to one of my projects. I just thought I would share something simple like this. Maybe it will give some others some insiration to make other egg type forms. I always likes to keep it simple myself. If too much is done in an egg, you may bring bugs or extra undue size to your product. This demo will also show how to play a WAV in a LOOP from the resource file (even though there are tons of examples of that here). KEYWORDS: EASTER EGG WAVE RESOURCE LOADRESDATA RES SOUND WAV
A user in a newsgroup was asking how they can get the effect of fading out a control on a form. They knew how to fade a form (as I think we all do by all the transparent demo projects on this site). The poster however just wanted to fade out a control on a given form and have it fade away to nothing. So, I put this project together real quick as a starting point for him/her to see one way it could be done. I will tell you now, it is really just fancy API work to move the control off the form to another and fading that new form but it gives the effect the poster was asking for. Just thought I would share for everyone else here and to give him/her a link of where to come and see the code. KEYWORDS: TRANSPARENT, FADE, SETWINDOWLONG, SETLAYEREDWINDOWATTRIBUTES
This code will not change the world, nor will it impress many. Just made it for fun real quick. Uses an old class module I have for doing screen captures and also demostrates how to play a WAV file from the custom resource section of a resource file. Just wanted something to have handy to break the screen if/when I get mad at some code. KEYWORDS: CAPTURE, WAV, JOKE, FUN, LOADRESDATA, RESOURCE.
My wife asked me if I could make her a simple calendar maker real quick. She really just wanted blank calendars to let the children, at the school she helps out at, to color in. So I made this for her (with the ability to add images instead of being blank). It was written pretty quick and only tested on my home PC since she was going to be using it there, so there may be bugs. I just thought I would share some of my code once again here since this is not a product I will be taking much further. Some ideas to add if others wanted to is better scaling of the image in the top half, a database (or data file) of holidays to add to the calendar when it is rendered, color and font options. If anyone does add more to it, please share back on PSC. KEYWORDS: LINE, CALENDAR, PRINTER, COMMON DIALOG
Using a very basic method of moving forms around, this code will create a shadow effect to any window that currently has focus. Browser windows, Message Boxes, everything. The method is very basic. A loop just runs getting the hWnd of the window that has focus, if it is not maximized or minimized and is visible, it puts shadow forms to the right and bottom of that window and using some generic (over used) transparent code, those shadow forms are made transparent. See the screen shot of how Notepad now has a shadow on it. The shadow follows the form and for the most part, is not a bad effect. Yes more coding needs to be done for special cases and to stop some flicker now and then depending on how busy the machine is. Also the ability to through it down to the system tray (I have gotten into a habit of using a control (OCX) I made for doing that so I did not add that code here since I knew I was posting this). Anyhow, have fun, play with it if you like and make it better. If you do, I would love to see it get posted. Perhaps giving options for shadow size and color (hint).
This is my first time posting to the ASP section here at PSC. I just wrote this for a requirement on one of my projects and thought I would share. I did look and see there are already other Encryption posts, but hey, thought one more would be ok. Very simple and short code to encrypt/decrypt a string. Main requirement for this was we just wanted it so a person would not see a records SSN value in the URL. It is a closed Intranet site but we just wanted to be kind and not just have SSN numbers up on screens and printed pages. Hope it helps somebody. This is actually just some VB code I had from long long ago and just ported over to ASP for the first time. Was happy to see it worked.
Just wanted to stab at this contest...I know a lot more can be added to this to make it more...complex yet fun...but I am at work and this is what I could through together during lunch. This program will just tell you the number of times the program was ran by using a custom control to access a ASP page on an external website which connects to a database to read the hit count then the ASP formats the results in INI format then the custom control saves that dowloaded ASP page to an INI file on the users hard drive then uses simple API calls tor read the value and display it. Just wanted to start of the contest with a little something that uses the web as well. BTW: The custom control code is included since I know you are not supposed to upload OCX's. The control was made by me and you can find a compiled version at http://lafever.iscool.net if you like it.
I posted this code yesterday but I had comments on it and emails sent directly to me from my web site asking how to use it. Guess that is the problem when you only post the sub routine. So, here is the code again, but this time with a demo project. This uses the API to simulate the minimize effect you see of a form shrinking to the taskbar, but with this code you can shrink it to any place you want, like itself to show it imploding, or the tray, or to the mouse. KEYWORDS: FORM ANIMATION DRAWANIMATEDRECTS FOLD IMPLODE MOUSE TASKBAR EFFECT EFFECTS
The demo will show you how to use ADO to connect to a database hosted on a web server. From there all standard uses of ADO recordsets and what not are possible. I see this question asked a lot in newsgroups so I thought I would share this code here to to help refer them to a working example. Note, the web server has to be a server you have rights to and not just some free web hoster like GeoCities so don't get too excited if you thought that is what this was. This demo will connect to my web server and read data from the NorthWind database found in SQL Server. Also note, my web server cannot handle a lot of traffic so depending on how many people download this and try it, you may have some slow responses or errors on connection. Sorry, but this is just a demo. This code is really not advanced, but many people do not know you can use ADO like this so I just wanted a demo up to point people to later on. Hope it helps some. KEYWORDS: REMOTE DB DATABASE ADO RECORDSET WEB SERVER WEBSERVER CONNECTION SQL IIS
Example code that will show how you can use the custom section (and LoadResData) of the resource file to store misc. files into your executable. Along with that, if one of the files is a .WAV file, to play it directly from the resource file without extracting it. Other parts of the code will show how you can embed JPG files into the resource file instead of .BMP files and use those files for your images in your program. This will help lower the size of your program if you love to use images in your program. Using the same code it will also show how you can extract out files to the users hard drive that were put in the resource file. A good usage of this is lets say you have a DB application and would like to give the ability to make a new DB file, but you want to make sure the DB has the write structure and filled with default data. Just embed your DB file into the resource and extract it out to a new file when the user wants a new file. I know a few days ago somebody else posted code similar, but I had this up here on PSC a long time ago (been removed since) and thought that since resource files can provide so much, it would be a good idea to post again for those who missed the other authors post. KEYWORDS: WAVE WAV RESOURCE LOADRESDATA CUSTOM SOUND PLAY EMBED SNDPLAYSOUND SND_ASYNC SND_LOOP