Advertisement
dllbridge

Untitled

Sep 30th, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.66 KB | None | 0 0
  1.  
  2.  
  3. #include   <stdio.h>
  4. #include <windows.h>
  5.  
  6.  
  7.  
  8. HWND    hWnd = GetForegroundWindow();
  9. HDC     hdc  =     GetWindowDC(hWnd);
  10.  
  11. COORD   P = { 0 };
  12.  
  13. HPEN    hPen1 = CreatePen(PS_SOLID, 2, RGB(255,   0,   0)),
  14.         hPen2 = CreatePen(PS_SOLID, 7, RGB( 25, 220,   0)),
  15.         hPen3 = CreatePen(PS_SOLID, 2, RGB( 84,  79, 171)),
  16.         hPen4 = CreatePen(PS_SOLID, 2, RGB(214,  73, 151));
  17.            
  18.                                        
  19.  
  20. void foo(int x, int y);
  21.  
  22.  
  23. ////////////////////////////////////////////////////////////////////////////////
  24. int main()                                                                    //
  25. {
  26.  
  27.  
  28.  
  29.    
  30.     RECT    pRECT = { 0 };
  31.  
  32.  
  33.     GetClientRect(hWnd, &pRECT);
  34.  
  35.  
  36.  
  37.     HDC hdc = GetWindowDC(hWnd);
  38.  
  39.     SetBkMode(hdc, 1);  //  TRANSPARENT
  40.  
  41.  
  42.  
  43.     EXTLOGPEN pINFO;
  44.  
  45.     GetObject(hPen1, sizeof(EXTLOGPEN), &pINFO);
  46.  
  47.  
  48.  
  49.     SelectObject(hdc, hPen3);
  50.  
  51.     for (int i = 0; i < 200; i +=30)
  52.     {
  53.         MoveToEx(hdc, 50, 120 + i, 0);
  54.         LineTo(hdc, 230, 120 + i);
  55.         MoveToEx(hdc, 50 + i, 120, 0);
  56.         LineTo(hdc, 50 + i, 300);
  57.         Sleep(1000);
  58.     }
  59.    
  60.  
  61.     for(int i = 1; i < 7; i++)
  62.     {
  63.         Sleep(100);    
  64.         foo(i, i);
  65.     }
  66.    
  67.     for(int i = 1; i < 7; i++)
  68.     {
  69.         Sleep(100);    
  70.         foo(1, i);
  71.     }  
  72.      
  73. }
  74.  
  75.  
  76.  
  77. ////////////////////////////////////////////////////////
  78. void foo(int x, int y)
  79. {
  80.      
  81.      SelectObject(hdc, hPen1);
  82.      
  83.     P.X =  35 + (y*30);
  84.     P.Y = 105 + (x*30);    
  85.      
  86.      Ellipse(hdc,
  87.          P.X - 5,
  88.          P.Y + 5,
  89.          P.X + 5,
  90.          P.Y - 5);  
  91. }
  92.  
  93.  
  94.  
  95. /*
  96. #include <stdio.h>
  97.  
  98.  
  99. void foo(int* p);
  100.  
  101. //////////////////////////////////////////////
  102. int main()
  103. {
  104.     int nA = 2;
  105.  
  106.     foo(&nA);
  107.  
  108.     printf("nA = %d\n", nA);
  109. }
  110.  
  111.  
  112. //////////////////////////////////////////////
  113. void foo(int* p)
  114. {
  115.      
  116.     int nB = 55;
  117.    
  118.     int r1 = nB;
  119.    
  120.     nB = *p;
  121.     printf("nB = %d\n", nB);
  122.    
  123.     *p = r1;
  124.    
  125.  
  126. }
  127.  
  128. */
  129.  
  130. //    int& r1 = nB;
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. /*
  139. #include   <stdio.h>
  140. #include <windows.h>
  141.  
  142. //#define WM_SETFONT                      0x0030
  143.  
  144. HWND    hWnd = GetForegroundWindow();
  145. HDC     hdc  =     GetWindowDC(hWnd);
  146.  
  147. COORD   P = { 0 };
  148.  
  149.     HPEN    hPen1 = CreatePen(PS_SOLID, 2, RGB(255,   0,   0)),
  150.             hPen2 = CreatePen(PS_SOLID, 7, RGB( 25, 220,   0)),
  151.             hPen3 = CreatePen(PS_SOLID, 2, RGB( 84,  79, 171)),
  152.             hPen4 = CreatePen(PS_SOLID, 2, RGB(214,  73, 151));
  153.            
  154.    HFONT           hFont[20] =  {  (HFONT)GetStockObject(10),                                 // ¹0     OEM_FIXED_FONT
  155.                                    (HFONT)GetStockObject(11),                                 // ¹1    ANSI_FIXED_FONT
  156.                                    (HFONT)GetStockObject(12),                                 // ¹2      ANSI_VAR_FONT
  157.                                    (HFONT)GetStockObject(13),                                 // ¹3        SYSTEM_FONT
  158.                                    (HFONT)GetStockObject(16),                                 // ¹4  SYSTEM_FIXED_FONT
  159.                                    (HFONT)GetStockObject(17) };                               // ¹5   DEFAULT_GUI_FONT            
  160.  
  161. void foo(int x, int y);
  162.  
  163.  
  164. ////////////////////////////////////////////////////////////////////////////////
  165. int main()                                                                    //
  166. {
  167.  
  168.  
  169.  
  170.    
  171.     RECT    pRECT = { 0 };
  172.  
  173.  
  174.  
  175.  
  176.     GetClientRect(hWnd, &pRECT);
  177.  
  178.  
  179.  
  180.     HDC hdc = GetWindowDC(hWnd);
  181.  
  182.     SetBkMode(hdc, 1);  //  TRANSPARENT
  183.  
  184.  
  185.  
  186.     EXTLOGPEN pINFO;
  187.  
  188.     GetObject(hPen1, sizeof(EXTLOGPEN), &pINFO);
  189.  
  190.  
  191.  
  192.     SelectObject(hdc, hPen3);
  193.  
  194.     for (int i = 0; i < 200; i +=30)
  195.     {
  196.         MoveToEx(hdc, 50, 120 + i, 0);
  197.         LineTo(hdc, 230, 120 + i);
  198.         MoveToEx(hdc, 50 + i, 120, 0);
  199.         LineTo(hdc, 50 + i, 300);
  200.         Sleep(100);
  201.     }
  202.    
  203.    
  204.     for(int i = 0; i < 6; i++)
  205.     {
  206.       Sleep(200);      
  207.   //  SelectObject(hdc, (HFONT)GetStockObject(10));
  208.       SelectObject(hdc, hFont[i]);
  209.       SetTextColor(hdc, RGB (50*i, 200, 255- (50*i)));
  210.       TextOut(hdc, 300, 130+(20*i), "SONY", 4);
  211.     }
  212.  
  213.     for(int i = 1; i < 7; i++)
  214.     {
  215.         Sleep(200);    
  216.         foo(i, i);
  217.     }
  218.    
  219.     for(int i = 1; i < 7; i++)
  220.     {
  221.         Sleep(200);    
  222.         foo(1, i);
  223.     }  
  224.      
  225. }
  226.  
  227.  
  228.  
  229. ////////////////////////////////////////////////////////
  230. void foo(int x, int y)
  231. {
  232.      
  233.      SelectObject(hdc, hPen1);
  234.      
  235.     P.X = 125- 90 + (y*30);
  236.     P.Y = 225-120 + (x*30);    
  237.      
  238.      Ellipse(hdc,
  239.          P.X - 5,
  240.          P.Y + 5,
  241.          P.X + 5,
  242.          P.Y - 5);  
  243. }
  244.  
  245.  
  246. */
  247.  
  248.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement