コード例 #1
0
ファイル: BEEPER1.CPP プロジェクト: amitahire/development
long FAR PASCAL _export WndProc (HWND hwnd,
                                 UINT message,
                                 UINT wParam,
                                 LONG lParam)
   {
   static BOOL    fFlipFlop = FALSE;
   static UINT    Red=255,
                  Green=0,
                  Blue=0;
   HBRUSH         hBrush;
   HDC            hdc;
   PAINTSTRUCT    ps;
   RECT           rc;                  

                  
//   TRACE_STR("ENTER WndProc");
   switch(message)
      {
      case WM_TIMER :
         {
//         MessageBeep(0);

         fFlipFlop = !fFlipFlop;
         InvalidateRect(hwnd,NULL,FALSE);
         return 0;
         }
      case WM_PAINT :
         {
         hdc = BeginPaint(hwnd,&ps);

         GetClientRect(hwnd, &rc);
         Red   = (Red+7)    % 256;
         Green = (Green+25) % 256;
//         Blue  = Blue++  % 256;
         hBrush = CreateSolidBrush(RGB(Red,Green,Blue));
         FillRect(hdc,&rc,hBrush);
         EndPaint(hwnd,&ps);
         DeleteObject(hBrush);
         return 0;
         
         }
      case WM_DESTROY :
         {
         // insert a WM_QUIT in the queue...
         KillTimer (hwnd, ID_TIMER);
         TRACE_STR("WM_DESTROY..");
         PostQuitMessage (0);
         TRACE_STR("EXIT WndProc");
         return 0;            
         }
      }//switch
//   TRACE_STR("EXIT WndProc");
   // *********************extremely important!!! ******************      
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   return DefWindowProc (hwnd, message, wParam, lParam);            
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   // *********************extremely important!!! ******************      
   } //WndProc
コード例 #2
0
ファイル: CHECKER3.CPP プロジェクト: amitahire/development
long FAR PASCAL _export ChildWndProc(HWND hwnd, 
                                     UINT message, 
                                     UINT wParam,
                                     LONG lParam)
   {
   HDC         hdc;
   PAINTSTRUCT ps;                                     
   RECT        rect;

   switch (message)
      {
      case WM_CREATE :
         {
         SetWindowWord(hwnd, 0,0);
         return 0;
         }
      case WM_LBUTTONDOWN :
         {
         SetWindowWord(hwnd, 0, 1 ^ GetWindowWord(hwnd,0));
         InvalidateRect(hwnd,NULL,FALSE);
         return 0;
         }  
   
      case WM_PAINT :
         {
         TRACE_STR("WM_PAINT..");
         //get the device context handle for use in painting the sucker...
         hdc = BeginPaint(hwnd, &ps);

         GetClientRect(hwnd, &rect);
         Rectangle(hdc,
                   0,
                   0,
                   rect.right,
                   rect.bottom);
         // draw an X if true!          
         if (GetWindowWord(hwnd,0))
            {
            MoveTo(hdc,0         ,0          );
            LineTo(hdc,rect.right,rect.bottom);
            MoveTo(hdc,0         ,rect.bottom);
            LineTo(hdc,rect.right,0          );
            }
         
         EndPaint (hwnd, &ps);
         TRACE_STR("EXIT WM_PAINT...");
         TRACE_STR("EXIT WndProc");
         return 0;      
         }
      }   // switch
   // *********************extremely important!!! ******************      
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   return DefWindowProc(hwnd,message,wParam,lParam);                
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   // *********************extremely important!!! ******************      
   }                                                                
コード例 #3
0
ファイル: TRACER.CPP プロジェクト: amitahire/development
main()
   {
   UINT x,
        *x_p1,
        *x_p2;
   UCHAR c,
        *c_p1,
        *c_p2;

   /* fire up debugger */
   /*                  */
#ifdef DEBUGGING
   if ((trcfile = fopen("tracer.trc", "w")) == NULL) 
      {
      printf("Can't open PC file");
      exit(0);
      }
   else 
      {
#endif
      for (x=0;x<test1_len;x++)
         {
         test1[x] = x+50;
         }
      for (x=0;x<test2_len;x++)
         {
         test2[x] = x*7;
         }
      TRACE_ARR(test1,test1_len);
      TRACE_ARR(test2,test2_len);
      TRACE_STR("a test of TRACE_STR");
      TRACE_STR("below should be an equals delimiter");
      TRACE_DELIM('=');
      x=42000;
      TRACE_INT(x); 
      c='a';
      TRACE_CHR(c); 
      x_p1 = &x;
      x_p2 = &x;
      c_p1 = &c;
      c_p2 = &c;

      /* just to invoke enter/exit defines */
      call_time_once();

      TRACE_FARP(x_p1);
      TRACE_FARP(x_p2);
      TRACE_FARP(c_p1);
      TRACE_FARP(c_p2);
#ifdef DEBUGGING
      fclose(trcfile);
      }
#endif
//   dump_arr(test1,test1_len);
//   dump_arr(test2,test2_len);
   }
コード例 #4
0
ファイル: DIGCLOCK.CPP プロジェクト: amitahire/development
long FAR PASCAL _export WndProc (HWND hwnd,
                                 UINT message,
                                 UINT wParam,
                                 LONG lParam)
   {
   HDC            hdc;
   PAINTSTRUCT    ps;

                  
//   TRACE_STR("ENTER WndProc");
   switch(message)
      {
      case WM_CREATE:
         {
         SetInternational();
         }
      case WM_TIMER :
         {
         InvalidateRect(hwnd,NULL,FALSE);
         return 0;
         }
      case WM_PAINT :
         {
         hdc = BeginPaint(hwnd,&ps);
         WndPaint(hwnd,hdc);
         EndPaint(hwnd,&ps);
         return 0;
         }

      case WM_WININICHANGE :
         SetInternational ();
         InvalidateRect(hwnd,NULL,TRUE);
      
         return 0;
         
      case WM_DESTROY :
         {
         // insert a WM_QUIT in the queue...
         KillTimer (hwnd, ID_TIMER);
         TRACE_STR("WM_DESTROY..");
         PostQuitMessage (0);
         TRACE_STR("EXIT WndProc");
         return 0;            
         }
      }//switch
//   TRACE_STR("EXIT WndProc");
   // *********************extremely important!!! ******************      
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   return DefWindowProc (hwnd, message, wParam, lParam);            
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   // *********************extremely important!!! ******************      
   } //WndProc
コード例 #5
0
ファイル: SaveLoad.cpp プロジェクト: dgu123/factplusplus
/*
 * Class:     uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
 * Method:    clearSaveLoadContext
 * Signature: (Ljava/lang/String;)Z
 */
JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_clearSaveLoadContext
  (JNIEnv * env, jobject obj, jstring str)
{
	TRACE_JNI("clearSaveLoadContext");
	TRACE_STR(env,str);
	JString* pContext = str ? new JString(env,str) : NULL;
	const char* context = pContext ? (*pContext)() : "";
	bool ret = getK(env,obj)->clearSaveLoadContext(context);
	delete pContext;
	return ret;
}
コード例 #6
0
ファイル: Expressions.cpp プロジェクト: dgu123/factplusplus
/*
 * Class:     uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
 * Method:    getBuiltInDataType
 * Signature: (Ljava/lang/String;)Luk/ac/manchester/cs/factplusplus/DataTypePointer;
 */
JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getBuiltInDataType
  (JNIEnv * env, jobject obj, jstring str)
{
	TRACE_JNI("getBuiltInDataType");
	TRACE_STR(env,str);
	TJNICache* J = getJ(env,obj);
	JString name(env,str);
	std::string DTName(name());
	if ( DTName == "http://www.w3.org/2000/01/rdf-schema#Literal" ||
		 DTName == "http://www.w3.org/2000/01/rdf-schema#anySimpleType" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#anyType" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#anySimpleType" )
		return J->DataType(J->EM->DataTop());

	if ( DTName == "http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral" ||
		 DTName == "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#string" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#anyURI" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#ID" )
		return J->DataType(J->EM->getStrDataType());

	if ( DTName == "http://www.w3.org/2001/XMLSchema#integer" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#int" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#long" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#nonNegativeInteger" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#positiveInteger" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#negativeInteger" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#short" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#byte" )
		return J->DataType(J->EM->getIntDataType());

	if ( DTName == "http://www.w3.org/2001/XMLSchema#float" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#double" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#real" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#decimal" )
		return J->DataType(J->EM->getRealDataType());

	if ( DTName == "http://www.w3.org/2001/XMLSchema#boolean" )
		return J->DataType(J->EM->getBoolDataType());

	if ( DTName == "http://www.w3.org/2001/XMLSchema#dateTimeAsLong" )
		return J->DataType(J->EM->getTimeDataType());

	std::stringstream err;
	err << "Unsupported datatype '" << DTName.c_str() << "'";
	Throw ( env, err.str().c_str() );
	return (jobject)0;
}
コード例 #7
0
ファイル: Expressions.cpp プロジェクト: dgu123/factplusplus
/*
 * Class:     uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
 * Method:    getNamedClass
 * Signature: (Ljava/lang/String;)Luk/ac/manchester/cs/factplusplus/ClassPointer;
 */
JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getNamedClass
  (JNIEnv * env, jobject obj, jstring str)
{
	TRACE_JNI("getNamedClass");
	TRACE_STR(env,str);
	TJNICache* J = getJ(env,obj);
	JString name(env,str);
	jobject ret = (jobject)0;
	try
	{
		ret = J->Class(J->getCName(name()));
	}
	catch (const EFPPCantRegName&)
	{
		Throw ( env, "FaCT++ Kernel: Can not register new class name" );
	}
	return ret;
}
コード例 #8
0
ファイル: Expressions.cpp プロジェクト: dgu123/factplusplus
/*
 * Class:     uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
 * Method:    getDataValue
 * Signature: (Ljava/lang/String;Luk/ac/manchester/cs/factplusplus/DataTypePointer;)Luk/ac/manchester/cs/factplusplus/DataValuePointer;
 */
JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getDataValue__Ljava_lang_String_2Luk_ac_manchester_cs_factplusplus_DataTypePointer_2
  (JNIEnv * env, jobject obj, jstring str, jobject type)
{
	TRACE_JNI("getDataValue");
	TRACE_STR(env,str);
	TJNICache* J = getJ(env,obj);
	JString name(env,str);
	jobject ret = (jobject)0;
	try
	{
		ret = J->DataValue ( J->EM->DataValue ( name(), getDataTypeExpr(env,type) ) );
	}
	catch (const EFPPCantRegName&)
	{
		Throw ( env, "FaCT++ Kernel: Can not register new data value" );
	}
	return ret;
}
コード例 #9
0
ファイル: Expressions.cpp プロジェクト: dgu123/factplusplus
/*
 * Class:     uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
 * Method:    getDataSubType
 * Signature: (Ljava/lang/String;Luk/ac/manchester/cs/factplusplus/DataTypeExpressionPointer;)Luk/ac/manchester/cs/factplusplus/DataTypeExpressionPointer;
 */
JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getDataSubType
  (JNIEnv * env, jobject obj ATTR_UNUSED, jstring str ATTR_UNUSED, jobject type ATTR_UNUSED)
{
	TRACE_JNI("getDataSubType");
	TRACE_STR(env,str);
//	TJNICache* J = getJ(env,obj);
	JString name(env,str);
	Throw ( env, "FaCT++ Kernel: unsupported operation 'getDataSubType'" );
	jobject ret = (jobject)0;
#if 0
	try
	{
		ret = DataTypeExpression ( env, getK(env,obj)->getDataTypeCenter().
								   getDataType ( name(), getDataExpr(env,type) ) );
	}
	catch (const EFPPCantRegName&)
	{
		Throw ( env, "FaCT++ Kernel: Can not register new data type" );
	}
#endif
	return ret;
}
コード例 #10
0
ファイル: base_index.cpp プロジェクト: pzatrick/ditz
main()
   {
   TBaseIndex bi1, bi2, bi3, bi4, bi5, bi6;
   
//   puts("bi1");
//   (bi1 += 2)
//      += 2;
//
//   puts("bi2");
//   (bi2 += 400)
//      += 600;

   puts("bi3");
   bi3 << 1 << 2 << 3;
   
//   puts("bi4");
//   (bi4 += 'D')
//      += 'A';
//
//   puts("bi5");
//   (bi5 += 'r')
//      += '0';
//
//   puts("bi6");
//   bi6 = 0xFEDCBA;

//   TRACE_STR(bi1.getString());
//   END_LINE;
//   TRACE_STR(bi2.getString());
//   END_LINE;
   TRACE_STR(bi3.getString());
   END_LINE;
//   TRACE_STR(bi4.getString());
//   END_LINE;
//   TRACE_STR(bi5.getString());
//   END_LINE;
//   TRACE_STR(bi6.getString());
//   END_LINE;
   }
コード例 #11
0
ファイル: FREEMEM.CPP プロジェクト: amitahire/development
long FAR PASCAL _export WndProc (HWND hwnd,
                                 UINT message,
                                 UINT wParam,
                                 LONG lParam)
   {
   static DWORD   dwFreeMem,dwPrevMem;
   static RECT    rect;
   char           cBuffer[STRINGBUF_SZ];
   HDC            hdc;
   PAINTSTRUCT    ps;

                  
//   TRACE_STR("ENTER WndProc");
   switch(message)
      {
      case WM_TIMER :
         {
//         MessageBeep(0);
         dwFreeMem = GetFreeSpace(0);

         if (dwFreeMem != dwPrevMem)
            {
            InvalidateRect(hwnd,NULL,TRUE);
            dwPrevMem = dwFreeMem;   
            }
         return 0;
         }
      case WM_SIZE :
         {
         GetClientRect(hwnd,&rect);
         return 0;
         }  
            
      case WM_PAINT :
         {
         hdc = BeginPaint(hwnd,&ps);
         
         DrawText(hdc,
                  cBuffer,
                  sprintf(cBuffer,
                          "%.2f megs",
                          dwFreeMem / 1024.0 / 1024.0),
                  &rect,
                  DT_WORDBREAK);
                  
         EndPaint(hwnd,&ps);
         return 0;
         }

      case WM_QUERYOPEN:
         // throw away any requests to maximize us when we are icon-ized
         return 0;
         
      case WM_DESTROY :
         {
         // insert a WM_QUIT in the queue...
         KillTimer (hwnd, ID_TIMER);
         TRACE_STR("WM_DESTROY..");
         PostQuitMessage (0);
         TRACE_STR("EXIT WndProc");
         return 0;            
         }
      }//switch
//   TRACE_STR("EXIT WndProc");
   // *********************extremely important!!! ******************      
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   return DefWindowProc (hwnd, message, wParam, lParam);            
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   // *********************extremely important!!! ******************      
   } //WndProc
コード例 #12
0
ファイル: CHECKER2.CPP プロジェクト: amitahire/development
long FAR PASCAL _export WndProc (HWND hwnd,
                                 UINT message,
                                 UINT wParam,
                                 LONG lParam)
   {
   static BOOL    fState[DIVISIONS][DIVISIONS];
   static short   shift_key,        // boolean indicators for shift &
                  control_key;      //    control keys.
   HDC            hdc;              //handle to device context
   PAINTSTRUCT    ps;         
   POINT          point;  
   RECT           rect;
   short          rpt_cnt,          // repeat count of key passed to us.
                  x,
                  y;
                  
                  
//   TRACE_STR("ENTER WndProc");
   switch(message)
      {
      case WM_SIZE :
         {
         TRACE_STR("WM_SIZE");
         //Horizontal size of a block
         cxClient = LOWORD(lParam);
         cxBlock  = LOWORD(lParam)/DIVISIONS;
         TRACE_INT(cxBlock);
         
         //Vertical size of a block
         cyClient = HIWORD(lParam);
         cyBlock  = HIWORD(lParam)/DIVISIONS;
         TRACE_INT(cyBlock);

         return 0;                         
         }
      case WM_SETFOCUS :
         {
         // in case its not showing at all...
         ShowCursor(TRUE);
         return 0;
         }
      case WM_KILLFOCUS :
         {
         // kill it when we lose focus
         ShowCursor(FALSE);
         return 0;
         }
              
      case WM_KEYDOWN :
         {
         // get the repeat count passed to us...
         rpt_cnt = LOWORD(lParam & 0xFF);
         
         if (shift_key)
            rpt_cnt *= REPEAT_SCALING;
            
         GetCursorPos(&point);
         // from raw screen to our window...
         ScreenToClient(hwnd,&point);
         //translate to nearest valid rectangle center...
         // if out of the window .. bring it into window
         // if control key is down, center the mouse on the next center
         //    with loop back.
         if (control_key)
            {
            adjust_xy(control_key,point.x,point.y,x,y);
//            //         | center of leftmost rectangle
//            //         v 
//            x = max( (cxBlock / 2),
//            //                  | centered to inside rectangle
//            //                  v 
//                     min( ((point.x/cxBlock)*cxBlock) + (cxBlock / 2),
//            //                       | center of rightmost rectangle
//            //                       v
//                          (cxBlock * (DIVISIONS -1)) + (cxBlock / 2)
//                        )
//                    )     ;
//            TRACE_INT(x);        
//            //         | center of leftmost rectangle
//            //         v 
//            y = max( (cyBlock / 2),
//            //                  | centered to inside rectangle
//            //                  v 
//                     min( ((point.y/cyBlock)*cyBlock) + (cyBlock / 2),
//            //                       | center of rightmost rectangle
//            //                       v
//                          (cyBlock * (DIVISIONS -1)) + (cyBlock / 2)
//                        )
//                    )     ;
            }
         else
            {
            x = max(0,min(point.x,cxClient));
            y = max(0,min(point.y,cyClient));
            }

         switch(wParam)
            {
            case VK_CONTROL :
               {
               control_key = TRUE;
               adjust_xy(control_key,point.x,point.y,x,y);
               break;
               }
            case VK_SHIFT :
               {
               shift_key = TRUE;
               break;
               }
            case VK_UP :
               {
               if (control_key)
                  {
                  y -= cyBlock;
                  }
               else
                  {
                  y -= rpt_cnt;
                  }   
               break;
               }
            case VK_DOWN :
               {
               if (control_key)
                  {
                  y += cyBlock;
                  }
               else
                  {
                  y += rpt_cnt;
                  }   
               break;
               }
            case VK_LEFT :
               {
               if (control_key)
                  {
                  x -= cxBlock;
                  }
               else
                  {
                  x -= rpt_cnt;
                  }   
               break;
               }
            case VK_RIGHT :
               {
               if (control_key)
                  {
                  x += cxBlock;
                  }
               else
                  {
                  x += rpt_cnt;
                  }   
                  
               break;
               }
            case VK_HOME :
               {
               if (control_key)
                  {
                  x = cxBlock / 2;
                  y = cyBlock / 2;
                  }
               else
                  {
                  y=1;
                  x=1;
                  }
               break;
               }
            case VK_END :
               {
               if (control_key)
                  {
                  x = ((DIVISIONS - 1) * cxBlock) + (cxBlock / 2) ;
                  y = ((DIVISIONS - 1) * cyBlock) + (cyBlock / 2) ;
                  }
               else
                  {
                  x = cxClient - 1;
                  y = cyClient - 1;
                  }
               break;           
               }
            case VK_RETURN :
            case VK_SPACE :
               {          
               SendMessage(hwnd,
                           WM_LBUTTONDOWN,                  // the message...
                           MK_LBUTTON,                      //wParam
                           MAKELONG(x,y)                    //x,y coord.
                          );
               break;
               }

            }
         // incase x or y are negative...

         if (control_key)
            {
            // adjust x to be inside client windows
            if (x < 0)
               {
               x = ((DIVISIONS - 1) * cxBlock) + (cxBlock / 2);
               }
            else if (x > (cxClient-1))
               {
               x = cxBlock / 2;
               }   
               
            // adjust y to be inside client windows
            if (y < 0)      
               {
               y = ((DIVISIONS - 1) * cyBlock) + (cyBlock / 2);
               }
            else if (y > (cyClient-1))
               {
               y = cyBlock / 2;
               }   
            }
         else
            {
            // adjust x to be inside client windows
            if (x < 0)   
               {
               x = cxClient - 1;
               }
            else if (x > (cxClient - 1))
               {
               x = 0;
               }   
            // adjust y to be inside client windows
            if (y < 0)   
               {
               y = cyClient - 1;
               }
            else if (y > (cyClient - 1))
               {
               y = 0;
               }   
            }          

         point.x = x ;
         point.y = y ;
         
         ClientToScreen(hwnd,&point);
         SetCursorPos(point.x,point.y);
         return 0;                                  
         }              
      case WM_KEYUP :
         {
         switch(wParam)
            {
            case VK_CONTROL :
               {
               control_key = FALSE;
               break;
               }
            case VK_SHIFT :
               {
               shift_key = FALSE;
               break;
               }
            }
         return 0;                                  
         }              
         
      case WM_LBUTTONDOWN :
         {
         //current x,y of mouse converted to Block coordinates.
         x = LOWORD(lParam)/cxBlock;
         y = HIWORD(lParam)/cyBlock;

         if(x < DIVISIONS && y < DIVISIONS)
            {
            //here if in a valid area of the screen
            fState[x][y] ^= 1; //xor the bit stored there now...
            rect.left   = x * cxBlock     ;
            rect.top    = y * cyBlock     ;
            rect.right  = (x+1) * cxBlock ;
            rect.bottom = (y+1) * cyBlock ;
            // only invalidate this particular block
            // don't erase...
            InvalidateRect(hwnd,&rect,FALSE); 
            }
         else
            {
            //default beep...
            MessageBeep(0);
            }
         // whack the entire client area.. and ERASE IT!
         return 0;
         }
      case WM_PAINT :
         {
         TRACE_STR("WM_PAINT..");
         //get the device context handle for use in painting the sucker...
         hdc = BeginPaint(hwnd, &ps);

         // draw lines from each point to EVERY OTHER DAMN POINT ON THE SCREEN
         for (x = 0;x < DIVISIONS; x++)
            for (y= 0 ; y < DIVISIONS ; y++)
               {
               // draw a rectangle and fill w/ current brush (if an 
               // x was there previously it will be erased!
               Rectangle(hdc,
                         x*cxBlock,
                         y*cyBlock,
                         (x+1)*cxBlock,
                         (y+1)*cyBlock);
               // draw an X if true!          
               if(fState[x][y])
                  {
                  MoveTo(hdc,x*cxBlock,y*cyBlock);
                  LineTo(hdc,(x+1)*cxBlock,(y+1)*cyBlock);
                  MoveTo(hdc,x*cxBlock,(y+1)*cyBlock);
                  LineTo(hdc,(x+1)*cxBlock,y*cyBlock);
                  }          
               }                       
         
         EndPaint (hwnd, &ps);
         TRACE_STR("EXIT WM_PAINT...");
         TRACE_STR("EXIT WndProc");
         return 0;      
         }
      case WM_DESTROY :
         {
         // insert a WM_QUIT in the queue...
         TRACE_STR("WM_DESTROY..");
         PostQuitMessage (0);
         TRACE_STR("EXIT WndProc");
         return 0;            
         }
      }//switch
//   TRACE_STR("EXIT WndProc");
   return DefWindowProc (hwnd, message, wParam, lParam);   
   } //WndProc
コード例 #13
0
ファイル: CHECKER3.CPP プロジェクト: amitahire/development
long FAR PASCAL _export WndProc (HWND hwnd,
                                 UINT message,
                                 UINT wParam,
                                 LONG lParam)
   {
   static HWND    hwndChild[DIVISIONS][DIVISIONS];
   static short   shift_key,        // boolean indicators for shift &
                  control_key;      //    control keys.
   POINT          point;               
   short          rpt_cnt,          // repeat count of key passed to us.
                  x,
                  y;
                  
                  
//   TRACE_STR("ENTER WndProc");
   switch(message)
      {
      case WM_CREATE :
         {
         for (x = 0 ; x < DIVISIONS ; x++)
            for (y = 0 ; y < DIVISIONS ; y++)
               {
               // create our children for mouse input events...
               hwndChild[x][y] = 
                     CreateWindow(szChildClass,
                                  NULL,
                                  WS_CHILDWINDOW | WS_VISIBLE,
                                  0,
                                  0,
                                  0,
                                  0,
                                  hwnd,
                                  (y << 8) | x,
                                  GetWindowWord(hwnd,GWW_HINSTANCE),
                                  NULL);
               TRACE_STR("Child Window x/y and thier pointers...");                   
               TRACE_INT(x);                   
               TRACE_INT(y);                   
               TRACE_FARP((const void *)hwndChild[x][y]);
                                  
               }
         return 0;      
         }
      case WM_SIZE :
         {
         TRACE_STR("WM_SIZE");
         //Horizontal size of a block
         cxClient = LOWORD(lParam);
         cxBlock  = LOWORD(lParam)/DIVISIONS;
         TRACE_INT(cxBlock);
         
         //Vertical size of a block
         cyClient = HIWORD(lParam);
         cyBlock  = HIWORD(lParam)/DIVISIONS;
         TRACE_INT(cyBlock);
         // slap'em on the correct place on the parent client area
         for (x = 0 ; x < DIVISIONS ; x++)
            for (y = 0 ; y < DIVISIONS ; y++)
               {
               MoveWindow(hwndChild[x][y],
                          x*cxBlock,
                          y*cyBlock,
                          cxBlock,
                          cyBlock,
                          TRUE);
               }

         return 0;                         
         }
      case WM_SETFOCUS :
         {
         // in case its not showing at all...
         ShowCursor(TRUE);
         return 0;
         }
      case WM_KILLFOCUS :
         {
         // kill it when we lose focus
         ShowCursor(FALSE);
         return 0;
         }
              
      case WM_KEYDOWN :
         {
         // get the repeat count passed to us...
         rpt_cnt = LOWORD(lParam & 0xFF);
         
         if (shift_key)
            rpt_cnt *= REPEAT_SCALING;
            
         GetCursorPos(&point);
         // from raw screen to our window...
         ScreenToClient(hwnd,&point);
         //translate to nearest valid rectangle center...
         // if out of the window .. bring it into window
         // if control key is down, center the mouse on the next center
         //    with loop back.
         if (control_key)
            {
            adjust_xy(control_key,point.x,point.y,x,y);
            }
         else
            {
            x = max(0,min(point.x,cxClient));
            y = max(0,min(point.y,cyClient));
            }

         switch(wParam)
            {
            case VK_CONTROL :
               {
               control_key = TRUE;
               // adjust it now if the user is pressing the control key.
               adjust_xy(control_key,point.x,point.y,x,y);
               break;
               }
            case VK_SHIFT :
               {
               shift_key = TRUE;
               break;
               }
            case VK_UP :
               {
               if (control_key)
                  {
                  y -= cyBlock;
                  }
               else
                  {
                  y -= rpt_cnt;
                  }   
               break;
               }
            case VK_DOWN :
               {
               if (control_key)
                  {
                  y += cyBlock;
                  }
               else
                  {
                  y += rpt_cnt;
                  }   
               break;
               }
            case VK_LEFT :
               {
               if (control_key)
                  {
                  x -= cxBlock;
                  }
               else
                  {
                  x -= rpt_cnt;
                  }   
               break;
               }
            case VK_RIGHT :
               {
               if (control_key)
                  {
                  x += cxBlock;
                  }
               else
                  {
                  x += rpt_cnt;
                  }   
                  
               break;
               }
            case VK_HOME :
               {
               if (control_key)
                  {
                  x = cxBlock / 2;
                  y = cyBlock / 2;
                  }
               else
                  {
                  y=1;
                  x=1;
                  }
               break;
               }
            case VK_END :
               {
               if (control_key)
                  {
                  x = ((DIVISIONS - 1) * cxBlock) + (cxBlock / 2) ;
                  y = ((DIVISIONS - 1) * cyBlock) + (cyBlock / 2) ;
                  }
               else
                  {
                  x = cxClient - 1;
                  y = cyClient - 1;
                  }
               break;           
               }
            case VK_RETURN :
            case VK_SPACE :
               {     
               TRACE_STR("Return or Space pressed...");     
               point.x = x;
               point.y = y;
               TRACE_STR("Adjusted x/y in parent coord");
               TRACE_INT(point.x);
               TRACE_INT(point.y);
               ClientToScreen(hwnd,&point);
               TRACE_STR("Adjusted x/y in screen coord");
               TRACE_INT(point.x);                       
               TRACE_INT(point.y);
               ScreenToClient(hwndChild[x/cxBlock][y/cyBlock],&point);
               
               TRACE_STR("Adjusted x/y in child coord");
               TRACE_INT(point.x);              
               TRACE_INT(point.y);
               TRACE_STR("Sending message to Child Window...");     
               TRACE_FARP((const void *)hwndChild[x/cxBlock][y/cyBlock]);
               SendMessage(hwndChild[x/cxBlock][y/cyBlock],
                           WM_LBUTTONDOWN,                  // the message...
                           MK_LBUTTON,                      //wParam
                           MAKELONG(point.x,point.y)        //x,y coord.
                          );
               break;
               }

            }
         // incase x or y are negative...

         if (control_key)
            {
            // adjust x to be inside client windows
            if (x < 0)
               {
               x = ((DIVISIONS - 1) * cxBlock) + (cxBlock / 2);
               }
            else if (x > (cxClient-1))
               {
               x = cxBlock / 2;
               }   
               
            // adjust y to be inside client windows
            if (y < 0)      
               {
               y = ((DIVISIONS - 1) * cyBlock) + (cyBlock / 2);
               }
            else if (y > (cyClient-1))
               {
               y = cyBlock / 2;
               }   
            }
         else
            {
            // adjust x to be inside client windows
            if (x < 0)   
               {
               x = cxClient - 1;
               }
            else if (x > (cxClient - 1))
               {
               x = 0;
               }   
            // adjust y to be inside client windows
            if (y < 0)   
               {
               y = cyClient - 1;
               }
            else if (y > (cyClient - 1))
               {
               y = 0;
               }   
            }          

         point.x = x ;
         point.y = y ;
         
         ClientToScreen(hwnd,&point);
         SetCursorPos(point.x,point.y);
         return 0;                                  
         }              
      case WM_KEYUP :
         {
         switch(wParam)
            {
            case VK_CONTROL :
               {
               control_key = FALSE;
               break;
               }
            case VK_SHIFT :
               {
               shift_key = FALSE;
               break;
               }
            }
         return 0;                                  
         }              
         
      case WM_LBUTTONDOWN :
         {
/*         //current x,y of mouse converted to Block coordinates.
         x = LOWORD(lParam)/cxBlock;
         y = HIWORD(lParam)/cyBlock;

         if(x < DIVISIONS && y < DIVISIONS)
            {
            //here if in a valid area of the screen
            fState[x][y] ^= 1; //xor the bit stored there now...
            rect.left   = x * cxBlock     ;
            rect.top    = y * cyBlock     ;
            rect.right  = (x+1) * cxBlock ;
            rect.bottom = (y+1) * cyBlock ;
            // only invalidate this particular block
            // don't erase...
            InvalidateRect(hwnd,&rect,FALSE); 
            }
         else
            {
            //default beep...
            MessageBeep(0);
            }
*/            
         // whack the entire client area.. and ERASE IT!
         MessageBeep(0);
         return 0;
         }
      case WM_DESTROY :
         {
         // insert a WM_QUIT in the queue...
         TRACE_STR("WM_DESTROY..");
         PostQuitMessage (0);
         TRACE_STR("EXIT WndProc");
         return 0;            
         }
      }//switch
//   TRACE_STR("EXIT WndProc");
   // *********************extremely important!!! ******************      
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   return DefWindowProc (hwnd, message, wParam, lParam);            
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   // *********************extremely important!!! ******************      
   } //WndProc
コード例 #14
0
ファイル: TYPE.CPP プロジェクト: amitahire/development
long FAR PASCAL _export WndProc (HWND hwnd,
                                 UINT message,
                                 UINT wParam,
                                 LONG lParam)
   {
   
   static char    *pBuffer = NULL;
   static int     cxChar,
                  cyChar,
                  cxClient,
                  cyClient,
                  cxBuffer,
                  cyBuffer,
                  xCaret,
                  yCaret;
   HDC            hdc;              //handle to device context
   int            x,
                  y,
                  i;
   PAINTSTRUCT    ps;           
   TEXTMETRIC     tm;

   TRACE_STR("ENTER WndProc");
   switch(message)
      {
      case WM_CREATE :
         {
         TRACE_DELIM('=');
         TRACE_STR("WM_CREATE..");
         
         hdc = GetDC(hwnd);
         SelectObject (hdc, GetStockObject(SYSTEM_FIXED_FONT));
         
         GetTextMetrics(hdc, &tm);
         // Suggested character width for all chars in fixed width font...
         cxChar = tm.tmAveCharWidth;
         // character height 
         cyChar = tm.tmHeight;
         ReleaseDC (hwnd,hdc);
         TRACE_STR("EXIT WM_CREATE..");
         TRACE_STR("EXIT WndProc");
         return 0;          
         }
      case WM_SIZE:
         {
         TRACE_STR("WM_SIZE..");

         // current window size in pixels...
         cyClient = HIWORD(lParam);
         cxClient = LOWORD(lParam);
         TRACE_INT(cxClient);
         TRACE_INT(cyClient);

         //Window size in characters in current font...
         cxBuffer = max(1,cxClient/cxChar);
         cyBuffer = max(1,cyClient/cyChar);
         TRACE_INT(cxBuffer);
         TRACE_INT(cyBuffer);

         if (pBuffer != NULL)
            free(pBuffer);

         if ( ( ((LONG) (cxBuffer * cyBuffer)) > 65535L                 ) ||
              ((pBuffer = (char *) malloc (cxBuffer * cyBuffer)) == NULL)
            )
            {
            MessageBox (hwnd,
                        "Window too large. Cannot"
                        "Allocate enough memory.",
                        "Type",
                        MB_ICONEXCLAMATION | MB_OK
                       );
            }
         else
            {
            TRACE_FARP(pBuffer);
            for (y=0; y < cyBuffer ; y++)
               for (x = 0; x < cxBuffer ; x++)
                  BUFFER(x,y) = ' ';
            }
         xCaret = 0;
         yCaret = 0;

         if (hwnd == GetFocus())
            {
            SetCaretPos (xCaret * cxChar, yCaret * cyChar);
            }           
         
         TRACE_STR("EXIT WM_SIZE..");
         TRACE_STR("EXIT WndProc");
         return 0;       
         }

      case WM_SETFOCUS :
         {
         TRACE_STR("ENTER WM_SETFOCUS..");
         CreateCaret(hwnd, NULL, cxChar, cyChar);
         SetCaretPos(xCaret * cxChar, yCaret * cyChar);
         ShowCaret(hwnd);
         TRACE_STR("EXIT WM_SETFOCUS..");
         TRACE_STR("EXIT WndProc");
         return 0;       
         }
         
      case WM_KEYDOWN :
         {
         TRACE_STR("ENTER WM_KEYDOWN...");
         TRACE_INT(wParam);
         switch(wParam)
            {
            case VK_HOME:
               {
               xCaret = 0;
               break;
               }
            case VK_END:
               {
               xCaret = cxBuffer - 1;
               break;
               }
            case VK_PRIOR:
               {
               yCaret = 0;
               break;
               }
            case VK_NEXT:
               {
               yCaret = cyBuffer - 1;
               break;
               }
            case VK_LEFT:
               {
               xCaret = max(xCaret - 1, 0);
               break;
               }
            case VK_RIGHT:
               {
               xCaret = min(xCaret + 1, cxBuffer - 1);
               break;
               }
            case VK_UP:
               {
               yCaret = max(yCaret - 1, 0);
               break;
               }
            case VK_DOWN:
               {
               yCaret = min(yCaret + 1, cyBuffer - 1);
               break;
               }
            case VK_DELETE:
               {
               for (x = xCaret ; x < cxBuffer; x++)
                  BUFFER(x,yCaret) = BUFFER(x+1, yCaret);
               BUFFER(cxBuffer - 1, yCaret) = ' ';
               HideCaret(hwnd);
               hdc = GetDC(hwnd);

               SelectObject(hdc,
                            GetStockObject(SYSTEM_FIXED_FONT));
               TextOut(hdc,
                       xCaret * cxChar,
                       yCaret * cyChar,
                       &BUFFER(xCaret,yCaret),
                       cxBuffer - xCaret
                       );               
               ShowCaret(hwnd);
               ReleaseDC(hwnd, hdc);                        
               break;
               }
            }
         SetCaretPos(xCaret*cxChar, yCaret*cyChar);   
         TRACE_STR("EXIT WM_KEYDOWN...");
         TRACE_STR("EXIT WndProc");
         return 0;
         }       
      case WM_CHAR :
         {
         TRACE_STR("ENTER WM_CHAR...");
         TRACE_INT(wParam);
         for (i = 0; i < (int) LOWORD(lParam) ; i++)
            {
            switch(wParam)
               {
               case '\b': //backspace
                  {
                  TRACE_STR(">>BACKSPACE..");
                  if(xCaret > 0)
                     {
                     xCaret--;
                     SendMessage(hwnd, 
                                 WM_KEYDOWN,
                                 VK_DELETE,
                                 1L
                                );
                     }
                  TRACE_STR(">>END BACKSPACE..");
                  break;
                  }
               case '\t': //tab
                  {
                  TRACE_STR(">>TAB..");
                  // EXTREMELY curious!
                  do
                     {
                     // this is acted upon immediately!
                     // it calls WndProc for 'hwnd' with the indicated
                     // message/wParam/lParam...
                     SendMessage(hwnd, 
                                 WM_CHAR, 
                                 ' ',
                                 1L
                                );
                     }
                  while (xCaret % 8 != 0);                     
                  TRACE_STR(">>END TAB..");
                  break;
                  }
               case '\n': //linefeed
                  {
                  TRACE_STR(">>LINEFEED..");
                  if (++yCaret == cyBuffer)
                     yCaret = 0;
                  TRACE_STR(">>END LINEFEED..");
                  break;
                  }
               case '\r': //carraige return
                  {
                  TRACE_STR(">>CARRAIGE RETURN..");
                  xCaret = 0;
                  if (++yCaret == cyBuffer)
                     yCaret = 0;
                  TRACE_STR(">>END CARRAIGE RETURN..");
                  break;
                  }
               case '\x1B': //excape (!)
                  {
                  TRACE_STR(">>ESCAPE...");
                  for(y=0;y<cyBuffer; y++)
                     {
                     for(x=0; x<cxBuffer; x++)
                        {
                        BUFFER(x,y) = ' ';
                        }
                     }
                  xCaret = 0;
                  yCaret = 0;
                  InvalidateRect(hwnd,NULL,FALSE);   
                  TRACE_STR(">>END ESCAPE...");
                  break;
                  }
               default :
                  {
                  TRACE_STR(">>default...");
                  BUFFER(xCaret,yCaret) = (char) wParam;

                  HideCaret(hwnd);
                  hdc = GetDC(hwnd);
                  SelectObject(hdc,
                               GetStockObject(SYSTEM_FIXED_FONT));
                  TextOut(hdc,
                          xCaret*cxChar,
                          yCaret*cyChar,
                          &BUFFER(xCaret,yCaret),
                          1);
                  ShowCaret(hwnd);
                  ReleaseDC(hwnd,hdc);
                  if(++xCaret == cxBuffer)
                     {
                     xCaret = 0;
                     if(++yCaret == cyBuffer)
                        yCaret = 0;
                     }                          
                  TRACE_STR(">>END default...");
                  break;
                  }
               }
            }
         SetCaretPos (xCaret * cxChar, yCaret * cyChar);
         TRACE_STR("EXIT WM_CHAR...");
         TRACE_STR("EXIT WndProc");
         return 0;   
         }       
      case WM_PAINT :
         {
         TRACE_STR("WM_PAINT..");
         // Invalidate the entire client area and erase it....
         //get the device context handle for use in painting the sucker...
         hdc = BeginPaint(hwnd, &ps);
         
         // set up the font as fixed width font...
         SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));

         for (y = 0; y<cyBuffer; y++)
            {
            TextOut(hdc,
                    0,
                    y * cyChar,
                    &BUFFER(0,y),
                    cxBuffer);
            }
         EndPaint (hwnd, &ps);
         TRACE_STR("EXIT WM_PAINT...");
         TRACE_STR("EXIT WndProc");
         return 0;      
         }
      case WM_DESTROY :
         {
         // insert a WM_QUIT in the queue...
         TRACE_STR("WM_DESTROY..");
         PostQuitMessage (0);
         TRACE_STR("EXIT WndProc");
         return 0;            
         }
      }//switch
   TRACE_STR("EXIT WndProc");
   return DefWindowProc (hwnd, message, wParam, lParam);   
   } //WndProc
コード例 #15
0
ファイル: group.c プロジェクト: edgar-pek/PerspicuOS
static int
group_lookup_func(const char *key, size_t key_size, char **buffer,
	size_t *buffer_size)
{
	enum nss_lookup_type lookup_type;
	char	*name;
	size_t	size;
	gid_t	gid;

	struct group *result;

	TRACE_IN(group_lookup_func);
	assert(buffer != NULL);
	assert(buffer_size != NULL);

	if (key_size < sizeof(enum nss_lookup_type)) {
		TRACE_OUT(group_lookup_func);
		return (NS_UNAVAIL);
	}
	memcpy(&lookup_type, key, sizeof(enum nss_lookup_type));

	switch (lookup_type) {
	case nss_lt_name:
		size = key_size - sizeof(enum nss_lookup_type)	+ 1;
		name = calloc(1, size);
		assert(name != NULL);
		memcpy(name, key + sizeof(enum nss_lookup_type), size - 1);
		break;
	case nss_lt_id:
		if (key_size < sizeof(enum nss_lookup_type) +
			sizeof(gid_t)) {
			TRACE_OUT(passwd_lookup_func);
			return (NS_UNAVAIL);
		}

		memcpy(&gid, key + sizeof(enum nss_lookup_type), sizeof(gid_t));
		break;
	default:
		TRACE_OUT(group_lookup_func);
		return (NS_UNAVAIL);
	}

	switch (lookup_type) {
	case nss_lt_name:
		TRACE_STR(name);
		result = getgrnam(name);
		free(name);
		break;
	case nss_lt_id:
		result = getgrgid(gid);
		break;
	default:
		/* SHOULD NOT BE REACHED */
		break;
	}

	if (result != NULL) {
		group_marshal_func(result, NULL, buffer_size);
		*buffer = malloc(*buffer_size);
		assert(*buffer != NULL);
		group_marshal_func(result, *buffer, buffer_size);
	}

	TRACE_OUT(group_lookup_func);
	return (result == NULL ? NS_NOTFOUND : NS_SUCCESS);
}
コード例 #16
0
ファイル: usbdev_strings.c プロジェクト: AlexShiLucky/NuttX
#include <nuttx/usb/usbdev_trace.h>

#ifdef CONFIG_USBDEV_TRACE_STRINGS

/****************************************************************************
 * Public Data
 ****************************************************************************/

/* Class API call strings that may be enabled for more descriptive USB trace
 * output.
 */

const struct trace_msg_t g_usb_trace_strings_clsapi[] =
{
#if defined(CONFIG_CDCACM) || defined(CONFIG_PL2303)
  TRACE_STR(USBSER_TRACECLASSAPI_SETUP),
  TRACE_STR(USBSER_TRACECLASSAPI_SHUTDOWN),
  TRACE_STR(USBSER_TRACECLASSAPI_ATTACH),
  TRACE_STR(USBSER_TRACECLASSAPI_DETACH),
  TRACE_STR(USBSER_TRACECLASSAPI_IOCTL),
  TRACE_STR(USBSER_TRACECLASSAPI_RECEIVE),
  TRACE_STR(USBSER_TRACECLASSAPI_RXINT),
  TRACE_STR(USBSER_TRACECLASSAPI_RXAVAILABLE),
  TRACE_STR(USBSER_TRACECLASSAPI_SEND),
  TRACE_STR(USBSER_TRACECLASSAPI_TXINT),
  TRACE_STR(USBSER_TRACECLASSAPI_TXREADY),
  TRACE_STR(USBSER_TRACECLASSAPI_TXEMPTY),
#if defined(CONFIG_CDCACM_IFLOWCONTROL)
  TRACE_STR(USBSER_TRACECLASSAPI_FLOWCONTROL),
#endif
#endif
コード例 #17
0
ファイル: BTNLOOK.CPP プロジェクト: amitahire/development
long FAR PASCAL _export WndProc (HWND hwnd,
                                 UINT message,
                                 UINT wParam,
                                 LONG lParam)
   {
   static char    szTop[]     = "message            wParam    lParam",
                  szUnd[]     = "_______            ______    ______",
                  szFormat[]  = "%-16s%6X%8X-%04X",
                  szBuffer[50];
   static HWND    hwndButton[BUTTON_CNT];
   static RECT    rect;
   static int     cxChar, 
                  cyChar;
   HDC            hdc;
   PAINTSTRUCT    ps;
   int            i;
   static int     checkbox_state=0;                
   static int     three_state_state = 0;
   TEXTMETRIC     tm;

                  
//   TRACE_STR("ENTER WndProc");
   switch(message)
      {
//      case WM_CTLCOLOR :
//         {
//
//
//         
//         return 0;
//         }
      case WM_CREATE:
         {
         hdc = GetDC(hwnd);
         SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));
         GetTextMetrics(hdc,&tm);
         cxChar = tm.tmAveCharWidth;
         cyChar = tm.tmHeight + tm.tmExternalLeading;
         ReleaseDC(hwnd,hdc);

         for(i = PUSHBUTTON_ID ; i <= OWNERDRAW_ID; i++)
            {
            hwndButton [i] = 
               // create some buttons...
               CreateWindow("button",
                            button[i].text,
                            WS_CHILD | WS_VISIBLE | button[i].style,
                            cxChar,
                            cyChar * (1 + (2 * i)),
                            20 * cxChar, 
                            7 * cyChar / 4,
                            hwnd,
                            i,
                            // since lParam is a Long pointer to the creation 
                            // structure, get the hInstance out so that this
                            // window properly points to its Parent...
                            ((LPCREATESTRUCT) lParam) -> hInstance,
                            NULL);
            }
         return 0;   
         }
      case WM_SIZE :
         {
         rect.left = 24 * cxChar;
         rect.top = 2 * cyChar;
         rect.right = LOWORD(lParam);
         rect.bottom = HIWORD(lParam);
         return 0;
         }
      case WM_PAINT :
         {
         InvalidateRect(hwnd, &rect, TRUE);
         
         hdc = BeginPaint(hwnd,&ps);
         
         // Default to windows stuff.
         SetBkColor(hdc,GetSysColor(COLOR_WINDOW));
         SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT));
         
         SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));
         SetBkMode(hdc,TRANSPARENT);

         TextOut( hdc, 
                  24*cxChar,
                  cyChar,
                  szTop,
                  sizeof szTop - 1);
         TextOut( hdc,
                  24*cxChar,
                  cyChar,
                  szUnd,
                  sizeof szUnd - 1);
                           
         EndPaint(hwnd,&ps);
         return 0;
         }
      case WM_COMMAND :
      case WM_DRAWITEM :
         {
         ScrollWindow(hwnd,
                      0,
                      -cyChar,
                      &rect,
                      &rect);
         hdc = GetDC(hwnd);
         
         SetBkColor(hdc,GetSysColor(COLOR_WINDOW));
         SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT));
         
         SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));
         TextOut(hdc, 
                 24*cxChar,
                 cyChar * (rect.bottom/cyChar-1),
                 szBuffer,
                 wsprintf(szBuffer,
                          szFormat,
                          (LPSTR) (message==WM_COMMAND ? "WM_COMMAND" : "WM_DRAWITEM"),
                          wParam,            //Child Window ID
                          HIWORD(lParam),    // Child Window Handle
                          LOWORD(lParam)));  // Notification Code
         // Extreee stuff to do...                 
         if (wParam == PUSHBUTTON_ID)
            {
            // Show DEFPUSHBUTTON as pressed
            SendMessage(hwndButton[DEFPUSHBUTTON_ID],BM_SETSTATE,1,0L);
            // Change text of button
            SetWindowText(hwndButton[DEFPUSHBUTTON_ID],"F**K YOU");
            // Show it as disabled
            EnableWindow(hwndButton[DEFPUSHBUTTON_ID],FALSE);
            }
         if (wParam == CHECKBOX_ID)
            {
            // change checkbox state...
            checkbox_state ^= 1;
            SendMessage(hwndButton[CHECKBOX_ID],BM_SETCHECK,checkbox_state,0L);
            
            // do our goofy fun-ness..
            // re-enable button
            EnableWindow(hwndButton[DEFPUSHBUTTON_ID],TRUE);
            // Show DEFPUSHBUTTON as not pressed
            SendMessage(hwndButton[DEFPUSHBUTTON_ID],BM_SETSTATE,0,0L);
            // set text to default text...
            SetWindowText(hwndButton[DEFPUSHBUTTON_ID],button[DEFPUSHBUTTON_ID].text);

            }                                                      
         if (wParam == RADIOBUTTON_ID)
            {
            // change checkbox state...
            
            SendMessage(hwndButton[RADIOBUTTON_ID],BM_SETCHECK,1,0L);
            
            }
         if (wParam == BUTTON_3STATE_ID)
            {
            // change checkbox state...
            three_state_state = (++three_state_state) % 3;
            
            SendMessage(hwndButton[BUTTON_3STATE_ID],BM_SETCHECK,three_state_state,0L);
            
            }
         ReleaseDC(hwnd,hdc);
         ValidateRect(hwnd,NULL);                

         return 0;
         }
         
      case WM_DESTROY :
         {
         // insert a WM_QUIT in the queue...
         TRACE_STR("WM_DESTROY..");
         PostQuitMessage (0);
         TRACE_STR("EXIT WndProc");
         return 0;            
         }
      }//switch
//   TRACE_STR("EXIT WndProc");
   // *********************extremely important!!! ******************      
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   return DefWindowProc (hwnd, message, wParam, lParam);            
   // **                   extremely important!!!                 **
   // **                   extremely important!!!                 **
   // *********************extremely important!!! ******************      
   } //WndProc