home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / win_lrn / i_o / getchand.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  899 b   |  41 lines

  1. /*
  2.  *
  3.  *  GetCodeHandle
  4.  *  
  5.  *  This program demonstrates the use of the function GetCodeHandle.
  6.  *  This function determines which code segment contains the funtion
  7.  *  pointed to by the parameter.
  8.  *  
  9.  *  Windows Version 2.0 function demonstration application
  10.  *
  11.  */
  12.  
  13. #include <windows.h>
  14. char szBuffer [70];
  15.  
  16. void FAR PASCAL GetMe ()
  17. {
  18.    int nTest = 0;
  19.  
  20.    nTest++;
  21. }
  22.  
  23. int PASCAL WinMain( hInstance, hPrevInstance, lpszCmdLine, cmdShow )
  24. HANDLE hInstance, hPrevInstance;
  25. LPSTR  lpszCmdLine;
  26. int    cmdShow;
  27. {
  28.   HANDLE hCode;
  29.   
  30.   MessageBox (NULL, (LPSTR)"Finding code segment of GetMe function",
  31.      (LPSTR)"GetCodeHandle", MB_OK);
  32.  
  33.   hCode = GetCodeHandle ( (FARPROC) GetMe );
  34.   sprintf (szBuffer, "The handle to GetMe's code segment is %x", hCode);
  35.   MessageBox (NULL, (LPSTR)szBuffer, (LPSTR)"GetCodeHandle",
  36.               MB_OK);
  37.   return 0;
  38.  
  39. }
  40.  
  41.