Changing the title bar caption of your dialog-based application (Microsoft Visual C++ 6.0 MFC AppWizard(exe))

Posted by Rey Dacoco in

1. Right-click the title bar of your dialog-box then select  Properties from the pop-up menu. The Dialog properties dialog-box will then become visible. Click the general tab then locate the caption textbox.

2. Key in your desired caption in the caption textbox then click the close[x] button of the Dialog properties dialog-box. The inputted caption should now appear on the title bar of your dialog box. Additionally, you can modify the font face and size of your MFC dialog box by right-clicking the caption of your dialog and  selecting properties>general tab and clicking the Font button then choosing your desired font face and font size. Unfortunately , it will also resize the dialog box, just click and drag the selection handle of your dialog to restore it to its default size.

Microsoft Visual FoxPro 6.0 Printing (The FoxPro For DOS way)

Posted by Rey Dacoco in

One of the most important features that a good database system should have is its ability to generate printed reports. In this tutorial we will learn how to print the contents of a Visual FoxPro from…the good old FoxPro for DOS way. Actually there is another way, the one that involves using Advanced Programmers Interface or API but since I hate to complicate simple things, we will be using the easiest way, the DOS way.For the sake of example, we will use the form below, actually it’s not a form…it’s a sketch. But in this tutorial, I would like you to think of it as a real form. Just for now, okay?


What we have here, ladies, is a form with two labels (Name and Last name) and two textboxes beside each labels. Of course don’t forget those tiny buttons named Print and Exit. Let us make up a name for the print button because that’s the object where we will place our codes later on, let’s call it Print… what do you think?So our aim here is…if the user runs the form and types a text on those textboxes, and clicks the Print button, whatever ever text that was entered by the user will be sent onto the printer. Of course it is only possible if we attach a code onto the Print button. To do that, double click the Print button in the design time then type the following codes in the click procedure event.

//The text that is being printed will appear on the screen if
//you turn this ON, you don’t want that, wont you?
//Send the text onto the printer.
? ThisForm.Text1.Text''
//The question mark symbol displays our text on a new line while
//ThisForm.Text1.value indicates the source of the text that will be sent onto the
//printer, in this case, it’s text1 or the textbox beside the name label.
? ThisForm.Text2.Text
//Prints the contents of text2 or the textbox beside the Last name label.
Wait Window ‘Please wait…Printing’
//Some Hollywood special effects
//If you turn it ON, you should also know how to turn it off…Good Boy.
And that’s it. No Sweat. We are done. If you have 10 textboxes in your form then just add ? Thisform.text3.text, ?Thisform.text4.text, and so on. It is just that simple and you don’t have to be good –looking and rich to do that. Let us have a quick glance at those codes again…

? ThisForm.Text1.Text
? ThisForm.Text2.Text
Wait Window ‘Please wait…Printing’
You can copy, paste and edit these codes Just don’t forget to thank me. You can send me some love letters too.

Changing the Hard Drive or USB Icon in Windows XP

Posted by Rey Dacoco in

Unlike a normal folder, you cannot change a hard drive or USB icon by right clicking it, selecting properties then clicking the customize tab and the change icon button because though they both have properties right click options, your mother and I knew that they both don't have customize tab. But don't despair, that does'nt mean that the title is wrong and should be changed to "You cannot change the USB icon moron". We can, my brother, just follow these simple steps:

Step 1: Double click the USB icon to browse its contents.
Step 2: In the blank pane, right click> Select new > Text Document.
Step 3: Double click the newly created New Text Document file.
Step 4: Type the following:

Step 5: Click File> Save > Type Autorun.inf > Click save.

Replace the yourdesiredicon.ico with an existent icon file. I suggest searching an icon
file first by clicking the start button > Search > Click All files and Folders > in the first textbox, type, *.ico then click the Search button. Right click your desired icon > Copy. And paste it on the same location where your autorun.inf file is located. Just don't be dumb and replace the Icon
keyword with your name.
To change the hard drive icon, just change the Step 1 to Double click the Hard Drive icon.

Adding a background image to your dialog-based application (Microsoft Visual C++ 6.0)

Posted by Rey Dacoco in

Though not entirely required, adding a background image can sometimes improve the look and feel of your application.

To add a background image to your dialog-based application, simply follow these simple steps:

1. Start Microsoft Visual C++ 6.0

2. Click File>New>Click the project tab then select MFC AppWizard (exe)> type the project name>Ok.

3. Select Dialog-based among the “What application would you like to create?” radio buttons>Finish.

4. Your dialog-box should now appear in the screen.

5. Click project>Add To project>Components and controls.

6. The components and gallery dialog should then come into view.

7. Double-click the Registered ActiveX Controls folder.

8. Locate and double-click Microsoft Forms 2.0 Image from the ActiveX control list.

9. A message box containing “Insert this component?” prompt with OK and Cancel button should then come into sight.

10. Click the Ok button. The Confirm classes dialog box will then appear. Displaying the class specification associated with the Image object. Click the Ok button to accept the class selections.

11. An image control will be added to the toolbox. Click the close button of the components and gallery dialog to clear your view of your dialog.

12. Click and drag the newly inserted image control from the toolbox to your dialog.

13. Resize your image control. To achieve this, click and drag the selection handles [the square around the image control]. Just make sure that it covers the whole area of your dialog box except the title bar.

14. Right-click your image control>properties.

15. Click the All tab.

16. Select the picture property then click the … button beside it. Locate and double-click the image that you wanted to assign as a background of your dialog.

17. Set the PictureSizeMode property to “stretch” so that the image size will automatically adapt and adjust to the image control size.

18. Press F5 to see the outcome of your effort.

Notice how your image acts as a background to your dialog though it’s partly a background because we just faked it. Nevertheless, it’s an easy substitute than using brushes and drawing rectangles. This trick also works on single document interfaces. In addition, you can also use Image control in adding background color; this could be done by assigning your desired color value to the backcolor property of the Image control. There are several other helpful properties of an Image control. The rest is up to you to play around.

Transferring a value to or from an MFC static text at runtime

Posted by Rey Dacoco in

By default, you cannot pass on a value to or from an MFC static text at runtime for the reason that it’s control ID doesn’t appear in the member variable’s tab when you activate the ClassWizard which precludes you to allocate a member variable to it. As you may know, the only way to pass a value to a control at runtime in MSVC++ is to map an instance variable to it. The following steps demonstrate how to make your static text control ID be made available in the ClassWizard ID list:

1. Add a static text control to your dialog-box by clicking on the Static text (Aa icon) and dragging it onto your dialog-box;

2. Your static text should now appear on your dialog with a default caption “Static”.

3. Right-click your static text>properties.

4.In the general tab, you will see the default ID of your Static text as IDC_STATIC.

STATIC in laypersons term means “unchanging” or “fixed” that’s why you cannot change its value at runtime. To be able to change its value, you’ll need to rename its ID from IDC_STATIC to IDC_WHATEVERDESCRIPTIVENAME, for instance IDC_NameLabel.

After changing its value from IDC_STATIC to IDC_WHATEVERDESCRIPTIVENAME, your Static text control should now appear in the ClassWizard ID lists, all you need to do is allocate a member variable to it so that you will be able to transfer a value to or from it at runtime. Same principle applies to Picturebox control.

Fixing the "No value given for one or more parameters" in Visual Web Developer 2008

Posted by Rey Dacoco in

This error normally appears when you have selected enable deleting and enable editing GridView or FormView task options and you try to delete or update a record at run-time. This error can be fixed by converting the SQL statements in the InsertCommand and AccessCommand to Jet SQL statements. To be able to clearly understand the solution, let us start from the beginning:
1. Create a database file in Ms-Access and name it “dbNames”. Make a table inside it and name it “tblEmployee” using the following specification:

2. Don’t forget to click yes when you will be ask to create primary key, otherwise you will not be able to add an Edit or Delete buttons to your grid view control.
3. Add appropriate values to your table, for instance:

4. Click Start>All Programs>Visual Web Developer 2008.
5. Click File>New Website> Website>Ok.
6. Click View>Solution Explorer>Right-click your website solution name, Select Add Existing Item. Locate you dbnames access database file>Add. The solution explorer should now look like this.

7. Click the design tab then add a GridView control to your form.
8. In the Choose data source listbox, select new data source>Select Access database>Click the browse button>Select dbnames>Ok>Next>Click the * checkbox from the columns category>Click the advance button>Click the Generate Insert, Update, and Delete statements checkbox including the Use Optimistic Concurrency checkbox>Ok.
9. Click Next. Click test query to view the result of the sql statement then click finish.
10. Click the GridView task button(>) then check enable paging, enable sorting, enable editing, enable deleting, and enable selection checkboxes.
11. Click the View in Browser button. If you are prompted to save changes to your website, just click the yes button.
12. If you try to click or update a record value now, you will be taken to the following to a screen containing the following message:

13. To solve this problem, click the Source tab to view the source code of your website. Look for the following lines:

14. Delete the OR logical operators including its respective conditions, your code should now look like this:

15. Click the View Browser button and try clicking the Deleting or Record value. This time you can delete or delete a record value without getting a ““No value given for one or more required parameters”


My photo
I am just a simple man with a simple mind. And this is my simple blog. New Posts will be available soon. Enjoy reading and never stop learning:)

Total Pageviews

Link List


Got questions? You can reach me here: