Programación General > C++ Builder
Ventanitas Como Las De Aviso En Msn
© Jonathan ©:
Hola nuevamente, juank, agradesco la ayuda ue me proporcionas, buscare info acerca del tema... para los demas, aui les adjunto el fuente, si esta en Visual C++ y utiliza API's de windows. Saludos y haber ue podemos hacer para traducirlo. :hola:
The Black Boy:
Gracias Jonathan por el codigo
JuanK:
Este es un ejemplo inoficioso y poco eficas, efectivo etc...
de lo que se puede hacer con gdi(si tienes Xp mejor usa gdi+)
--- Código: Text --- #include<stdio.h> #include<windows.h> int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int ); LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); int makeAllScreenWindow(HWND , HINSTANCE , int ); char WindowName[] = "Bitmap"; char WindowTitle[] = "Bitmap"; int x=10, y=10, Hres, Vres, speedy=1, speedx=2; HDC hdc, hdcMem, hdcMemBackUp; HGDIOBJ hbm,hbmBK; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG msg; HWND hwnd=NULL; makeAllScreenWindow(hwnd,hInstance,nCmdShow ); hdc = CreateDC( "DISPLAY", NULL, NULL, NULL ); /*Hres=GetDeviceCaps(hdc, HORZRES); Vres=GetDeviceCaps(hdc, VERTRES); */ Hres=300; Vres=300; hdcMem = CreateCompatibleDC(hdc); hdcMemBackUp = CreateCompatibleDC(hdc); hbm = CreateCompatibleBitmap(hdc, Hres, Vres); hbmBK = CreateCompatibleBitmap(hdc, Hres, Vres); SelectObject(hdcMemBackUp, hbmBK); SelectObject(hdcMem, hbm); BitBlt(hdcMemBackUp,0,0,Hres, Vres , hdc, 0,0, SRCCOPY); while( GetMessage( &msg, NULL, 0, 0 ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } BitBlt(hdc,0,0,Hres, Vres , hdcMemBackUp, 0,0, SRCCOPY); DeleteDC( hdcMemBackUp ); DeleteDC( hdcMem ); DeleteDC( hdc ); return( msg.wParam ); } LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) { switch( message ) { case WM_PAINT: BitBlt(hdcMem,0,0,Hres, Vres , hdcMemBackUp, 0,0, SRCCOPY); TextOut( hdcMem, 0, 0, "Ejemplo GDI, presione escape para salir",39); Rectangle (hdcMem,x,y,x+50,y+50); if(x+50>Hres) speedx*=(-1); if(y+50>Vres) speedy*=(-1); if(x<=0) speedx*=(-1); if(y<=0) speedy*=(-1); x+=speedx; y+=speedy; if(!BitBlt(hdc,0,0, Hres, Vres, hdcMem, 0,0, SRCCOPY)) TextOut( hdc, 0, 0, "Fallo al escribiir en hdc desde hdcmem",33); return 0L; break; case WM_KEYDOWN: switch(wParam) { case VK_ESCAPE: DestroyWindow( hwnd ); break; default: break; } break; case WM_DESTROY: PostQuitMessage( 0 ); break; default: return( DefWindowProc( hwnd, message, wParam, lParam ) ); } return(0); } int makeAllScreenWindow(HWND hwnd, HINSTANCE hInstance, int nCmdShow) { WNDCLASSEX wcx; wcx.cbSize = sizeof( WNDCLASSEX ); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = WndProc; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = hInstance; wcx.hIcon = LoadIcon(NULL, IDI_WINLOGO); wcx.hCursor = LoadCursor(NULL, IDC_ARROW); wcx.hbrBackground = (HBRUSH) GetStockObject( WHITE_BRUSH ); wcx.hIconSm = LoadIcon(NULL, IDI_WINLOGO); wcx.lpszClassName = WindowName; wcx.lpszMenuName = NULL; if( !RegisterClassEx( &wcx ) ) return( FALSE ); hwnd = CreateWindowEx( WS_EX_OVERLAPPEDWINDOW, WindowName, WindowTitle, WS_POPUP , 0, 0,1, 1, NULL, NULL, hInstance, NULL); if( !hwnd ) return( FALSE ); ShowWindow( hwnd, nCmdShow ); return TRUE; }
JuanK:
bueno hay cosxas del codigo que puse que no se usan para nada, pero eso lo tendran que averiguar porqu aca en la oficina no puedo recompilar nada de eso.
© Jonathan ©:
Hola juank, muy bueno el ejemplo que has posteado, ahora entiendo como escrbir en el escritorio... Gracias amigo! . Saludos :hola:
Navegación
[*] Página Anterior
Ir a la versión completa