April 5, 1999

Converting

Question: Are there any utilities that will convert an .EXE file back to a .CPP file? A friend wrote a little program for me, and I would like to alter it to better fit my needs. Since it has such a solid foundation, I didn’t want to start from scratch.

Read-only members

Question: If I write a class in C++, which contains private members, I can make them read-only by providing a get access method and no set access method. If that member is large and I want to return it by reference, I can maintain security by returninga const reference. Without

List NT Users on Domain

Question: How do I list all the users on an NT domain with Visual Basic? Answer: The following code should get you started. Note that you need to add good error trapping to this code before using it in a production system: Option ExplicitPrivate Declare Function NetUserEnum Lib “netapi32” (abytServer

Server Folders

Question: Is there a way to get a list of folders for a network drive passing in the server name(for example, \NetDrive). I tried using Dir(“\NetDrive”,vbDirectory) but received only an empty string. Answer: You must give both the server name and the share name for this to work, for example:

Cannot load control SSTab1; license not found.

Question: I’ve tried to reinstall VB5, and I’ve installed Service Pack 3, but every time I try to use the Tabbed Dialogue control (TABCTL32.OCX), I get this message in the error log file. This also occurs with the Common Dialog Control (COMDLG32.OCX). What can I do to fix the problem?

Random File Access

Question: I am trying to read from a text file using FileInputStream. Is there a way that I can go directly to the middle of the file and read from there? Answer: To perform random access operations on a file, such as seeking to a specific offset, you have to

Array Length

Question: How do I know the size of the array returned by File.list() so I don’t get the message ArrayIndexOutOfBoundsException when printing the local directory content in the screen? Answer: All arrays have an intrinsic member variablecalled length. To get the list length you would do the following: File list;list

Reading Files with FTP

Question: I want to create an applcation that reads a file from a host on my LAN. The file must be read by FTP. How do I do this? Answer: If all you need to do is retrieve a single file by FTP, the easiest way to do this is

Extracting Integers From Text file

Question: How do I read a series of integers from an ASCII text file? The file contains a sequence of numbers like 110 120 130 140 … I tried to use readInt() andDataInputStream, but all it returned were some random values. Answer: DataInputStream is designed to read the binary representation

No more posts to show