elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  [SRC] Lineas Aleatorias en la Pantalla
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [SRC] Lineas Aleatorias en la Pantalla  (Leído 2,543 veces)
BlackZeroX
Wiki

Desconectado Desconectado

Mensajes: 3.158


I'Love...!¡.


Ver Perfil WWW
[SRC] Lineas Aleatorias en la Pantalla
« en: 6 Diciembre 2010, 10:56 am »

.
Linkear libreria     GDI32

Esto solo es una traduccion de VB6 a C++

Que hace? Solo dibuja miles de lineas aleatoriamente de distintos colores en el monitor ignorando todo ( o casi todo ).

Codigo Original:

(GDI32) Lineas Aleatorias On The Fly

https://foro.elhacker.net/programacion_visual_basic/lineas_al_aire-t281968.0.html;msg1389871#msg1389871

Este codigo trae corregido algunos errores que cometi en vb6... nada graves (el mi blog ya estan corregidos por obvias razones)

Codigo:

Código
  1.  
  2. ////////////////////////////////////////////////////////////////
  3. // Autor: BlackZeroX ( Ortega Avila Miguel Angel )            //
  4. //                                                            //
  5. // Web: http://InfrAngeluX.Sytes.Net/                         //
  6. //                                                            //
  7. // |-> Pueden Distribuir Este Código siempre y cuando         //
  8. // no se eliminen los créditos originales de este código      //
  9. // No importando que sea modificado/editado o engrandecido    //
  10. // o achicado, si es en base a este código                    //
  11. ////////////////////////////////////////////////////////////////
  12.  
  13. #include<iostream>
  14. #include<windows.h>
  15.  
  16. using namespace std;
  17.  
  18. struct tLineas
  19. {
  20.    POINT PuntoIni;
  21.    POINT PuntoEnd;
  22. } *PtLineas;
  23.  
  24.  
  25. HDC     HDC_dest;
  26. RECT    RECT_wmonitor;
  27.  
  28. UINT NumeroAleatorio(UINT *l,UINT *u);
  29. UINT NumeroAleatorio(UINT *l,UINT u);
  30. UINT NumeroAleatorio(UINT l,UINT *u);
  31. UINT NumeroAleatorio(UINT l,UINT u);
  32.  
  33. void Swap(UINT *l,UINT *u);
  34. void Swap(UINT *l,UINT u);
  35. void Swap(UINT l,UINT *u);
  36. void Swap(UINT l,UINT u);
  37.  
  38. VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
  39. VOID ProcessMessages();
  40.  
  41. int main()
  42. {
  43.  
  44.    HDC_dest                = GetDC( NULL );
  45.    SetTimer ( NULL , 0 , 10 , (TIMERPROC)TimerProc );
  46.    ProcessMessages();
  47.    ReleaseDC ( NULL , HDC_dest );
  48.    return (1);
  49. }
  50.  
  51. void Swap(UINT *l,UINT *u)
  52. {
  53.    UINT Ptmp = *l;
  54.    *l = *u;
  55.    *u = Ptmp;
  56. }
  57.  
  58. UINT NumeroAleatorio(UINT l,UINT u)
  59. {
  60.    if ( l > u)
  61.        Swap( &l , &u );
  62.    return ( rand()%(u-l+1)+l );
  63. }
  64.  
  65. VOID CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
  66. {
  67.    tLineas     Linea;
  68.    HPEN        hPen;
  69.  
  70.    RECT_wmonitor.bottom    = GetSystemMetrics( 1 );
  71.    RECT_wmonitor.left      = 1;
  72.    RECT_wmonitor.right     = GetSystemMetrics( 0 );
  73.    RECT_wmonitor.top       = 1;
  74.  
  75.    Linea.PuntoIni.x = NumeroAleatorio((UINT)RECT_wmonitor.left,(UINT)RECT_wmonitor.right);
  76.    Linea.PuntoIni.y = NumeroAleatorio((UINT)RECT_wmonitor.top,(UINT)RECT_wmonitor.bottom);
  77.    Linea.PuntoEnd.x = NumeroAleatorio((UINT)RECT_wmonitor.left,(UINT)RECT_wmonitor.right);
  78.    Linea.PuntoEnd.y = NumeroAleatorio((UINT)RECT_wmonitor.top,(UINT)RECT_wmonitor.bottom);
  79.  
  80.    hPen = CreatePen(0, 1, (COLORREF)NumeroAleatorio((UINT)0,(UINT)3000000));
  81.    DeleteObject(SelectObject(HDC_dest, hPen));
  82.    Ellipse (HDC_dest, Linea.PuntoIni.x - 2, Linea.PuntoIni.y - 2, Linea.PuntoIni.x + 2, Linea.PuntoIni.y + 2);
  83.    Ellipse (HDC_dest, Linea.PuntoEnd.x - 2, Linea.PuntoEnd.y - 2, Linea.PuntoEnd.x + 2, Linea.PuntoEnd.y + 2);
  84.    DeleteObject(hPen);
  85.    hPen = CreatePen(0, 1, (COLORREF)NumeroAleatorio((UINT)0,(UINT)3000000));
  86.    DeleteObject(SelectObject(HDC_dest, hPen));
  87.    MoveToEx (HDC_dest, Linea.PuntoIni.x, Linea.PuntoIni.y, NULL);
  88.    LineTo (HDC_dest, Linea.PuntoEnd.x, Linea.PuntoEnd.y);
  89.    DeleteObject (hPen);
  90. }
  91.  
  92. VOID ProcessMessages()
  93. {
  94.    MSG msg;
  95.    while (GetMessage(&msg, NULL, NULL, NULL) != -1)
  96.        DispatchMessage(&msg);
  97. }
  98.  
  99.  

Temibles Lunas!¡.


« Última modificación: 6 Diciembre 2010, 11:06 am por BlackZeroX▓▓▒▒░░ » En línea

The Dark Shadow is my passion.
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Residente para poner lineas en la pantalla
Programación Visual Basic
yovaninu 2 1,586 Último mensaje 17 Septiembre 2005, 06:35 am
por yovaninu
Duda Fotos Aleatorias
Programación Visual Basic
Zorrohack 5 2,123 Último mensaje 18 Septiembre 2006, 13:36 pm
por yeikos
Problema pantalla portátil con lineas.
Hardware
Hearts 1 3,555 Último mensaje 18 Julio 2010, 21:33 pm
por Aprendiz-Oscuro
[Solucionado] String aleatorias « 1 2 »
Programación Visual Basic
Cracky7 10 5,068 Último mensaje 18 Octubre 2010, 16:58 pm
por Elemental Code
Pantalla con lineas
Dudas Generales
ferze 2 2,003 Último mensaje 2 Junio 2016, 22:24 pm
por engel lex
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines