Archive

Archive for October, 2008

Iterating through a vector made simple…

October 23, 2008 BijU Leave a comment

Most of the C++ programmers are familiar with vector. Vectors are a kind of sequence containers. As such, their elements are ordered following a strict linear sequence.

Vectors have their elements stored in contiguous storage locations. So their elements can only be accessed by iterators and offsets.

 

For example, I have one structure like

 

struct Info

{

      DWORD dwRollNo;

      char szName[65];

};

Also I have one vector like this..

 

typedef vector< Info *> INFO;

 

By using vector::push_back() or vector::push_front(), we can insert data into the structure.. That’s a simple thing.

 

Here we insert some data to the vector.

 

INFO* studentInfo;

for(…….)

{

            studentInfo ->push_back(….);

}

 

How can we iterate through the above structure?

 One way is like this.. J

 

INFO studentInfo;

INFO::iterator sIter;

 

for (sIter = detailsList.begin( ); sIter!= detailsList.end( ); sIter ++ )

      {

            Info* sValues = (Info *)(*sIter);

            MessageBox(sValues ->szName);

      }

 

You’re not free unless you follow your heart!!!

for http://vctipsplusplus.wordpress.com/

BijU

Categories: Visual C++

My B’day..

October 15, 2008 BijU Leave a comment

Hi,

On 11th October 2008, I celebrated my 25th B’day.. :)

With my friends, I celebrated the same on 14th October. This B’day made me so happy. They gave me very nice gifts . Yes.. My friends know me very well..

Thank you my dears .. Thank you very much..

B'day Cake

B

Regards,

BijU

Categories: Visual C++

Properties Dialog Box

October 3, 2008 BijU Leave a comment

All of the windows operating system users are very familiar with the following dialog box.

Yes.. this is the Properties Dialog Box, obtained by Right clicking a file or folder.

How can we invoke those in a program? We can. By using Windows Shell APIs.

Why we program the shell ? Simple, but a reasonable question. :)

An answer from the author of  “Visual C++ Windows Shell Programming” Mr.DINO ESPOSITO “To Make our application better and richer”

(Do you think, this is the only way to make our application better and richer? Hey .. no.. :)  )

Sample code for displaying the properties dialog box is shown below.

      SHELLEXECUTEINFO Sei;

      ZeroMemory(&Sei,sizeof(SHELLEXECUTEINFO));

      Sei.cbSize = sizeof(SHELLEXECUTEINFO);

      Sei.lpFile = “C:\\Record004.mp3″;

      Sei.nShow = SW_SHOW;

      Sei.fMask = SEE_MASK_INVOKEIDLIST;

      Sei.lpVerb = “Properties”;

      ShellExecuteEx(&Sei);

:)

 

“never expect yourself to be given a good value create a value of your own”

for http://vctipsplusplus.wordpress.com/

BijU

Categories: Visual C++