Page 23 - DCAP408_WEB_PROGRAMMING
P. 23

Unit 1: Windows Programming Basics




          If  an  application  has  already  been  formed,  to  obtain  its  instance,  you  can  call  the  Notes
          GetWindowLong() function. Its syntax is:


          Even though this function is used for many other reasons, it can also aid you get the instance of
          an application. To perform this, pass the first argument as  the handle to a  window of  the
          application you are probing and pass the second argument as GWL_HINSTANCE.

          Self Assessment

          Fill in the blank:

          14.  If  an  application  has  already  been  formed,  to  obtain  its  instance,  you  can call  the
               ........................ function.

          1.9 Compiling Windows Program

          Click the Run button (displayed below with the arrow) and wait a few seconds. This compiles
          the program to an EXE file and runs it:















          When the program runs, you will observe the dialog on the screen. It appears like this:















          You  have effectively written a  Windows program  that could  execute under  any version  of
          Windows.  The window above is portion of the EXE  file, and  it can  outside the  Developer
          Environment if required. Press the “Close me” button to finish the program. The Close button
          triggers the Command event, which unloads the dialog. The program will then end since it has
          no windows left.
          The resource data is stored in separate file in windows programs, compiling a DOS program is
          not more involved then the process of putting together a complete Windows program. Figure
          1.1 shows that how a C program is run under DOS, how it is being compiled and linked to create
          a finished program. Under DOS, the C compiler converts the source code file into an objective
          file. A linker converts the objective file into the finished executable program. In this way a
          source code can be converted to the finished program with the help of compiler and linker.





                                           LOVELY PROFESSIONAL UNIVERSITY                                   17
   18   19   20   21   22   23   24   25   26   27   28