Skip to main content

Posts

Showing posts with the label Win32

What is a DLL ? What are different dll's supported in VC++ ? Explain different types of dll's.

A DLL is a dynamic link library. It provide a way of sharing common code at runtime . Any appication( exe) can load a dll in to memory at runtime, retrieving the address of the fuctions to be called / accessing resources or variables. client can use the functions, variable or resources and unloads the dll from memory. One can load the dlls either statically or dynamically. Dynamically loading - HANDLE h = LoadLibrary("MyDll.dll"); // load dll typedef FUNPTR (void) (*funcPtr ) (); // create a fuction pointer with matching signature // with that of exported function from dll. FUNPTR show = GetProcAddress( h, "Show"); // Get function address show(); // Call the fuction FreeLibrary(h); // unload dll from memory Statically loading: Include the .h file and specify .lib file to the linker for specified dll. User can access the dll content ( Exported fuctions, resources, variables) at compile time itself. Regular, Extension and pure Win32 DLL (without MFC) Regular DLL Regul...

What is the use of SendMessage() and PostMessage() ? what is the difference between SendMessage() and PostMessage() ?

These are theWin32 API's provided to send a message to window Or a way to notify a window to perform some action. SendMessage() - This message is sent directly to the window. It means it doesn't return until, the "sent message" is not processed( Message handler is not executed). PostMessage() - This message is sent to the application message queue, from where application will pick up the message later on, gets processed. This API returns immediately as soon as it posts the message to message queue. It never waits for the respective message handler to be executed.