7/21/08

Windows Programming Questions

How would you find the brushes or fonts used by the system to draw menus, dialog boxes and text?

How would you start a new thread?

Afxbeginthread – for worker thread only global fuction passed as parameter

For ui thread , a class derived from CWinThread passed as parameter


When should an application call _beginthread rather than CreateThread?

If apliation is using C run-time library (CRT) then.

How would you check if a process has terminated?

GetexitCode()

Why would you use a critical section instead of a mutex? Are there any situations when a mutex would have to be used?

Mutexes are slower thatn CS.

If we want to synchronise two thread acrossdifferent processes then

Name five IPC mechanisms supported by Window XP. What about Windows CE?

What is the difference between implicit and explicit loading of a dll?

Static linking which loads automatically.- loaded throughout life of program

Explicit – can use loadlibrary – take the fuction ptr use and unload library.

What is the Message Compiler and when would it be used?

How would you declare a string which could be used in an ANSI or UNICODE build? Which header would you include to support functions which could use either version of this string?

Enclosed inside _T() macro for unicoade for ansi normal one (Without)

What are BSTRs and when are they used?

They double byte strings used for COM.

What is the difference between a variable of type INT and a variable of type INT_PTR?

One is the variable,another is pointer to some location

How would you determine the correct size of icons for fitting into a standard windows caption?

Why is it bad to call FindWindow based on a Window Title?

What is the difference between GetWindowRect and GetClientRect?How do you find the client rect of a child window inside another window relative to the parent?

Window - It’s the size of window frame.

Clients-working area.


Get the handle to the child window. And call getclientrect

Your Ad Here

What form of Unicode encoding is standard on Windows? What other character encoding formats are you likely to encounter?

You find yourself drawing a string where letters appear as box characters on the screen. Why might this happen, and what would you do about it? What if the string contains characters from different code pages?

It’s a different character set.

What interface do all COM classes implement and what is its purpose?

Interface is the way of communicating with com.

What do you do if you have a pointer to a COM object implementing one interface but need to use another?


Why do windows have class names and window names?

It is registered to widows database to keep track of the activities.

We are building using a "Pocket PC 2003" SDK, for compatibility, but also running on "Mobile 5 Pocket PC" devices. On the Mobile 5 devices we need to make an API call that was not available in PPC 2003. That is, we will get a link error if we try to reference the function. How can we do it? FYI, the function is ExitWindowsEx.

Describe the different approaches you can use to synchronize threads/processes in win32.

1. Critical section – used for synchronizing threads from same process

2. Mutexes – used for synchronizing threads across different process.

3. Semaphore – maintains resource counting against number of processes using them.

4. Events -State signaling , set or reset state

Describe the basics of the WNDPROC architecture.

Its call back . having switch statement for proceeding messages.

What is a GUID and where is it used?

Globally uniq id to identify a com distinctly.

No comments: