Share the ideas and thoughts, become united ...
Showing posts with label win 7. Show all posts
Showing posts with label win 7. Show all posts

Friday, May 27, 2011

Understanding & Solving the "Side by Side Configuration" (DLL Hell) Problem - C++

Many developer has seen the "Side by Side Configuration Error" problem. They build their executable in one system and after transferring the application to another system they got this error. Just by seeing that error one might think - "WTH, does C++ application need dependencies?". The answer is yes if you build Win32 application.


 In win32 application we use the header file to use the function in our application and the library file to successfully link the application to external functions (library functions). This problem occurs due to MS's dynamic link feature. When you build the application the VS linker perform a shared dynamic link to the system library. This linking reduces the size of the executable because the library resides in the OS. Now when you transfer the application to another system & try to run it, you have a high chance of getting the "Side by Side Configuration Error" due to mismatched version of system library resided in the target OS.

The easiest way to solve this problem is to reinstall the MSVC redist package. Most of the time it may save your day. But sometime it may not.

Lets jump into the heart of the problem. Usually the VC redist resides in "%windir%\winsxs". In that folder you will see all the required library to run Win32 C++ application. 

Now the question is which library do we need? Lets get back to our MSVC project. I have created a sample test Win32 application and build it. Now if you go to the debug folder you will see many files. Among them you will see a ".manifest" file. Now open it with a text editor. You will see that that is an xml file. The important part of this file is -
<dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
This section tells us which library & which version we will need to run the program. In the winsxs folder you will get the library in this format -
processorArchitecture_name_publicKeyToken_version
 That folder contains the required library files. I hope you have understood the dependency search. Now I am going to share another working solution. 

In MSVC you can link the required library as static. To do so go to solution's properties --> Expand the Configuration Properties --> General. You will see use of MFC, ATL configuration entries under the project defaults. 


The default value for the entry is "Use standard windows library". Change it to "Use MFC in a static library". You should set this option in ATL configuration entry if you use ATL. Now build the solution and thats it. Now your executable will be bigger but it won't require the windows library from winsxs folder.

The "Side by Side Configuration" error snapshot is by courtesy of google :). And the later snapshot is taken from MSVS 2008.

Hope this article will help you. If you have any question or queries please leave a comment.

Friday, April 23, 2010

Activate GPRS on China Mobile's Cell Phone in Win7

This is a complete step by step guide to use your China Mobile as a GPRS modem for connecting to the internet.

1. Plug-in your mobile into USB and select the "COM Port" if any option on your mobile device pops up.

2. Right click the "Computer" on desktop and go to "properties". Click the "Device Manager" on the top left side of the properties window.

3. Find out your modem device. It should be appear with a yellow exclamation sign.

mtk
4. Download this driver. [MTK CPU USB Driver] 17 KB

5. Double click the sign in the device manager to bring up the properties window of the modem device. Click "Update driver" located in the lower left side of the dialog. Now Select the "Browse my computer for driver software" and show the location of the driver. Click Next to install the driver. Select "continue or install anyway" if any dialog pops up saying that the driver is not signed digitally.


6. Now the driver for your modem should be installed. It should say something like "62xx USB Modem Driver (COM yy)".


7. Now open up the start menu and in the search box type "modem". Now select the "Phone & Modem" located under the "Control Panel" section. You can also go to the control panel and in the search box (upper right corner) type "modem" and then choose the "Phone & Modem".

8. After opening the "Phone and Modem" palette, select the "Modems" tab. Click "Add" to add new modem. Now a "Add hardware wizard" will pop up. Check "Don't detect my modem" and click next.


9. Now download this modem driver. [MT6225_Modem_Driver] 31KB

9. On the next section click the "Have disk" button and browse for the modem driver. You will see the modem driver, but the driver is not digitally signed. Click next to continue installation with the modem driver.


10. Now in the next section select the "COM yy" as the communication port for your modem. Click next to add the modem. You can find your modem's "COM yy" from the device manager.


11. Your Modem is now installed. You can create dial-up connection using it. Now let us test the modem.
Again open the "Phone & Modem" control panel palette. Go to "Modems" tab and double click the installed modem. Modem's property dialog will pop up. Now go to "Diagnostics" tab and click "Query Modem". After a short while it will show the result of the query. This is a proof which indicates that your modem is working.



Now create a dial-up connection using this modem and enjoy edge or gprs service.
This walk-through is for win7 but you can use it for win xp also.
If any of the link becomes invalid, please notify me. or you can google out the driver yourself.

For any question and suggestion, please leave a comment.

Wednesday, March 31, 2010

Manage Multiple Network Interface Card in Win 7

You can change the order of your network cards in win 7. This can be done very easily. Here how it is done -
1. Go to Control Panel->Network and Internet->Network and Sharing Center. Now click the Change adapter settings from left side of the window.




2. You will see the connections along with your network cards. Hold down the Alt key. This will bring up the menu bar. Go to Advanced->Advanced Settings.



3. You will see your network showing in a list. There you can move up and down. Moving up an interface will make it more preferable by the system than the interface listed below it.



Hope this article is useful for you. If you have any suggestion or question please leave a comment.