February 21, 2002

Create a Touch utility

The SetCreationTime, SetLastWriteTime, and SetLastAccessTime methods of the System.IO.Directory class let you modify the date attributes of a file or directory: ‘ Change the access date- and time of all files in C:DOCS.For Each fname In Directory.GetFiles(“c:docs”) File.SetLastAccessTime(fname, Date.Now)Next The SetCreationTime can easily create a “touch” utility that modifies the

Internationalize Your ASP.NET Applications

Ollie Cornes has been working with the Internet and the Microsoft platform since the early 90’s. His roles have included programming, technical authoring, writing, project management. He has co-written several .NET books for Wrox Press including “Beginning ASP.NET With C#” and “Professional C#” and has worked on Internet projects with

Accessing Data Members in a Multithreaded Application

To ensure that only a single thread accesses a data member of an object, declare that member private. Next, add the necessary synchronization operations (e.g., a call to EnterCriticalSection()) in the “getter” and “setter” member functions before actually accessing that member. Finally release the lock (e.g., by calling LeaveCriticalSection()) before

The std::unexpected() Function

The Standard Library defines a function called std::unexpected() which is invoked when a function throws an exception not listed in its exception specification. std::unexpected invokes a user-defined function that was registered by std::set_unexpected. If the user hasn’t registered such a function, unexpected() will invoke std::terminate(), which in turn calls abort()

Registering a Function with std::set_unexpected

set_unexpected() takes a pointer to a user-defined function of the following type: typedef void (*handler)(); Use set_unexpected() to register a user-defined routine that will be invoked when a function throws an exception not listed in its exception specification, use set_unexpected(). For example: #include void my_handler() // will be called instead

Include Templates

Unlike ordinary classes and functions, which you declare in a header file and define in a separate .cpp file, a template

Limit Users Typing in Combo Box

The standard textbox has a MaxChars property that lets you limit the number of characters a user can type into it. The drop-down combo does not, but you can emulate this property setting with a simple API call: Private Declare Function SendMessage Lib _”user32″ Alias “SendMessageA” (ByVal hWnd _As Long,

Design Extended Multiselect Listboxes

When you design a database in Access 2000, the most intuitive way or your users to look at the data they want might be to let them use xtended multiselect listboxes to pick their information. Here

No more posts to show