How to add an ActiveX control to a Visual C++ 2010 project

In a previous blog post we showed how to add an ActiveX control to a Microsoft Visual Basic 2010 project. In this blog post we will show how to add an ActiveX control to a Microsoft Visual C++ 2010 project. We will also show how to create a variable that can be used to access properties and methods in the ActiveX control.
In this step-by-step tip we will use the Twitter control that is included in our SamLogic Social Media Components component library. This control can be used to send tweets to Twitter, and we will show how to add this control to a Visual C++ project. Although this tip will cover Microsoft Visual C++ 2010, the steps in other versions of Visual C++ are very similar.

How to add an ActiveX component to a Visual C++ 2010 project

1. Start Visual Studio 2010 and choose New project in the File menu.

2. Select the MFC Application option in the Visual C++ node in the New project dialog box.

New Project - Visual C++ - MFC Application

3. In the MFC Application Wizard window that is shown, choose Dialog based in the Application Type step. We will create a dialog based Windows application.

4. In the Advanced Features step in the MFC Application Wizard, make sure that the ActiveX controls option is selected.

5. In the last step of the MFC Application Wizard, click on the Finish button.

We have now created a basic Visual C++ / MFC project that uses a dialog based window. Next will show how to add the Twitter ActiveX control to the project:

6. Right-click over the Toolbox window.

7. Select the Choose items menu item in the local menu that is shown.

The 'Choose Items' menu item

8. The Choose Toolbox Items dialog box is now shown. In this dialog box, open the COM Components tab.

9. If you have installed the Twitter component and want to use it, select the SLTwitCtrl control in the list. Otherwise, select the ActiveX component that you want to use.

The 'Choose Toolbox Items' dialog box in Visual C++

10. Click OK to close the dialog box.

11. The selected component should be visible in the Toolbox window; probably in the bottom of the window.

12. Now drag and drop the component on the dialog box.

The Twitter ActiveX control is placed in the dialog box

We have now included an ActiveX component into a Visual C++ 2010 project and put it in a dialog box. We will now show how to create a variable that can be used to access properties and methods in the ActiveX control.

13. Right-click on the ActiveX control in the dialog box window.

The 'Add Variable' menu item

14. Click on the Add Variable menu item in the local menu that is shown.

15. Enter a variable name in the dialog box that is shown, for example: SLTwitterCtrl.

The 'Add Member Varible Variable' dialog box

15. Click Finish to close the dialog box and create the variable

16. We have now created a variable that can be used to access properties and methods in the ActiveX control. The example below shows how to access the AppName property in SamLogic’s Twitter Control (it sets the ActiveX property to “Twitter Test Application”):

Code example - How to access the AppName property in SamLogic's Twitter component in Visual C++

Related Blog Posts
> How to add an ActiveX component to a Visual Basic 2010 project
> How to add an ActiveX component to an Excel 2010 sheet

How to use SamLogic Image Resizer – Video

In this video, that is published on YouTube, you will get a short demonstration of how to use our image resizer / converter application SamLogic Image Resizer.

SamLogic Image Resizer is used to resize and convert images (for example photos) so they can be used in web sites, blogs, e-mail newsletters, and with applications. The tool makes images smaller in size, optimizes the images resolution (DPI) for best quality on screens, and can also convert CMYK color images to RGB color images.

Download SamLogic Image Resizer
SamLogic Image Resizer is installed together with our other software, but you can also download it separately from the following web page:

> Download SamLogic Image Resizer

It is free to use SamLogic Image Resizer. You can also distribute it to other users, if you think they will have use of the program.

Visual Installer: Prime number based license keys

One important key feature in Visual Installer is the ability to create and handle license keys (installation keys). Visual Installer can handle both static license keys and prime number based license keys.

Prime number based license keys
Prime number based license keys are license keys that are created by using a formula that includes prime numbers. By combining this with a checksum, Visual Installer can very easy check that an entered license key is correct or wrong. You don’t need to include your license keys with the installation; pure mathematics is used to verify the license key.

It is also very difficult for a person to manipulate the license key and create false license keys. Not all combinations are allowed and besides that, also the checksum must be correct. So a “cracker” must consider two things in the same time, which makes it difficult to “crack” the key.

How to create prime number based license keys?
If you want to use prime number based license keys in your installation, follow the steps below to create the keys:

1. Start Visual Installer
2. Open the Dialog boxes tab in the editor
3. Click on the ”…” button to the right of the License key option
4. Click the Prime number based license keys button
5. In the dialog box that is shown you can create prime number based license keys

You can create prime number based license keys with Visual Installer

When does Visual Installer ask for the prime number based license key?
Before the actual installation of files starts, a setup wizard with dialog boxes is shown for the end-user. Among these dialog boxes there is one dialog box that asks for a license key. In the picture below you can see how the dialog box looks like:

The 'License Key' dialog box

The installation will not continue until correct license key has been entered. If the end-user enters wrong license key too many times the installation is stopped.

Handling of prime number based license keys is only included in the Professional version of Visual Installer, not in the Standard version. If you have the Standard version and want to change to the Professional version, read this blog post.

See Also
> Visual Installer can show visually when a license key is correct
> How to block a license key when using Visual Installer
> The setup wizard in Visual Installer

Start button back in Windows 8.1

Windows 8.1As you may already know, and as we described in an article on our website, Microsoft removed the Start button in Windows 8. This raised much criticism among Windows users and Microsoft have partly listened to them and re-introduced the Start button in the upcoming Windows 8.1 that will be released later this year. However, there is no traditional Start menu as in earlier versions of Windows. Instead, the Start screen is shown if you click on the Start button (see image to the right). The new Start button is placed at the bottom left of the screen, just like in older Windows versions.

Windows 8.1 - Right-click Start menuWindows 8.1 – Right-click menu
It is also possible to right-click on the Start button and display a shortcut menu for Control Panel and Windows Explorer among other options. You can also turn off or restart Windows from this menu (see image to the right).

Displays traditional desktop at start
Another new feature in Windows 8.1 is that the computer can be started with the traditional desktop right away instead of clicking around with your mouse or using the keyboard to bring up the traditional desktop as you had to do in the previous version of Windows 8. This is welcome news for many, especially for companies that are still using traditional Windows programs (Windows desktop applications).

Other news
Some other news in Windows 8.1 are:
– Improved support for SkyDrive
– Internet Explorer 11 included
– Improved support for security
– Extended support for VPN
– Improved and more flexible Home screen
– Support for 3D printers

The following YouTube video from Microsoft presents news on Windows 8.1:

More information
More information about the new features in Windows 8.1 can be found on these pages:
> Microsoft: What’s New in Windows 8.1
> Guardian: Windows 8.1 review: Microsoft’s fresh Start?

Download Windows 8.1 Preview
Right now it is possible to download a preview version of Windows 8.1:
> Download English version of Windows 8.1
> Download Swedish version of Windows 8.1

Related information about Windows 8
> Article: New Keyboard Shortcuts (Hot Keys) in Windows 8
> Article: Why Were the Start Button & Start Menu Removed in Windows 8?

Visual Installer: How do I install files to the Program Files folder?

Applications (programs) are usually installed to the Program Files folder in Windows. The exact folder path may differ between different versions of Windows. The folder path is for example different between a 32 bit and 64 bit Windows, and for example a Spanish Windows uses a different folder path than an English Windows.

This will make it difficult to hard code the folder path to the Program Files folder. If you use Visual Installer for your setup projects you can use an environment variable to handle the Program Files folder. The name of the variable is %PROGRAMFILES and the variable will be replaced with the current folder path to the Program Files folder during the installation. By using this variable you don’t need to worry about the bitness of the Windows or which country / language version of Windows that is run.

More information
We have published more information about the %PROGRAMFILES variable in the following two Visual Installer related blog posts:

> How to install files in the correct folder using Visual Installer
> How Visual Installer handles 64 bit folders in Windows

Free HTML editor from Microsoft: Expression Web

Microsoft Expression Web is a powerful and feature-rich HTML editor from Microsoft. The first version came in 2006 as a successor to the very popular and widely spread HTML tool Microsoft FrontPage. Expression Web is aimed for more experienced web developers. It is a competitor to Adobe DreamWeaver and just like DreamWeaver it is a HTML tool that is primarily designed to develop more sophisticated websites. HTML tools can also be used to create newsletters if you have a good knowledge of HTML and you know what works for e-mail.

Download Microsoft Expression Web for free
In December 2012 stopped Microsoft with further development of Expression Web and as a result they decided to release he program for free. It is therefore possible to download it for free from Microsoft website. However, Microsoft will continue to maintain the product and release possible security updates up until 2015. The program can be downloaded through this website:
> Microsoft Expression Web 4 – Free Version

More information about Microsoft Expression Web
> Microsoft Expression Web – Wikipedia

Templates that can be used together with Microsoft Expression Web
> Expression Templates | REVIEWED Expression Web Template Resources
> Over 20,000 Professional Business Templates for Microsoft Expression Web & WebMatrix
> Expression Web Tutorials / Expression Web Free Templates

Free pictures for newsletters and your blog

In a previous blog thread we published a list of websites that provide free icons (small pictures) that can be used for your newsletter, homepage, blog or program. In this blog thread we bring up a new article that you can find on our homepage which contains links to websites where you can download free images (for example photos) of high quality. Even those pictures will fit well your newsletters, blogs, homepages and programs etc.

There are many websites on the Internet that offer professional images such as photos or computer generated pictures. In an article we have put together a list of links to such websites with high level of standard. Many of these images can be used for free for both private and commercial purposes while others can be bought cheaply. The available image formats usually are JPEG, PNG, GIF, TIFF and BMP. The article brings also up some search engines – specialized for images – that you can use for finding free images or images you are willing to pay for. You can find the article here:

> Free pictures for newsletters and your blog

Free icons for programs and webpages

In this blog thread we wrote about a good program (Axialis IconWorkshop) that can be used for creating your own icons. An alternative for creating your own icons is to use ready-made icons instead. You can find many websites on the Internet that provide you with ready-made icons of high quality. These icons can be used both for a program and for a webpage. They can even often be used for blogs and newsletters etc. You can use many of the icons for free, i.e. they will not cost you anything, while other icons can be bought for a quite small amount of money.

Search engines that can find icons
There are many good search engines that helps you to look for icons. One good example is IconFinder that can be used for looking up both free icons and icons that you need to pay for. IconFinder contains a large selection of diverse icons. At the time of writing this blog thread there are 214 330 icons available in their database.

Even websites like FindIcons and IconArchive offer many icons for both private and commercial purposes. Both the sites have embedded search engines that make it easy to locate icons of a certain category or look. In certain cases even Google image search can be used for looking up icons.

List of websites with free icons
There is a large number of websites on the Internet that offer you beautiful and well-designed icons. Many of these icons can be used for free for both private and commercial purposes while others will cost you a little bit of money. The available icon formats usually are PNG, GIF, ICO and in some cases even PSD (Abode Photoshop) or BMP. Bellow you can find a list of links with some good websites that we recommend:

1st Webdesigner – Web Design Blog – Over 30 icon sets for designers and developers.
Crystal Clear – Icons from Crystal Clear set by Everaldo Coelho.
Dry icons – Free icons – Many professional icons. They can even design icons at your request.
Fast icon – Many icons with professional look. You can even create icons.
Free Icons Web – Over 28 000 free icons and 950 icon sets.
iCandies Icon Set – 60 free icons for your user interface or your app.
IconDock – Free icon collections rated by users.
IconSpedia – Contains many free icons of high class.
Noupe – Icons in PSD format, but for most of the icons there are even PNG images available.

Some icons require you to link from your homepage to their website or to the designers’ website while others have no such specific demands. Before using an icon, check carefully its license terms of use.

Shutterstock – for you who is willing to pay
For you who is willing to pay a bit extra there is a website that we really can recommend –
Shutterstock. They have an enormous number of icons for commercial purposes and you will probably find every thinkable icon in their collection.

Program for creating icons

Both SamLogic CD-Menu Creator and SamLogic Visual Installer give you the possibility to add your own icon to your project. To create an icon you need a program that helps you to form icons and in many cases Microsoft Visual Studio is sufficient for that purpose. However, Visual Studio has some flaws concerning icon handling (among others shortfalls with handling the color palettes) so if you want to make creating icons easier and escape those problems, it can be a good idea to use a program that specializes in the task instead.

There are several different programs at the market. We use Axialis IconWorkshop which is easy to use while still being a powerful tool. The program can create icons both for Windows and Mac OS and it can convert between them as well. If you use Visual Studio, you can add Icon Workshop as a plug-in into your Microsoft development environment.

You can read more about Axialis IconWorkshop at their webpage:

> Webpage – Axialis IconWorkshop