February 3, 2000

Win NT / Get UserGroups Permissions in VB

Question: I would like to get the permissions for the users of my app. I have setup groups for users with the appropriate permisions. Now all I want to do is check which group they belong to, when they execute my app. Answer: Actually, it’s not too difficult in VB.

Static Char THIS_FILE[]=__FILE__

Question: When I learned VC++, I found a bizarre statement inevery .cpp produced by AppWizard: “static char THIS_FILE[]=__FILE__;” Why does AppWizard redefine THIS_FILE?I find that THIS_FILE is just defined as__FILE__ in AFX.h. Any idea why it’s this way? Answer: The THIS_FILE variable stores the name of the current translation unit.

Using Lockf with Seed Files

Question: It’s been years since my paws had to pound out a solution in C, so I’m a bit rusty and would like a second opinion.. or third… or fourth. Problem: I need to serialize access to a “seed” file containing an incremental sequencing number. Process is: read file increment

Pointers to Vectors

Question: How do you create an array of pointers to vectors?The different vectors will, eventually, have different lengths. Answer: You declare an array of pointers to vector like this: std::vector * vecptrarr[10]; Of course, you’ll need to allocate the vector object at a later stage and assign addresses to the

Referencing Controls on a Form with a Variable

Question: How do I use a variable to reference a control on a form? For instance, if I have five controls on a form named Edit1 through Edit5, and I make a for loop the builds the string “Edit1”, how do I use that string to refernce the actual control

Finding Cursor Position in TextBox

Question: How can I find the current cursor position in text box? Answer: You can use the SelStart property of the TextBox to indicate where the cursor is in the text box. The SelText property can be set to the text that you want to insert at the cursor position.

ASCII Values

Question: How do I change an ASCII value to a letter in C++? Answer: You can directly assign the ASCII vlaues to a variables of type char.The decimal value is automatically converted to char, without anyspecial casting operations. For example, the ASCII value of the ‘A’ is65. You assign this

Problems with Getc and Scanf

Question: I want to make a menu, where you can select from 1-4. By pressing one of these keys you should get into a subprogram. Now I have to press enter after I select 1,2,3 or 4. Is it possible to have C++ bypass “enter” and go directly to the

Creating Visual Basic DLLs

Question: Is it possible to create DLLs in Visual Basic? If so, how? For example, I want a DLL with a function that can accept 2 integer arguments and returns a boolean value afterwards. How can I call this DLL from another project during runtime. That is, I want the

No more posts to show