Programming

Various C/C++ preprocessor directives

Basically in C++ they tried to reduce the usage of preprocesor . In C Its necessary to use the preprocessor statements. All the preprocessor start with thye #. SOME OF THE PREPROC STATEMENTS are #define    #elif   #else    #endif #error     #if    #ifdef   #ifndef #include   #line  #pragma  #undef #define ias generally a replacement of any thing which [...]

C++ Program : Preprocessor Compilation Linking

A C++ program  has following structure //  preprocesssor directives //global declarations // functn prototypes // class declartions ( may be in .h header files) int Main( int argc, char * argv[]) { //body of main } void function() { /// any func definitions } Preprocessor : Before actual  compilation of C++ source code starts, preprocessor [...]

Windows Programming and windows procedure

In old DOS based c programming, we have a program or set of instructions executing in sequential manner. Windows programming is more event based. Applications do the initialization draws windows (for user input) and runs in loop to process the Event sent by operating System. So when we have any event in computer system, typically [...]

Introduction to Windows process

Every application executing on Windows is a process. Process is running instace of program. It has two components Kernel Object and Address space. Kernel object is being used by OS to manage the process and it has various statistical information about the Process. So using kernel object one can manipulate the process. The process address [...]

C, C++ entry point function main

For every C, C++ Program there is a entry point function, where program execution starts. Essentially Operating system looks for this function fro where program can be executed. This entry function  is ” main” Default code looks like given below int main ( int argc,  char *argv[]) { return 0; } So this function returns [...]

CObject : Top MFC base class

  CObject is the topmost  base class of  Microsot Foundation Classes ( MFC). Most of the classes in MFC are derived from CObject class. CObject class provides following functionality. 1. Dignostic support : This is used for debugging and troubleshooting purpose. Such as dumping the contents of Object. 2. Runtime class Identification : Knowing the [...]

MFC Programming

Microsoft Foundation Classes or MFC is the wrapper classes around Win32 API’s. Essentially they provide the Windows programming in Object oriented ways. They themselves don’t provide any windows functionality but they facilitate the programmers to do windows programming with an ease and rapid development. Somehow windows programing using API are tedious and time consuming. MFC provide [...]

Java Test : Where in a constructor, can you place a call to a constructor defined in the super class?

(1) Anywhere (2) The first statement in the constructor (3) The last statement in the constructor (4) You can’t call super in a constructor

PHP Test : What is the difference between mysql_pconnect() and mysql_connect()

(1) mysql_connect() returns NULL on failure (2) mysql_pconnect() has a timeout period (3) If a connection is already existing, mysql_pconnect() would return that. There is no way mysql_connect() can be made to do that (4) The connection initiated by mysql_pconnect() will not be closed when the execution of the script ends

PHP Test : What does session_start() do?

  (1) Creates a new PHP->MySql session (2) Creates/resumes a session based on some parameters sent via POST request/cookie (3) Used to send few headers (4) Mandatory before any cookie/login/mysql-connection is initiated

C++ Test : Which object will be initialized faster?

class A {   public:      int a;      A(int x){a = x;} }; class B{    public:        int a;        A(int x):a(x){} }; (1) Class A object would initialize faster (2) Class B object would initialize faster (3) Both will generate the same compile codes, time taken to initialize [...]

Comparison between C++ structure C++ class

C++ Structure : 1. C++ structure can have Data member and function members as well ( C structure doesn’t have function members) 2. C++ Structure can have access specifier. default access is Public 3. C++ Structure Can be inherited just like the classes. C++ Classes : 1. C++ Class can have Data member and function [...]

How does SendMessage differs from PostMessage

In Windows programming, the way user can interact with an application is using Windows – User Interface element. How the interaction happen is, by sending messages or events to window or application. With every Windows application (Process) there is a primary thread associated with it. So thread is entity that can be scheduled for execution [...]

MFC Win32 COM Windows Programming Questions

What is the base class for MFC Framework ? CObject 2. If i derive a new class from CObject what are the basic features my derived wil get ? Runtime class identification/ dynamic object creation (b) Synchronization (c) diagnostic support. 3. What is the use of CCmdTarget ? Command routing 4. What is document-view architecture [...]

Global/Static variables and external/internal linkage

In C/C++ variables can be of type global, static, local/auto and register type. The linkage is useful to know relation between lifetime and the scope or the accessibility of the variable at particular place.During the program compilation they are linked( to the other part of program) in two ways, External or internal linkage. External linkage [...]