Category: My Readings


Do you know how to add RTCI support to your class?
  • Derive the class from CObject.

class CSimple : public CObject

{

};

  • Use the DECLARE_DYNAMIC macro in your class declaration, as shown here:
class CSimple : public CObject
{
DECLARE_DYNAMIC( CSimple )
};
  • Use the IMPLEMENT_DYNAMIC macro in the implementation file (.CPP) of your class. This macro takes as arguments the name of the class and its base class, as follows:
IMPLEMENT_DYNAMIC(CSimple, CObject )
for vctipsplusplus,
BijU
“We cannot have everything in life, but God is aware and is generous to give what we need.”

Do you know how to add RTCI support to your class?
Derive the class from CObject.

class CSimple : public CObject{
};Use the DECLARE_DYNAMIC macro in your class declaration, as shown here:class CSimple : public CObject{DECLARE_DYNAMIC( CSimple )};Use the IMPLEMENT_DYNAMIC macro in the implementation file (.CPP) of your class. This macro takes as arguments the name of the class and its base class, as follows:IMPLEMENT_DYNAMIC(CSimple, CObject )for vctipsplusplus,BijU”We cannot have everything in life, but God is aware and is generous to give what we need.”

Advertisements

Search for a file

The _searchenv routine searches for the target file in the specified domain. The varname variable can be any environment or user-defined variable that specifies a list of directory paths, such as PATH, LIB, and INCLUDE.

The routine searches first for the file in the current working directory. If it does not find the file, it looks next through the directories specified by the environment variable. If the target file is in one of those directories, the newly created path is copied into pathname. If the filename file is not found, pathname contains an empty null-terminated string.

(c)MSDN

Gone are the days of my past,
Gone are the days of my childhood innocence,
Gone are the days of my first and last.
Gone are the days of being carefree,
Gone are the days of my elation,
Gone are the days of my glee.
Gone are the days of my fear.
Gone are the days of savor.
Gone are the days I spent here.

Gone, Gone, Gone are the days
And I fear
It’s becoming more clear!

Shell Path Handling functions.. 🙂

On my career start, I worked a lot with windows folders,files etc..like, creating folder/files,  copying file from one location to another, rename folders/files, verify the given name is a file or folder like that.

For doing such things, at that time, I regularly used the basic file handling functions in MFC or Win32 and most of the processing are done with the very familiar CString class.

By ‘processing’ means adding or removing the back slash character, adding the filename at the end of a path name, adding a file extension etc 🙂

Now i’m used with some Shell Path functions.. http://msdn.microsoft.com/en-us/library/bb773559(VS.85).aspx

here are some quite interesting shell functions and their description from MSDS

  1. PathAddBackslash- Adds a backslash to the end of a string to create the correct syntax for a path. If the source path already has a trailing backslash, no backslash will be added.
  2. PathCompactPath-Truncates a file path to fit within a given pixel width by replacing path components with ellipses.
  3. PathGetDriveNumber-Searches a path for a drive letter within the range of ‘A’ to ‘Z’ and returns the corresponding drive number.
  4. PathRemoveExtension-Removes the file extension from a path, if one is present

and a lot more.. 🙂

for VCTips++

BijU

Contentment is not the fulfillment of what you want, but the realization of how much you already have.

Loop Unrolling

Consider the following code:
int *buff = new int[3];
for (int i =0; i<3; i++)
buff[i] = 0;
This loop is inefficient: 🙂
On every iteration, it assigns a value to the next array element. However,precious CPU time is also wasted on testing the counter and incrementing the counter’s value and performing a jump statement. To avoid this overhead, the compiler can unroll the loop into a sequence of three assignment statements, as follows:
buff[0] = 0;
buff[1] = 0;
buff[2] = 0;

for https://vctipsplusplus.wordpress.com/

BijU

If your actions inspire others to dream more, learn more, do more and become more, you are a leader

Implementing a COM interface means that the object uses code that implements each method of the interface and provides COM binary-compliant pointers to those functions to the COM library. COM then makes those functions available to any client who asks for a pointer to the interface, whether the client is inside or outside of the process that implements those functions.