Apr 17, 2008

Thoughts !!!

Mar 25, 2008

Using LoadLibrary

void(*FunPtr1)(int arg1, float arg2);//function prototype

void MyClass::SomeDLLFuction()
{
            HMODULE hDLL = LoadLibrary("MYDLL.dll");

            if(!hDLL)
           {
                MessageBox("Please install Sentry spell-checker");
                return;
           }
              
          typedef void * (__stdcall *CreateFun1)(
int arg1, float arg2);//define function ptr
     
      
   CreateFun1 FunPtr1 =
                     (
CreateFun1) GetProcAddress(hDLL,"MYDLLFun1");// Get the Fuction Pointer

         FunPtr1(2, 11.01);
// Call the function

}
//end of MyClass::SomeDLLFuction()



Mar 4, 2008

India Shining !!!

The Indian chromosome

By Dr Farrukh Saleem

Twenty-five thousand years ago, haplogroup R2 characterized by genetic marker M124 arose in southern Central Asia. Then began a major wave of human migration whereby members migrated southward to present-day India and Pakistan (Genographic Project by the National Geographic Society; http://www.nationalgeographic.com/). Indians and Pakistanis have the same ancestry and share the same DNA sequence. Here's what is happening in India:

The two Ambani brothers can buy 100 percent of every company listed on the Karachi Stock Exchange (KSE) and would still be left with $30 billion to spare. The four richest Indians can buy up all goods and services produced over a year by 169 million Pakistanis and still be left with $60 billion to spare. The four richest Indians are now richer than the forty richest Chinese.

In November, Bombay Stock Exchange's benchmark Sensex flirted with 20,000 points. As a consequence, Mukesh Ambani's Reliance Industries became a $100 billion company (the entire KSE is capitalized at $65 billion). Mukesh owns 48 percent of Reliance.

In November, comes Neeta's birthday. Neeta turned forty-four three weeks ago. Look what she got from her husband as her birthday present: A sixty-million dollar jet with a custom fitted master bedroom, bathroom with mood lighting, a sky bar, entertainment cabins, satellite television, wireless communication and a separate cabin with game consoles. Neeta is Mukesh Ambani's wife, and Mukesh is not India's richest but the second richest.

Mukesh is now building his new home, Residence Antillia (after a mythical, phantom island somewhere in the Atlantic Ocean). At a cost of $1 billion this would be the most expensive home on the face of the planet. At 173 meters tall Mukesh's new family residence, for a family of six, will be the equivalent of a 60-storeyed building. The first six floors are reserved for parking. The seventh floor is for car servicing and maintenance. The eighth floor houses a mini-theatre. Then there's a health club, a gym and a swimming pool. Two floors are reserved for Ambani family's guests. Four floors above the guest floors are family floors all with a superb view of the Arabian Sea. On top of everything are three helipads. A staff of 600 is expected to care for the family and their family home.

In 2004, India became the 3rd most attractive foreign direct investment destination. Pakistan wasn't even in the top 25 countries. In 2004, the United Nations, the representative body of 192 sovereign member states, had requested the Election Commission of India to assist the UN in the holding of elections in Al Jumhuriyah al Iraqiyah and Dowlat-e Eslami-ye Afghanestan. Why the Election Commission of India and not the Election Commission of Pakistan? After all, Islamabad is closer to Kabul than is Delhi.

Imagine, 12 percent of all American scientists are of Indian origin; 38 percent of doctors in America are Indian; 36 percent of NASA scientists are Indians; 34 percent of Microsoft employees are Indians; and 28 percent of IBM employees are Indians.

For the record: Sabeer Bhatia created and founded Hotmail. Sun Microsystems was founded by Vinod Khosla. The Intel Pentium processor, that runs 90 percent of all computers, was fathered by Vinod Dham. Rajiv Gupta co-invented Hewlett Packard's E-speak project. Four out of ten Silicon Valley start-ups are run by Indians. Bollywood produces 800 movies per year and six Indian ladies have won Miss Universe/Miss World titles over the past 10 years.

For the record: Azim Premji, the richest Muslim entrepreneur on the face of the planet, was born in Bombay and now lives in Bangalore. India now has more than three dozen billionaires; Pakistan has none (not a single dollar billionaire).

The other amazing aspect is the rapid pace at which India is creating wealth. In 2002, Dhirubhai Ambani, Mukesh and Anil Ambani's father, left his two sons a fortune worth $2.8 billion. In 2007, their combined wealth stood at $94 billion. On 29 October 2007, as a result of the stock market rally and the appreciation of the Indian rupee, Mukesh became the richest person in the world, with net worth climbing to US$63.2 billion (Bill Gates, the richest American, stands at around $56 billion).

Indians and Pakistanis have the same Y-chromosome haplogroup. We have the same genetic sequence and the same genetic marker (namely: M124). We have the same DNA molecule, the same DNA sequence. Our culture, our traditions and our cuisine are all the same. We watch the same movies and sing the same songs. What is it that Indians do and we don't: Indians elect their leaders.

The writer is an Islamabad-based freelance columnist. Email: farrukh15@hotmail.com

(Collection:: http://www.thenews.com.pk/editorial_detail.asp?id=85171)


Mar 2, 2008

VIP WIN32 / MFC Questions

What is the difference between process and thread ?

1. A process can have many threads. So to perform a task faster we break the process in threads.

2. Creation of new process requires new resources and Address space whereas the thread can be created in the same address space of the process which not only saves space and resources but are also easy to create and delete,and many threads can exhists in a process

3.Process is some job or task which is running in background.while a thread is a single line of execution in a programs , so many threads can be there in a program.

4.A thread is a stream of instructions which can be scheduled independently(i.e it has its own program counter and stack).But a thread shares its resources like program code,directories and global data with the calling process.A process on the other hand has its own copy of both resources and scheduling information.A process can have many threads,basically threads are called light weight processes.

5.Differences Between Threads and Processes

Threads share the address space of the process that created it; processes have their own address.

Threads have direct access to the data segment of its process; processes have their own copy of the data segment of the parent process.


Threads can directly communicate with other threads of its process; processes must use inter-process communication to communicate with sibling processes.

Threads have almost no overhead; processes have considerable overhead.

New threads are easily created; new processes require duplication of the parent process.

Threads can exercise considerable control over threads of the same process; processes can only exercise control over child processes.

Changes to the main thread (cancellation, priority change, etc.) may affect the behavior of the other threads of the process, changes to the parent process does not affect child processes.


Both have an id, set of registers, state, priority, and scheduling policy.

Both have attributes that describe the entity to the OS.

Both have an information block.

Both share resources with the parent process.

Both function as independent entities from the parent process.

The creator can exercise some control over the thread or process.

Both can change their attributes.

Both can create new resources.

Neither can access the resources of another process.


(Note:: All above information is collected for various sources )