Advertisement

Results for "Volume: 1_2002"

1_2002 #103995
StopTextBoxFromBeeping

Show how to make a text box not beep but do something else when I hit the Enter key. This code example makes nothing happen, for an extended period of time:

1_2002 #111246
How to search a directory tree for files

The following code sample illustrates how to search from a given directory downward through the entire directory tree. The sample output from this example is directed to the system debug screen. For this example, the first class member (below) is called by a menu item. After the search is finished, a message box pops up. http://www.concentric.net/~cgalbrai/dirsrh.shtml

1_2002 #103996
AppOnTop

How do I get my application on top?To make your window truly topmost, use the SetWindowPos API call

1_2002 #103997
Changing Windows Printer w/o using priint dialog

How can I change the printer Windows uses in code without using the print common dialog? How can I change orientation? You can change the printer the VB 3.0 Printer object is pointing to programmatically (without using the common dialogs). Just use the WriteProfileString API call and rewrite the [WINDOWS], DEVICE entry in the WIN.INI file! VB will instantly use the new printer, when the next Printer.Print command is issued. If you get the old printer string before you rewrite it (GetProfileString API call), you can set it back after using a specific printer. This technique is especially useful, when you want to use a FAX printer driver: Select the FAX driver, send your fax by printing to it and switch back to the normal default printer.

1_2002 #103993
Launch file and associated program

How do I launch a file in its associated program? The Shell statement unfortunately only supports launching an EXE file directly. If you want to be able to launch, i.e. Microsoft Word by calling a .DOC file only, you can make your VB application launch the associated program with the document using the following method:

1_2002 #103994
Avoiding use of null

How do you avoid the "Invalid use of null" error when reading null values from a database?If you try to retrieve a null value (empty field) from a database, you will get the error: "Invalid use of Null". Here is one way to get around this problem: ..

1_2002 #111247
Create a toolbar/statusbar in a dialog

Create a toolbar/statusbar in a dialog. To add a control bar to a dialog, you must create the control bar as usual, and then make room for the control bar within the client area of the dialog. For the control bar to function properly, the dialog must duplicate some of the functionality of frame windows. If you want ON_UPDATE_COMMAND_UI handlers to work for the control bars, you also need to derive new control bar classes, and handle the WM_IDLEUPDATECMDUI message. If your dialog is not the main window of your application, you will also need to modify its parent frame window to pass the WM_IDLEUPDATECMDUI message on to the dialog's control bars. To make room for a control bar within the client area of the dialog, follow these steps in your dialog's OnInitDialog() function: http://stingsoft.com/mfc_faq/chapter6/chapter6_5.htm

1_2002 #104000
Passing a control array

Working with control arrays in VB3 was frustrating, but with VB4 you can pass a control array as an argument to a function. Simply specify the parameter type as Variant:

1_2002 #104001
Dragging a form by a control

This code is reusable and small enough to paste into whatever you're doing and instantly have a form that has no need for a title bar.

1_2002 #104002
Converting long file names

VB4's commands for dealing with file names (such as KILL, MKDIR, and FILECOPY) support long file names without programmer interaction. A number of the Win95 API functions will return only the short name, and you'll notice a number of short file name entries if you're digging through the registration database. Therefore, occasionally you'll need to convert a short file name into a long file name. This function lets you pass a long file name with no ill effects. The file must exist for the conversion to succeed. Because this routine uses Dir$ and "walks" the path name to do its work, it will not impress you with its speed:

1_2002 #103998
Cool screen wipes

You can achieve some cool form wipes with judicious use of the Move method. For example, to draw a curtain from right to left use this routine. It is also possible to wipe a form from bottom to top, and from both sides to the middle, using similar routines

1_2002 #103999
Determine when an app launches with SHELL is done

In VB3, you call GetModuleUsage() to determine when an app you started with the Shell command was complete. However, this call does not work correctly in the 32-bit arena of Windows NT and Windows 95. To overcome this obstacle, use a routine in both 16- and 32- bit environments that will tell you when a program has finished, even if it does not create a window. The IsInst() routine uses the TaskFirst and TaskNext functions defined in the TOOLHELP.DLL to see if the instance handle returned by the Shell function is still valid. When IsInst() returns False, the command has finished.

1_2002 #111248
Send a string to the clipboard

Without using OLE... Michael Pickens [email protected]

1_2002 #111251
Windows Screen Saver Password Decoder

Tells you the Windows screen saver password

1_2002 #111258
Access the NT Performance Counters

Ever wanted to write some code to determine the amount of bytes sent or received by Dial-Up Networking, what is the current CPU Usage or how many threads are currently running on the system?. The classes provided allow you do query any of these parameters, or to query the availability of performance objects and their counters both on the local machine and any machine on the network. Please note that since 95/98 has its own version of performance counters which are incompatible with the NT versions, these classes will not work on 95/98. If you want classes to work with 95/98, have a look at the DynData classes which I have developed.

1_2002 #111259
MFC class to support the SMTP protocol

Welcome to CSMTPConnection, a freeware MFC class to support the SMTP protocol. SMTP for those not familiar with all the internet protocols is the protocol used to send internet email. For detailed information about the Simple Mail Transfer Protocol you should read RFC 821, You can find numerous servers which carry these documents by going to www.yahoo.com and look for RFC and 821 and/or 2045. Features Simple and clean C++ interface. The interface provided is synchronous which provides an easier programming model than using asynchronous sockets. The code does not rely on the MFC socket classes. These classes have a number of shortcomings, one of which causes problems when they are used in NT services. The code can be used in a console application without any problems (Again this is not the case for the MFC socket classes). A configurable timeout for the connection can be set through the class API. The classes are fully Unicode compliant and include Unicode built options in the workspace file. As of v1.1, the classes now fully supports file attachments. Full support is included for CC (Carbon Copy) & BCC (Blind Carbon Copy). PJ Naughter at http://indigo.ie/~pjn/index.html

1_2002 #111260
Class to encapsulate the PING protocol

MFC class to support the PING/ICMP protocol. ICMP for those not familiar with all the internet protocols is the protocol used to retrieve information about how IP packets are routed. Features Simple and clean C++ interface. The interface provided is synchronous which provides an easier programming model than using asynchronous sockets. A configurable timeout for the connection can be set through the class API. The classes are fully Unicode compliant and include Unicode built options in the workspace file. The enclosed zip file contains the CPing source code and a simple test program to exercise all of the functions the classes provide.

1_2002 #104003
Create a form bigger than the screen!

The primary focus here is to allow you to display forms that are larger than the screen can show. Need an 8½" x 11" Form? NO Problem!The size used in this example is 8½" x 11", but it could just as easily be landscape, envelope, or any needed size.

1_2002 #111261
MFC classes to implement a Web Server

3Mfc 1.1 A collection of freeware MFC classes to implement a Web Server Welcome to W3Mfc, a collection of freeware MFC classes to implement a simple Web server. The idea behind is W3Mfc was originally to learn about the Http protocol and how it is implemented on Win32. It is not intended to be a replacement for IIS or Apache. Instead it is designed as a tool for learning or in cases where deployment of a solution on IIS would be considered overkill or your product must run on 95/98 in addition to NT. For detailed information about the Hyper Text Transfer Protocol you should read RFC 1945, You can download this from a number of sites by searching for RFC and 1945 on www.yahoo.com. Another document that these classes refer to is RFC 2045 which defines MIME. The classes which constitute W3Mfc are: CHttpServerSettings: This class contains the settings which are used to configure the web server. Example member variables in this class include the root directory and the default filename. If you are developing a stand alone web server based on W3Mfc, you could for example store all the variables for the CHttpServerSettings instance in an ini file or in the registry. In the future this is the class which will be extended to include additional settings such as multiple virtual directories. CHttpServer: This is the actual class which implements the web server. It has a number of very simple functions to allow you to control the state of the web server such as Start and Stop. Internally a background thread is spun off to handle the client connections. CHttpSocket: This is a simple C++/MFC encapsulation of an SDK socket. CHttpResponseHeader: This class helps in the handling of sending request headers when returning the HTTP responses to clients. It provides a number of methods to allow standard Http headers to be added to the client response. CHttpMimeManager: This class is used when returning client responses. It is used to determine the mime type of a file given its extension type. This information is taken from the registry and is cached in this class. For example, files of .htm or .html will normally be of mime type "text/html". CHttpRequest: This class represents a request from a client. It contains information such as the URI of the request, the Http Verb used and the Http version used for the request. A member of this type is stored in the CHttpClient class. CHttpClient: This class is used in the CHttpServer class to handle client connections. It handles the parsing of client requests and returning the appropriate response. A number of virtual functions are provided to allow end user customization. The enclosed zip file contains the W3Mfc source code and a simple console based application which implements a simple web server. PJ Naughter at http://indigo.ie/~pjn/index.html

1_2002 #111262
Sending mail using Simple MAPI

CMapi v1.0 an MFC class to encapsulate sending mail using Simple MAPI Welcome to CMapi, 2 simple classes to encapsulate sending mail using Simple MAPI. Simple MAPI is a set of functions exported by MAPI32.dll which allows you to send and receive mail in a transport independent way. It is an optional part of all Win32 operating systems since Windows 95 (excluding Windows CE). MAPI is intended more for the corporate environment when compared with the Internet mail standard SMTP e.g. products such as MS Exchange Server use MAPI extensively. Transport providers are available for a number of messaging transports including Exchange Server, SMTP, Fax, cc:Mail CompuServe etc. To be able to specify different transports, MAPI provides the concept of profiles which are setup using the Mail control panel applet Features Simple and clean C++ interface. All the code is UNICODE compliant and build configurations are provided for this. Even though Simple MAPI only exports an ASCII versions of it's functions, the class internally performs the necessary conversions. The code can be used in a console application or without bringing up any Mapi dialogs if so desired. The code gracefully handles the case where MAPI is not installed on client machines. Internally the class loads the DLL and uses GetProcAddress calls. The enclosed zip file contains the source code and a simple test program to exercise all of the functions the classes provide. PJ Naughter at http://indigo.ie/~pjn/index.html

Languages
Top Categories
Global Discovery