1. What is the base class for MFC Framework ?
2. If i derive a new class from CObject what are the basic features my derived wil get ?
3. What is the use of CCmdTarget ?
4. What is document-view architecture ? Give me one real time example for SDI ?
5. Can you explaing the relashionship between document,frame and view ?
6. How to access document object from view ?
5. What is the entry point for window based applications ?
6. Explain the flow for a simple win32 based application ?
7. How to handle command line arguements from simple MFC application ?
8. What is model and modeless dialog box ? Give some examples?
9. How to create open & save dialogs ?
10.What is CSingleDocTemplate?
11.What is the difference between hinsrtance and hprevinstance in WinMain function?
12.Explaing about MDI and CMultiDocTemplate ?
13.Tell me the different controls in MFC ?
14. What is the use of OninitDialog ?
15. What is the use of UpdateData funciton ?
16.What is the difference between GetMessage and PeekMessage ?
17.How to update all the views whenver document got updated ?
18.How to handle RTTI in MFC ?
19.What is serialization ?which function is responsible for serializing data ?
20.What is CArchive class dowes?
21.What is thread & process?
22.Explain about different kinds of threads in MFC?
23.Tell me about different kinds of synchranization objects ?
24.what is the use of Mutex and critical section ?
25.What is socket?
26.What is the difference between Synchronous sockets and asynchronous sockets?
27.Have you ever used win32 APIs ?
28.What is the difference between ANSI Code and UNICODE ?
29.What is the difference between regular dlls and extended dlls?
30.what is the use of AFX_MANAGE_STATE ?
31. What’s the difference between PostMessage and SendMessage?
32. Describe the Document/View architecture.
33. What’s the difference between Modal and Modeless Dialog?
34. How to create a Modeless Dialog?
35. How to setup a timer?
36. Name the Synchronization objects.
37. What is a critical section and how is it implemented?
38. What is CMutex?
39. Given two processes, how can they share memory?
38. What is a message map, and what is the advantage of a message map over virtual functions?
40. What is the difference between ASSERT and VERIFY?
41. Why wizards generate enum IDD for dialogs?
2. If i derive a new class from CObject what are the basic features my derived wil get ?
3. What is the use of CCmdTarget ?
4. What is document-view architecture ? Give me one real time example for SDI ?
5. Can you explaing the relashionship between document,frame and view ?
6. How to access document object from view ?
5. What is the entry point for window based applications ?
6. Explain the flow for a simple win32 based application ?
7. How to handle command line arguements from simple MFC application ?
8. What is model and modeless dialog box ? Give some examples?
9. How to create open & save dialogs ?
10.What is CSingleDocTemplate?
11.What is the difference between hinsrtance and hprevinstance in WinMain function?
12.Explaing about MDI and CMultiDocTemplate ?
13.Tell me the different controls in MFC ?
14. What is the use of OninitDialog ?
15. What is the use of UpdateData funciton ?
16.What is the difference between GetMessage and PeekMessage ?
17.How to update all the views whenver document got updated ?
18.How to handle RTTI in MFC ?
19.What is serialization ?which function is responsible for serializing data ?
20.What is CArchive class dowes?
21.What is thread & process?
22.Explain about different kinds of threads in MFC?
23.Tell me about different kinds of synchranization objects ?
24.what is the use of Mutex and critical section ?
25.What is socket?
26.What is the difference between Synchronous sockets and asynchronous sockets?
27.Have you ever used win32 APIs ?
28.What is the difference between ANSI Code and UNICODE ?
29.What is the difference between regular dlls and extended dlls?
30.what is the use of AFX_MANAGE_STATE ?
31. What’s the difference between PostMessage and SendMessage?
32. Describe the Document/View architecture.
33. What’s the difference between Modal and Modeless Dialog?
34. How to create a Modeless Dialog?
35. How to setup a timer?
36. Name the Synchronization objects.
37. What is a critical section and how is it implemented?
38. What is CMutex?
39. Given two processes, how can they share memory?
38. What is a message map, and what is the advantage of a message map over virtual functions?
40. What is the difference between ASSERT and VERIFY?
41. Why wizards generate enum IDD for dialogs?
How to handle RTTI in MFC ?
But CRunTimeClass can be use to identify the type of the
class which are derived from CObject.
For eg -
void MyFunction()
{
CObject *mObject = new MyClass;
if(mObject->IsKindOf(RUNTIME_CLASS( MyClass) ) )
{
printf("Class is of type MyClass\n");
}
else
{
printf("Class is of type someotherclass\n");
}
}
We can use "type_info" for other type of classes which are
not
derived from CObject.
How to handle dynamic menus in MFC?
Dynamic menus can be handled using Cmenu's Createmenu, insertmenu and Appendmenu functions.
Which MFC function is used to display output?
What is the base class for most MFC classes?
What function is used to retrieve the currently selected
index in a list box?
Tell me the different controls in MFC ?
What is the difference between GetMessage and PeekMessage
?
GetMessage function waits for a message to be
placed in the queue before returning where as PeekMessage function does not wait
for a message to be placed in the queue before returning.
What’s the difference between PostMessage and
SendMessage?
The PostMessage function places (posts) a
message in the message queue associated with the thread that created the
specified window and then returns without waiting for the thread to process the
message.
The SendMessage function sends the specified message to a window or windows. The function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
The SendMessage function sends the specified message to a window or windows. The function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
What
is the difference between hinstance and hprevinstance in WinMain function?
What’s
the difference between Modal and Modeless Dialog?
What
is Thread ?(VC++)What is the difference between Cmutex and Csemaphone?
An object of class CMutex represents a “mutex” — a
synchronization object that allows one thread mutually exclusive access to a
resource. Mutexes are useful when only one thread at a time can be allowed to
modify data or some other controlled resource. For example, adding nodes to a
linked list is a process that should only be allowed by one thread at a time.
By using a CMutex object to control the linked list, only one thread at
a time can gain access to the list.
To use a CMutex object, construct the CMutex object when it is needed. Specify the name of the mutex you wish to wait on, and that your application should initially own it. You can then access the mutex when the constructor returns. Call CSyncObject::Unlock when you are done accessing the controlled resource.
An alternative method for using CMutex objects is to add a variable of type CMutex as a data member to the class you wish to control. During construction of the controlled object, call the constructor of the CMutex data member specifying if the mutex is initially owned, the name of the mutex (if it will be used across process boundaries), and desired security attributes.
To access resources controlled by CMutex objects in this manner, first create a variable of either type CSingleLock or type CMultiLock in your resource’s access member function. Then call the lock object’s Lock member function (for example, CSingleLock::Lock). At this point, your thread will either gain access to the resource, wait for the resource to be released and gain access, or wait for the resource to be released and time out, failing to gain access to the resource. In any case, your resource has been accessed in a thread-safe manner. To release the resource, use the lock object’s Unlock member function (for example, CSingleLock::Unlock), or allow the lock object to fall out of scope
To use a CMutex object, construct the CMutex object when it is needed. Specify the name of the mutex you wish to wait on, and that your application should initially own it. You can then access the mutex when the constructor returns. Call CSyncObject::Unlock when you are done accessing the controlled resource.
An alternative method for using CMutex objects is to add a variable of type CMutex as a data member to the class you wish to control. During construction of the controlled object, call the constructor of the CMutex data member specifying if the mutex is initially owned, the name of the mutex (if it will be used across process boundaries), and desired security attributes.
To access resources controlled by CMutex objects in this manner, first create a variable of either type CSingleLock or type CMultiLock in your resource’s access member function. Then call the lock object’s Lock member function (for example, CSingleLock::Lock). At this point, your thread will either gain access to the resource, wait for the resource to be released and gain access, or wait for the resource to be released and time out, failing to gain access to the resource. In any case, your resource has been accessed in a thread-safe manner. To release the resource, use the lock object’s Unlock member function (for example, CSingleLock::Unlock), or allow the lock object to fall out of scope
Can
you explaing the relashionship between document,frame and view ?
What
is the difference between Synchronous sockets and asynchronous sockets?
How
to create a Modeless Dialog?
Explain
about MDI and CMultiDocTemplate ?
What
function is used to disable a control at runtime?
EnableWindow(FALSE)
// Get a pointer to the control's window.
CWnd *p = GetDlgItem(IDC_NEWCONTROL);
// Disable the control.
p->EnableWindow(FALSE);
What
is the use of UpdateData funciton ?
How
to update all the views whenver document got updated ?
What
MFC base classes provide support for ActiveX controls?
What
is the difference between regular dlls and extended dlls?
DLL is acronym of Dynamic Link Libraries.
The libraries (In simple functions) can be linked to the main program in two different ways as given below,
a) Statically linked (Static linking/Early Binding)
Link between main module and sub module is happened at compilation stage itself.
b) Dynamically linked (Dynamic linking/Late Binding).
Link between main module and sub module is happened at Run time.DLLs adhere dynamic binding.
Advantage of DLLs is that they are separate Object Binary (.obj) and kept aside/away of the main Executable (.exe) program.
They are loaded at Run-time on demand basis and can be unloaded if their purpose is solved. Since they are not the part of main exe the memory required to load main exe would be comparatively less. But the functions that were statically bound takes more memory and their object (.obj) binary would be the part of main exe (.exe)
Regular DLLs can be exported to any where irrespective of the technology/language in which they are used/called. For eg - Regular DLLs can be called from C,C++ and Visual Basic too. In simple they can be used any where even though the client program which is called don't have MFC libraries.
Extend DLLs -
In extended DLLs we can export total class itself. i.e we can export the member function of the classes. They requires MFC libraries in the client program from where they are called/used.
What
types of threads are supported by MFC framework?
What
is the use of AFX_MANAGE_STATE?
By default, MFC uses the resource handle of
the main application to load the resource template. If you have an exported
function in a DLL, such as one that launches a dialog box in the DLL, this
template is actually stored in the DLL module. You need to switch the module
state for the correct handle to be used. You can do this by adding the
following code to the beginning of the function:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
This swaps the current module state with the state returned from AfxGetStaticModuleState until the end of the current scope.
If all your resources lies in the single DLL you can even change the default handle to the DLL handle with the help of AfxSetResourceHandle function.
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
This swaps the current module state with the state returned from AfxGetStaticModuleState until the end of the current scope.
If all your resources lies in the single DLL you can even change the default handle to the DLL handle with the help of AfxSetResourceHandle function.
By default, MFC uses the resource handle of the main application to load the resource template.
If you have an exported function in a DLL, such as one that launches a dialog box in the DLL, this template is actually stored in the DLL module. You need to switch the module state for the correct handle to be used. You can do this by adding the following code to the beginning of the function:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
This swaps the current module state with the state returned from AfxGetStaticModuleState until the end of the current scope.
If all your resources lies in the single DLL you can even change the default handle to the DLL handle with the help of AfxSetResourceHandle function
How
to convert a CString variable to char* or LPTSTR?
There are two ways
I) Use CString::GetBuffer(). It can be used in a manner similar to this:
// prototype of a function that takes a LPTSTR parameter
// presented for argument's sake.
void test_func ( LPTSTR lpszString, int length );
CString string;
test_func ( string.GetBuffer ( 50 ), 50 );
string.ReleaseBuffer ( );
Forgetting to call CString::ReleaseBuffer() can cause problems very difficult to debug as it releases the lock on CString's inner buffer.
One thing to keep in mind about CString::GetBuffer() is that it returns a TCHAR* value (or LPTSTR, it's the same),
so it is subject to the same ANSI/MBCS Vs. UNICODE convertions as most other Win32 APIs. It also means that if
you're compiling a unicode version of your application, and specifically need a char* from your CString instance,
you'll have to use a separate buffer of the appropriate type, and then make the convertion to unicode using one of
the available API's before asigning it's value to the CString instance. The same goes if you're doing the exact opposite: getting a WCHAR* out of a CString, while compiling in MBCS mode.
ii) Use a temporary variable. For example:
char temp[256];
CString string;
test_func ( temp, 256 );
string = temp;
If
i derive a new class from CObject what are the basic features my derived wil
get ?
What
is the use of OninitDialog ?
What is the difference between ASSERT and
VERIFY?
The main difference between ASSERT and VERIFY is when you
compile the release build of the program.
ASSERT will not be present in the release build version of the executables/dlls, and its expression that would have been evaluated will be deleted.
VERIFY will be present in the release build version of the executables/dlls but its expression that would have been evaluated will be left intact.
ASSERT will not be present in the release build version of the executables/dlls, and its expression that would have been evaluated will be deleted.
VERIFY will be present in the release build version of the executables/dlls but its expression that would have been evaluated will be left intact.
Why wizards
generate enum IDD for dialogs?
It's good programming practice to do it this
way, as from the client code you can always refer to the CMyDlg::IDD without
worrying what the actual constant is.
What is
CArchive class does?
The CArchive class allows you to save a
complex network of objects in a permanent binary form (usually disk storage)
that persists after those objects are deleted. Later you can load the objects
from persistent storage, reconstituting them in memory. This process of making
data persistent is called “serialization.”
How to
handle command line arguements from simple MFC application ?
m_lpCmdLine
Corresponds to the lpCmdLine parameter passed by Windows to WinMain. Points to
a null-terminated string that specifies the command line for the application.
Use m_lpCmdLine to access any command-line arguments the user entered when the
application was started. m_lpCmdLine is a public variable of type LPTSTR.
BOOL CMyApp::InitInstance()
{
// ...
if (m_lpCmdLine[0] == _T('\0'))
{
// Create a new (empty) document.
OnFileNew();
}
else
{
// Open a file passed as the first command line parameter.
OpenDocumentFile(m_lpCmdLine);
}
// ...
}
What is the
base class for MFC Framework ?
CObject
If I derive
a new class from CObject what are the basic features my derived will get?
Searialization, Debugging support, Runtime
time class information, compatibility with collection classes.
What is the
use of CCmdTarget ?
It is the base class for the MFC library
message map architecture.Which maps commands/messages to the member functions
to handle them. Classes derived from this are CWnd,CWinApp,CFrameWnd,CView,
CDocument
What is
document-view architecture ? Give me one real time example for SDI ?
Document/view architecture, which defines a
program structure that relies on document objects to hold an application's data
and on view objects to render views of that data. MFC provides the
infrastructure for documents and views in the classes CDocument and CView.
example of SDI is a wordpad application
example of SDI is a wordpad application
Can you
explain the relashionship between document,frame and view ?
The frame window is the application's
top-level window. It's normally a WS_OVERLAPPEDWINDOW-style window with a
resizing border, a title bar, a system menu, and minimize, maximize, and close
buttons.
The view is a child window sized to fit the frame window so that it becomes the frame window's client area.
The application's data is stored in the document object, a visible representation of which appears in the view.
For an SDI application, the frame window class is derived from CFrameWnd, the document class is derived from CDocument, and the view class is derived from CView or a related class such as CScrollView.
The view is a child window sized to fit the frame window so that it becomes the frame window's client area.
The application's data is stored in the document object, a visible representation of which appears in the view.
For an SDI application, the frame window class is derived from CFrameWnd, the document class is derived from CDocument, and the view class is derived from CView or a related class such as CScrollView.
How to
access document object from view ?
Using GetDocument() function within a CView
class.
What is the
entry point for window based applications ?
WinMain() is the entry point for window based
applications.
Explain the
flow for a simple win32 based application ?
Starting point for win32 based applications
is WinMain()
WinMain begins by calling the API function RegisterClass to register a window class.
The window class(WNDCLASS) defines important characteristics of a window such as its window procedure address, its default background color, and its icon.
Once the WNDCLASS is registered, WinMain calls the all-important CreateWindow function to create the application's window.
WinMain follows CreateWindow with calls to ShowWindow and UpdateWindow, which make the window visible and ensure that its WM_PAINT handler is called immediately.
Next comes the message loop. In order to retrieve and dispatch messages, WinMain executes a simple while loop that calls the GetMessage, TranslateMessage, and DispatchMessage API functions repeatedly.
GetMessage checks the message queue. If a message is available, it is removed from the queue and copied to msg;
TranslateMessage converts a keyboard message denoting a character key to an easier-to-use WM_CHAR message,
and DispatchMessage dispatches the message to the window procedure. The message loop executes until GetMessage returns 0, which happens only when a WM_QUIT message is retrieved from the message queue. When this occurs, WinMain ends and the program terminates.
WinMain begins by calling the API function RegisterClass to register a window class.
The window class(WNDCLASS) defines important characteristics of a window such as its window procedure address, its default background color, and its icon.
Once the WNDCLASS is registered, WinMain calls the all-important CreateWindow function to create the application's window.
WinMain follows CreateWindow with calls to ShowWindow and UpdateWindow, which make the window visible and ensure that its WM_PAINT handler is called immediately.
Next comes the message loop. In order to retrieve and dispatch messages, WinMain executes a simple while loop that calls the GetMessage, TranslateMessage, and DispatchMessage API functions repeatedly.
GetMessage checks the message queue. If a message is available, it is removed from the queue and copied to msg;
TranslateMessage converts a keyboard message denoting a character key to an easier-to-use WM_CHAR message,
and DispatchMessage dispatches the message to the window procedure. The message loop executes until GetMessage returns 0, which happens only when a WM_QUIT message is retrieved from the message queue. When this occurs, WinMain ends and the program terminates.
What is
model and modeless dialog box ? Give some examples?
When we create Modal Dialog Box we can't move
to other windows until this dialog is closed. For eg: MessageBox, where we
can't move to the other window until we press ok or cancel.
When we create Modeless Dilaog Box we can swap to the other windows. For eg: like a conventional window.
When we create Modeless Dilaog Box we can swap to the other windows. For eg: like a conventional window.
How to
create open & save dialogs ?
In CommonDialogs class we have to use
CFileDialog class where the first parameter TRUE for open dialog and FALSE for
Save dialog.
For file open:
CFileDialog SampleDlg(TRUE,NULL,NULL,OFN_OVERWRITEPROMPT,"Text Files (*.txt)|*.txt|Comma Separated Values(*.csv)|*.csv||");
int iRet = SampleDlg.DoModal();
For file open:
CFileDialog SampleDlg(TRUE,NULL,NULL,OFN_OVERWRITEPROMPT,"Text Files (*.txt)|*.txt|Comma Separated Values(*.csv)|*.csv||");
int iRet = SampleDlg.DoModal();
What is
CSingleDocTemplate?
It’s a document template class used to create single document interface SDI applications. Only one document can be opened at a time. It identifies the document class used to manage the application's data, the frame window class that encloses views of that data, and the view class used to draw visual representations of the data. The document template also stores a resource ID that the framework uses to load menus, accelerators, and other resources that shape the application's user interface.
What is the
difference between hinstance and hprevinstance in WinMain function?
hInstance is used for things like loading resources and any other task which is performed on a per-module basis. A module is either the EXE or a DLL loaded into your program. hPrevInstance used to be the handle to the previously run instance of your program (if any) in Win16. It is always NULL for Win32 programs.
Explain
about MDI and CMultiDocTemplate ?
MDI applications are designed using the
doc-view architectures in which there could be many views associated with a
single document object and an application can open multiple docuements at the
same time for eg:WORD.
In MDI terms, your main window is called the Frame, this is probably the only window you would have in a SDI (Single Document Interface) program. In MDI there is an additional window, called the MDI Client Window which is a child of your Frame window. CMultiDocTemplate is the document template class used to create MDI applications..The document template also stores a resource ID that the framework uses to load menus, accelerators, and other resources that shape the application's user interface.
In MDI terms, your main window is called the Frame, this is probably the only window you would have in a SDI (Single Document Interface) program. In MDI there is an additional window, called the MDI Client Window which is a child of your Frame window. CMultiDocTemplate is the document template class used to create MDI applications..The document template also stores a resource ID that the framework uses to load menus, accelerators, and other resources that shape the application's user interface.
Tell me the
different controls in MFC ?
CAnimateCtrl,CButton,CEdit,CListBox,CComboBox,CRic
hEditCtrl,CStatic, CTreeCtrl,CToolTipCtrl,CIPAddressCtrl,CTabCtrl,CDa
teTimeCtrl,CHeaderCtrl,CListCtrl,CMonthCalCtrl,COl
eCtrl,CProgressCtrl,CScrollBar,CSliderCtrl,CStatus BarCtrl,CTollBarCtrl etc.,
What is the
use of OnInitDialog ?
This message is sent to the dialog box during
the Create, CreateIndirect, or DoModal calls, which occur immediately before
the dialog box is displayed. This can be used to intialize the dialog controls
or show/hide the controls etc.,
What is the
functioning of UpdateData() funciton ?
This is to initialize data in a dialog box,
or to retrieve and validate dialog data.
The framework automatically calls UpdateData with bSaveAndValidate set to FALSE when a modal dialog box is created in the default implementation of CDialog::OnInitDialog. The call occurs before the dialog box is visible. The default implementation of CDialog::OnOK calls this member function with bSaveAndValidate set to TRUE to retrieve the data, and if successful, will close the dialog box. If the Cancel button is clicked in the dialog box, the dialog box is closed without the data being retrieved.
The framework automatically calls UpdateData with bSaveAndValidate set to FALSE when a modal dialog box is created in the default implementation of CDialog::OnInitDialog. The call occurs before the dialog box is visible. The default implementation of CDialog::OnOK calls this member function with bSaveAndValidate set to TRUE to retrieve the data, and if successful, will close the dialog box. If the Cancel button is clicked in the dialog box, the dialog box is closed without the data being retrieved.
How to
update all the views whenever document got updated ?
call UpdateAllViews()- which updates all
views associated with the document by calling OnUpdate() function of all the
views.
How to
handle RTTI in MFC ?
Run-Time Type Information is a mechanism that
allows the type of an object to be determined during the program execution.
3 main elements to RTTI in MFC are
1.Dynamic_cast operator
Used for conversion of polymorphic types.
2.typeid - used for identifying the exact type of an object
3. type_info class
used to hold the type information returned by typeid.
3 main elements to RTTI in MFC are
1.Dynamic_cast operator
Used for conversion of polymorphic types.
2.typeid - used for identifying the exact type of an object
3. type_info class
used to hold the type information returned by typeid.
What is
serialization ?which function is responsible for serializing data ?
Searialization is the process of streaming
the object data to or from a persistent storage medium. It's useful in Doc-View
Architecture. CObject :: Serialize() function is used to do serialization.
Explain
about different kinds of threads in MFC?
2 types of thread in MFc are UserInterface
thread and worker thread. UserInterface threads maintain the message loops and
used to handles user input,creates windows and process messges sent to those
windows.Worker thread don't use message loops and mainly used to perform
background operations such as printing etc.,Created using AfxBeginThread
bypassing ThreadFunction to create worker thread and Runtime class object to
create a user interface thread.
what is the
use of Mutex and critical section ?
Mutex as the name suggest allows a mutullay
exclusive access to a shared resource among the threads. Critical section is a
piece of code that can be executed safely to be accessed by two or more
threads. Criticalsection provides synchronization means for one process only,
while mutexes allow data synchronization across processes. Means two or more
threads can share the common resources among more than one application or
process boundaries in mutex.
What is
socket?
A "socket" is an endpoint of
communication: an object through which your application communicates with other
Windows Sockets applications across a network.The two MFC Windows Sockets
programming models are supported by the following classes: CAsyncSocket and
CSocket
What is the
difference between Synchronous sockets and asynchronous sockets?
Consider a server application that is
listening on a specific port to get data from clients. In synchronous
receiving, while the server is waiting to receive data from a client, if the
stream is empty the main thread will block until the request for data is
satisfied. Hence, the server cannot do anything else until it receives data
from the client. If another client attempts to connect to the server at that
time, the server cannot process that request because it is blocked on the first
client. This behavior is not acceptable for a real-world application where we
need to support multiple clients at the same time.
In asynchronous communication, while the server is listening or receiving data from a client, it can still process connection requests from other clients as well as receive data from those clients. When a server is receiving asynchronously, a separate thread (at the OS level) listens on the socket and will invoke a callback function when a socket event occurs. This callback function in turn will respond and process that socket event.
In asynchronous communication, while the server is listening or receiving data from a client, it can still process connection requests from other clients as well as receive data from those clients. When a server is receiving asynchronously, a separate thread (at the OS level) listens on the socket and will invoke a callback function when a socket event occurs. This callback function in turn will respond and process that socket event.
Have you
ever used win32 APIs ?
MFC is a wrapper around win32 API, It
provides classes which uses the win32 API, Some of the API's we usually work
with are : GetDlgItemInt,GetDlgItemText,GetWindowTextA,Messag
eBoxA,CreateFile,CreateMutex,CreateEvent,WaitForSi
ngleObject,CreateWindow,ShowWindow etc.,
What is the
difference between ANSI Code and UNICODE ?
ANSI code represents 8bytes data where
UNICODE represents 16bytes data for supporting universal languages. One major
draw back to ASCII was you could only have 256 different characters. However,
languages such as Japanese and Arabic have thousands of characters. Thus ASCII
would not work in these situations. The result was Unicode which allowed for up
to 65,536 different characters
What is the
difference between regular dlls and extended dlls?
Regular dlls wraps only the c/c++ functions.
Where extention dlls include c++ interfaces where we can create the objects of
it and use in our classes. Extended dlls support object oriented
concepts.Regural dlls uses mfc internally and exported functions can be used by
any mfc or non-mfc applications.Extention dlls implements reusable classes
derived from mfc library,built using dll version of mfc.Only mfc executables(applications/dll-shared
version of mfc) can use extention dlls.extention dlls used for passing mfc
derived objects b/w applications and dlls. Regulardlls linked both statically
and dynamically but extended dlls links dynamically.
What is a
message map, and what is the advantage of a message map over virtual functi
MessageMap is a logical table that maps the
windows messages to the member functions of the class. We use message maps over
virtual function because of lots of overhead. If every windows message had a
virtual function associated with it , there would be several hundred bytes per
window class of vtable. Message maps means we only pay for the messages we use.
Given two
processes, how can they share memory?
Processes and thread are very similar but
they differ in the way they share their resources. Processes are independent
and have its own address space. If two independent processes want to
communicate they do this by using the following techniques 1.Message Passing
2.Sockets 3. named pipes
How to
restrict only one instance of a class object to be created?
Create a Named Mutex.
HANDLE hMutex=CreateMutex(TRUE,_T(“NamedMutex”))
HANDLE hMutex=CreateMutex(TRUE,_T(“NamedMutex”))
How do I
dynamically change the mainframe menu?
CMenu newMenu;
newMenu.LoadMenu (IDR_MENU1);
AfxGetMainWnd()->SetMenu( &newMenu );
AfxGetMainWnd()->DrawMenuBar();
newMenu.Detach ();
newMenu.LoadMenu (IDR_MENU1);
AfxGetMainWnd()->SetMenu( &newMenu );
AfxGetMainWnd()->DrawMenuBar();
newMenu.Detach ();
How to
restrict only one instance of a class object to be created?
Create a
Named Mutex.
HANDLE hMutex=CreateMutex(TRUE,_T(“NamedMutex”))
HANDLE hMutex=CreateMutex(TRUE,_T(“NamedMutex”))
And check the Mutex existence for each of
your instance launch and dont allow it to launch if it exists.
How to restrict only one
instance of a class object to be created?
This answer is sutable for restrict only one
instance of a process, if u want make singleton class make custructor as
private
Given two
processes, how can they share memory?
Processes and thread are very similar but
they differ in the way they share their resources. Processes are independent
and have its own address space. If two independent processes want to
communicate they do this by using the following techniques 1.Message Passing
2.Sockets 3. named pipes
simple one
Use memory-mapped files to share data memory between processes
Use memory-mapped files to share data memory between processes