Goto https://software.intel.com/en-us/articles/intel-ipp-legacy-libraries and download the links for your OS. Then follow the installation text file inside the zipped file. The password is specified in the installation file. Once downloaded extract the headers and libs into the proper folder. e.g. /opt/intel/include…
Nowadays it feels like everywhere and everyone is using HTML. So why not use it for building a MFC based application by using lesser and lesser MFC dialogs. Lets start by creating a MFC application using visual studio any version is fine. Open up visual studio as below, and create a new MFC based application
[sourcecode language=”cpp”] Note: you should fix the corresponding the #endif. I was lazy to do it. #if _MSC_VER < 1300 //VC6 // code here #endif #if _MSC_VER >= 1300 && _MSC_VER < 1400 //VC7 // code here #if _MSC_VER >= 1400 && _MSC_VER < 1500 //VC8 // code here #if _MSC_VER >= 1500 && _MSC_VER
Unix files consist of two parts: the data part and the filename part. The data part is associated with something called an ‘inode’. The inode carries the map of where the data is, the file permissions, etc. for the data. The filename part carries a name and an associated inode number. The directory, as a
Sometimes while including projects or files not developed by you, it would be necessary to go ahead and disable this option. To do this, goto your project settings, build phases, expand compile sources, click on a specific file and add this option to the compiler settings -fno-objc-arc That should do the trick. happy coding.
Go to project settings, check for the platform toolset settings. Visual studio 2010 [vc10] vc100 Visual studio 2008 [vc9] – vc90 Visual studio 2005 [VC8] – VC80
void linkedlist::reverse() { element *ptr= head; element *nextptr= ptr->next; while(nextptr) { element *temp = nextptr->next; nextptr->next = ptr; ptr = nextptr; nextptr = temp; } head->next = 0; head = ptr; }
// // heapSort.cpp // learnCpp // // Copyright 2011 __MyCompanyName__. All rights reserved. // #include using namespace std; void display(int a[], int n) { cout<<” ————— “<<endl; for (int i=0;i<5; ++i) { cout<<a[i]<<endl; } } void heapify(int a[], int n) { int i,j,k,item; for(k=1; k0 && item > a[j]) { // if parent exists and
4>g:worktest.cpp(119): error C2872: ‘CRegKey’ : ambiguous symbol 4> could be ‘g:workwindowscregkey.h(33) : CRegKey’ 4> or ‘c:program files (x86)microsoft visual studio 10.0vcatlmfcincludeatlbase.h(5459) : ATL::CRegKey’ In case you have such issues, the easiest way to resolve them would be to use ::CRegKey in front of the keyword. This will call the local libraries first.
I found this code useful when you want to go through each tab and then look into their URLs and so on. You can also quit each tab individually. [sourcecode lang=”cpp”] // Implementation #include #include typedef BOOL (CALLBACK * IEENUMPROC)(HWND hwnd, LPVOID pif, LPARAM lParam); static BOOL CALLBACK EnumIEChildWindows(HWND hwnd, LPARAM lParam) { TCHAR szClassName[100];
LRESULT lResult; UINT nMsg = ::RegisterWindowMessage( _T(“WM_HTML_GETOBJECT”) ); ::SendMessageTimeout( handleToInternetExplorerWindow, nMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, (DWORD*)&lResult); LPFNOBJECTFROMLRESULT pfObjectFromLresult = (LPFNOBJECTFROMLRESULT)::GetProcAddress( hInst, “ObjectFromLresult” ); HRESULT hr; CComPtr htmlDoc2; hr = (*pfObjectFromLresult)( lRes, IID_IHTMLDocument2, 0, (void**)&htmlDoc2); if ( SUCCEEDED(hr) ) { IHTMLFramesCollection2 *p; htmlDoc2->get_frames(&p); long lLen; p->get_length(&lLen); for (long i = 0; i < lLen; i++) {
Be careful when using _SECURE_SCL option when integrating your DLLs with DLLs you received from someone else. If you have compiled your dlls with this option but the dlls you use havent, you are most likely going to get a runtime application compatibility error. To fix this just remove this option. When secure SCL is
Below is the code to return the parent id of a process, given a process id. This can be helpful in circumstances when we have to scan all the running processes to find out the spawned processes from another process. [code language=”cpp”] // change this method signature according to your requirements BOOL GetParentPID( DWORD dwParentId,
build environment mac os 10.7 xcode 4.1 check out your virtualbox code. In this part, i am basically going to show how to set up your xcode as a build system for building virtualbox code. a. add a new project with the option external build system. b. once this is created import the source code,
int Helper_ReturnVms(IVirtualBox *virtualBox) { HRESULT rc; bool bFound=false; /* * First we have to get a list of all registered VMs */ SAFEARRAY *machinesArray = NULL; rc = virtualBox->get_Machines(&machinesArray); if(FAILED(rc)) { SafeArrayDestroy (machinesArray); return -1; } IMachine **machines; rc = SafeArrayAccessData (machinesArray, (void **) &machines); if(FAILED(rc)) { SafeArrayUnaccessData (machinesArray); SafeArrayDestroy (machinesArray); return -1; } for
Download cppcheck from here: http://cppcheck.sourceforge.net/ some of the things you can find out by running cppcheck on your code is: 1) Summary: Possible inefficient checking for ‘idList’ emptiness. Message: Checking for ‘idList’ emptiness might be inefficient. Using idList.empty() instead of idList.size() can be faster. idList.size() can take linear time but idList.empty() is guaranteed to take
Lua: string.find(“testthis”, 5,5,7) this is going to give you “th”. Meaning it will start from the 5th letter and give the next letters between 5 and 7. C++ / C string str=”testthis” str.find(5,5); this will start from the fifth element and give you the next 5 letters. Basically in lua, it gives the letters between
Today, I would like to discuss a new feature in c++0x. This would be available in your microsoft visual studio 2010 versions ( i.e VC10) Before you used to write this: // for_each example #include #include #include using namespace std; void myfunction (int i) { cout << " " << i; } struct myclass {
I would not be explaining what jni is and stuff, its available online. I am just writing a small jni sample, so that you easily test it and understand. First step: Create a sample java project using netbeans. This is your sample main file. public class Test1 { static { // this is the name
1) Create ur qt project. 2) include all the header files in your project. 3) Use appropriate namespaces 4) Important part: linking against your libraries In your .pro file, use : LIBS += -L”/home/test/Desktop/test-build-desktop/” -lLibrary1 -lLibrary2 Here library1 and 2 are the names of the libraries i link against. 5) Now from the command prompt
Sometimes data is also stored as message instead of resources. the easiest way to read this is as below: ofstream myfile; myfile.open (“example.txt”); HMODULE handle = LoadLibrary(“AgentRes.dll”); // dll for reading the file DWORD err=::GetLastError(); for(int i=0;i<10000;i++) { LPTSTR lpMsgBuffer=NULL; DWORD dwRet=FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE, handle, i, // number of the corresponding message // you
Sometimes or most times when you get a crash dump from your customer, its always good to know how to reproduce the crash and point out where the actual crash happens. Today I was debugging some bug with my lead, I found this very useful: Here are the steps: First of all open the windows
This is especially useful when you want to use someone else’s dlls. 1) Open the dll in windows dependency viewer: You should see the following, if its a COM dll. This basically is related to COM. If you go through COM tutorials you will know about this. 1) next open the dll you need in
If you have a situation as above or in clear words If an application has a string localized to multiple languages and mapped to the same ID in each language, the correct version of the string might not be loaded on Windows 95 or Windows 98 using the Win32 function ::LoadString. To load the correct
//———————————————————————————— // 1.2 Introductory Example or How to Replace a Switch-Statement // Task: Perform one of the four basic arithmetic operations specified by the // characters ‘+’, ‘-‘, ‘*’ or ‘/’. // The four arithmetic operations … one of these functions is selected // at runtime with a switch or a function pointer float Plus
Recently I had to integrate cppunit and teamcity on linux for running my unit tests. First of all you can either link against and compile cppunit libs to run the tests OR the lazy way to do this is just install cppunit. Do it this way: $ apt-cache search cppunit libcppunit-1.12-1 – Unit Testing Library
Q I have two views. One view needs to check if the other view has been instantiated yet—that is, if the pointer to it is valid. How do I test a pointer to see if it points to a valid class in memory? I tried setting the pointer to NULL, then checking to see if
One of the instances, your customers or yourself would be using call backs when you need to call a method asynchronously and receive the feedback. When I tell asynchronously, it means like you want to read a huge file[> 100MB] and parse them. I know this consumes a huge amount of memory. Use file handles
I learnt this from my manager. DebugBreak is powerful tool you can use when debugging applications. I had this scenario where I need to use a java app which was internally calling C++ methods, basically JNI functions. The error in question was in the C++ side, so not really an option to use debugger. Therefore
I got this from http://stefanobolli.blogspot.com/2010/10/compiler-error-c2733-second-c-linkage.html Compiler Error C2733 – second C linkage of overloaded function ‘function’ not allowed If we try to compile with Microsoft Visual C++ 2010 Express a project that includes old Microsoft Platform SDK headers and against old libraries, we have to modify Additional include Directories and Additional library Directories. When we
Easiest way to add global variables inside a C++ program is use extern. First add this in the header file: extern string globalVar; Then add the the same variable inside the cpp file you are using but u need to remove the extern. string globalVar; In this way your able to pass around the variable
You need to delete the *.pro.user file. This usually happens when you have copied the projects from one machine to the other, OR from one username to the other.
A BOOLEAN is an 8-bit field that is set to 1 to indicate TRUE, or 0 to indicate FALSE. This type is declared as follows: typedef BYTE BOOLEAN, *PBOOLEAN; A BOOL is a 32-bit field that is set to 1 to indicate TRUE, or 0 to indicate FALSE. This type is declared as follows: typedef
1) First of all make sure, the exe is running for which you need to know if the dll is loaded. 2) Use the windows API: typedef DWORD ( WINAPI *GETMODULEFILENAMEEX) ( HANDLE, HMODULE, LPTSTR, DWORD ); 3) Open the process: HANDLE myprocess= OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, myProcessID); Over here you would need to
I have come across code snippets where developers search strings within a string using “OR” to encompass all combination of the search string. This is not a good move. for ex: str.find(“abc”) || str.find(“Abc”)…. The good way of solving this would be to use: transform and tolower. 1) First convert both the search string and
Description of Listbox: Provides the functionality of a Windows list box. Copy class CListBox : public CWnd Remarks A list box displays a list of items, such as filenames, that the user can view and select. In a single-selection list box, the user can select only one item. In a multiple-selection list box, a range
Even though majority of the applications use vectors to get user input and manipulate data there are some who also user character input stream or arrays to get these kind of data. I think we shouldnt be using such kind since over herewhen we use arrays there are chances of buffer overflows.Incase we have character
Below search method will be useful when you need to find a window with no caption. FindWindow will not work correctly in such a instance. You can make use of the below method to do that. //get the handle to the top window HWND h = ::GetTopWindow(0); while ( h) { TCHAR buf[100]; ::GetClassName( h,
The easiest way to create a .sis file would be to use the tool makesis. You can download the tool from here: http://www.kmdarshan.com/makesis/Makesis_v1.0_by_Gip.rar http://www.kmdarshan.com/makesis/Makesis_v1.0.zip Also you would need to download this dll, and put it in your C:WindowsSystem32 for this tool to work. you can download the dll here: http://www.kmdarshan.com/makesis/Comdlg32.zip good luck packaging.
Sample code to use Qtimer in Qt instead of Sleep if you want a stoppage in your code: slideShowtimer = new QTimer(this); selectedPicture = 0; //QTimer::singleShot(5000, this, SLOT(slideShowHelper())); connect(slideShowtimer, SIGNAL(timeout()), this, SLOT(slideShowHelper())); slideShowtimer->start(1000);
Bare steps to implement multi threading in C++: a. Declare a global variable, to hold the reference counts. b. Declare CRITICAL SECTION code: CRITICAL_SECTION cs_test; int loadCnt=0; c. Now everytime you access the code you want to be protected when multiple threads access them InitializeCriticalSection(&cs_test); EnterCriticalSection(&cs_test); if(loadCnt >0) { loadCnt++; return }else{ //your code here
Some tools which I really find helpful are: a. Multimon – Support for multiple monitors b. Process Monitor c. Process Explorer d. Desktops – Desktops allows you to organize your applications on up to four virtual desktops. e. OleView – For COM purposes f. Spy++ – For windows GUI handling g. Resource hunter – Reading
1. Use constants with reference when passing values in between methods. Advantage: It will reduce space and will be faster. If you use a new variable then an additional copy is made and there is a small memory hit. Ex: method(string val) optimal usage: method(const string &val) Here we are passing the value by reference.
Snippet of the code to set the permissions and create a file while not granting read access to it: DWORD dwRes; PSID pEveryoneSID = NULL, pAdminSID = NULL; PACL pACL = NULL; PSECURITY_DESCRIPTOR pSD = NULL; EXPLICIT_ACCESS ea[2]; SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY; SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY; SECURITY_ATTRIBUTES sa; // Create a well-known SID for the
First of all i need to give credit to www.wellho.net. I got some code from their website also to implement this. My basic requirement was to read from the input arguments and display it as a vector of type integers. Below is the code. Pardon me for the formatting issues. WordPress sucks when coding: function string:split(delimiter)
I had an opportunity to use CListbox. The scenario was that I had to pre populate the list box and display it in a pop up window. Its very to use listbox when using it in a parent window but when you want to display it in a standalone pop up window, you would get
You would be getting this error if you tried to use CArray in VC 6. You would need to use some other way to get the values selected in listbox. In my next post I would be showing how to use two different ways to access a CListBox.