.
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 (http://infrangelux.hostei.com/index.php?option=com_content&view=article&id=19:artgdi32lineasaleatoriasonthe-fly&catid=12:catgraficos&Itemid=20)
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:
////////////////////////////////////////////////////////////////
// Autor: BlackZeroX ( Ortega Avila Miguel Angel ) //
// //
// Web: http://InfrAngeluX.Sytes.Net/ //
// //
// |-> Pueden Distribuir Este Código siempre y cuando //
// no se eliminen los créditos originales de este código //
// No importando que sea modificado/editado o engrandecido //
// o achicado, si es en base a este código //
////////////////////////////////////////////////////////////////
#include<iostream>
#include<windows.h>
using namespace std;
struct tLineas
{
POINT PuntoIni;
POINT PuntoEnd;
} *PtLineas;
HDC HDC_dest;
RECT RECT_wmonitor;
UINT NumeroAleatorio(UINT *l,UINT *u);
UINT NumeroAleatorio(UINT *l,UINT u);
UINT NumeroAleatorio(UINT l,UINT *u);
UINT NumeroAleatorio(UINT l,UINT u);
void Swap(UINT *l,UINT *u);
void Swap(UINT *l,UINT u);
void Swap(UINT l,UINT *u);
void Swap(UINT l,UINT u);
VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
VOID ProcessMessages();
int main()
{
HDC_dest = GetDC( NULL );
SetTimer ( NULL , 0 , 10 , (TIMERPROC)TimerProc );
ProcessMessages();
ReleaseDC ( NULL , HDC_dest );
return (1);
}
void Swap(UINT *l,UINT *u)
{
UINT Ptmp = *l;
*l = *u;
*u = Ptmp;
}
UINT NumeroAleatorio(UINT l,UINT u)
{
if ( l > u)
Swap( &l , &u );
return ( rand()%(u-l+1)+l );
}
VOID CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
{
tLineas Linea;
HPEN hPen;
RECT_wmonitor.bottom = GetSystemMetrics( 1 );
RECT_wmonitor.left = 1;
RECT_wmonitor.right = GetSystemMetrics( 0 );
RECT_wmonitor.top = 1;
Linea.PuntoIni.x = NumeroAleatorio((UINT)RECT_wmonitor.left,(UINT)RECT_wmonitor.right);
Linea.PuntoIni.y = NumeroAleatorio((UINT)RECT_wmonitor.top,(UINT)RECT_wmonitor.bottom);
Linea.PuntoEnd.x = NumeroAleatorio((UINT)RECT_wmonitor.left,(UINT)RECT_wmonitor.right);
Linea.PuntoEnd.y = NumeroAleatorio((UINT)RECT_wmonitor.top,(UINT)RECT_wmonitor.bottom);
hPen = CreatePen(0, 1, (COLORREF)NumeroAleatorio((UINT)0,(UINT)3000000));
DeleteObject(SelectObject(HDC_dest, hPen));
Ellipse (HDC_dest, Linea.PuntoIni.x - 2, Linea.PuntoIni.y - 2, Linea.PuntoIni.x + 2, Linea.PuntoIni.y + 2);
Ellipse (HDC_dest, Linea.PuntoEnd.x - 2, Linea.PuntoEnd.y - 2, Linea.PuntoEnd.x + 2, Linea.PuntoEnd.y + 2);
DeleteObject(hPen);
hPen = CreatePen(0, 1, (COLORREF)NumeroAleatorio((UINT)0,(UINT)3000000));
DeleteObject(SelectObject(HDC_dest, hPen));
MoveToEx (HDC_dest, Linea.PuntoIni.x, Linea.PuntoIni.y, NULL);
LineTo (HDC_dest, Linea.PuntoEnd.x, Linea.PuntoEnd.y);
DeleteObject (hPen);
}
VOID ProcessMessages()
{
MSG msg;
while (GetMessage(&msg, NULL, NULL, NULL) != -1)
DispatchMessage(&msg);
}
Temibles Lunas!¡.