Results for "Category: Files/ File Controls/ Input/ Output"
A Memory Mapped File resides in virtual memory from the moment it is opened until it is closed. This makes access to it very fast, in fact read and write merely consist of data moves in memory. All parts of the file are accessible by means of a zero based offset and the length of the data chunks you can transfer is only limited by the file size itself. The system will swap out and in pages of virtual memory as necessary. Only when you close the file the data are "lazily" written to disc, and the Physical Write Operations are limited to the altered memory pages. When you open an MMF you are required to supply an estimate of how large the file is gonna be. Any reasonable estimate will be fine, however, you cannot exceed this estimate, ie you can't extend a file while it is open, but you can truncate the file size to the actual size used when you close it. You can extend an existing file by giving the appropriate estimate when you open it and truncating it to the larger size when closing. MMFs are byte oriented and that requires a bit of understanding the data types which VB uses and how they are represented physically. The class contains tools however to handle the different aspects.
Demonstrates the use of a property bag to store "things" in a file in any order and to retrieve those things from that file in any order. "Things" include strings, numerics, results of arithmetic or string operations, booleans, fonts and even pictures.
This is a compact code that changes the date of an at the moment hard coded file to the time at the moment.
With this code you can copy all files within a directory with a particular extension to another directory. Actually it will give you a progressive listing of a file with a wildcard and then you can do whatever you want with the file. Extremely simple and straightforward. I dont understand why the other codes are so huge. If you find an error or if you would like to comment please leave a messge.
Stripped code from Dana Seaman's FolderView project. I stripped the project so that the result was only the code that enumerated compressed files. With this code you can view the contents of compressed files (zip, cab, rar, and ace). Note that this code does not compress or uncompress files, it simply enumerates the contents of the compressed files. Also works with shared files over a network. Dana 's original code is at: http://www.planet-source-code.com/xq/ASP/txtCodeId.23292/lngWId.1/qx/vb/scripts/ShowCode.htm All of the code here is Dana's except for the minor stuff like the "Dump to Text File" subroutine and the browsing function. You will notice that there are alot of variables that have been commented out. Those are just the byproducts of the original and bigger project. They were not needed for the compressed file enumeration but i left them in the code. I want to personally thank Dana for such good work.
Gets the correct value for file sizes when the file is large (> ~2.1GB). Basically the file size function included in VB will give a wrong value when used on large files. The traditional way of getting the file size via API will also not work as detailed in the MS article http://support.microsoft.com/default.aspx?scid=kb;en-us;185476. After a bit of research I ended up tweaking the API function to calculate the proper file size. To see the differences, browse to a large file. Let me know if there are any bugs or suggestions to improve performance.
Does anything you want to files in a directory and its subdirectories. For example, if you would like to add MP3's in a directory to a playlist in your MP3 player program, this would be handy for adding all of the files including those residing in subdirectories of that directory.
A program that batch renames files in a folder, based on Adobe Photoshop's batch renaming system.
This gives you the Windows 95+ directory listing with My Documents, Desktop, etc. Two projects are included in this zip, one that has the project as an executable, one that has it as an ActiveX usercontrol. Simple code, lots of comments. Please leave feedback and vote!
Simulates wait time (time unit is one loop iteration) of a queue much like a line at a bank. Uses a Que Class, Server List Class, Server Class, Timer Class and a driver (Simulate.cpp)
Creates all non-existing folders in a path. Local or network UNC path.
Networked drives. They're an administrative nightmare. In fact, the average user changes his networked drive letters more often than his underwear. But you can solve this problem of binding an application to a particular drive by using a Universal Naming Convention (UNC) path. This still references a network area, but doesn’t tie it to any one drive letter. And you can retrieve and check the UNC of a particular path in code using this neat little function. To use it, simply call GetUNCPath, passing it your drive letter along with a pre-declared empty string. If a problem occurs, the relevant number is passed back with the function. These can be matched with the possible return code constants. However if everything goes swimmingly, the function returns a zero (a constant value of NO_ERROR) and places the UNC path into the ByRef-passed variable. This code works by making a call to the WNetGetConnection function in MPR.DLL. It's essentially a neat wrapper for a regular API call.
This program will demonstrate how to capture the extra mouse buttons such as the mouse wheel and x buttons (the buttons on the side of the mouse). Mouse Hooking is employed so these the events can be captured independantly of the controls.
This VERY Simple 5 Line Code Writes To a INI File! Enjoy!
This code will create an internet shortcut on someone's computer. All you have to do it call it with a path and hyperlink!
This module will show how to use the printer object programmatically, in this case to print 3 part laser checks but anyone can use this on a laser printer with plain paper. I think it is about compact as it can be there are some variables that are not used yet. Notes on their purpose are documented. This shows how to use Printer.TextHeight and Printer.TextWidth for something useful. Please rate my code if you find it useful. ;)
With a small bit of coding, you can modify this app to suit your office server environment as a fully function FAX SERVER. You MUST be running WINDOWS 2000 / WINDOWS NT, as these are the only two OS's that have the FAX SERVER Object.
This is a fast way to write a resource to a file. UPDATE: You can find an example to this code here.
A little use of inspiration for a magnificent effect...
Need to create a temporary file for whatever? Include this bas module in your project and with one line of code the file will be created and the name returned to your program. Sample project included.