|  Ya regrese, aqui tienes un pequeño ejemplo de una ventana modificada en Forma y comportamiento.No esperes la gran cosa.
 no logre comentarlo todo, trata de compilarlo, lo estudias un poco y si quieres despues lo discutimos.
 
 
 #include <windows.h>
 
 
 LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
 const int IDB_CLOSE    = 100;
 const int IDB_MAXIMIZE = 101;
 const int IDB_MINIMIZE = 102;
 
 //Nombre de la clase de mi ventana.
 char szClassName[ ] = "WindowsApp";
 
 //En progra<macion WinAPI se usa WinMain en lugar de main.
 int WINAPI WinMain (HINSTANCE hThisInstance,  HINSTANCE hPrevInstance,LPSTR lpszArgument, int nFunsterStil)
 
 {
 HWND hwnd;
 MSG messages;
 WNDCLASSEX wincl;
 
 
 wincl.hInstance = hThisInstance;
 wincl.lpszClassName = szClassName;
 wincl.lpfnWndProc = WindowProcedure;
 wincl.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;
 wincl.cbSize = sizeof (WNDCLASSEX);
 wincl.hIcon = NULL;
 wincl.hIconSm = NULL;
 wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
 wincl.lpszMenuName = NULL;
 wincl.cbClsExtra = 0;
 wincl.cbWndExtra = 0;
 wincl.hbrBackground = (HBRUSH)(COLOR_WINDOW+2);
 
 //Registro mi clase de ventana para poder crear una venta
 //con las caracteristicas que yo quiera usar.
 
 if (!RegisterClassEx (&wincl)) return 0;
 
 //Creao mi ventana indicando el nombre de la clase que registre.
 hwnd = CreateWindowEx (
 0,
 szClassName,
 NULL,
 WS_SYSMENU|WS_POPUP|WS_VISIBLE, //estos son los estilos de ventana
 //en este caso indique que se pueda cerra y que sea visible.
 CW_USEDEFAULT,
 CW_USEDEFAULT,
 300,
 300,
 NULL,
 NULL,
 hThisInstance,
 NULL
 );
 
 ShowWindow (hwnd, nFunsterStil); //Muestor la ventana
 
 
 //Bucle de mensajes de mi programa
 //indispensable en todos los programas con WinAPI.
 //a excepcion de los que usan DialogBox como Ventana principal.
 
 while (GetMessage (&messages, NULL, 0, 0))
 {
 TranslateMessage(&messages);
 DispatchMessage(&messages);
 }
 
 //Solo como regla es importante retornar wParam.
 return messages.wParam;
 }
 
 
 
 
 LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
 //declaro las variables locales a mi Procedimiento de ventana
 //muchos son estaticos ya que se crearan en una llamada de la funcion y se podran usaran en otra.
 static HINSTANCE hInstance;
 static RECT rect;
 static RECT screen;
 static HWND maxButton;
 static HWND minButton;
 static HWND closButton;
 static HRGN rgn;
 WINDOWPLACEMENT wp;
 
 //empiesa la captura de mensajes(manejo)
 switch (message)
 {
 case WM_CREATE://Generalmente aqui es donde se crean las ventanas hijas.(controles)
 hInstance = ((LPCREATESTRUCT)lParam)->hInstance;
 closButton = CreateWindow("Button", "Close", BS_PUSHBUTTON|WS_CHILD|WS_DLGFRAME|WS_VISIBLE,
 10,10,25,25, hwnd, (HMENU)IDB_CLOSE, hInstance, NULL);
 maxButton = CreateWindow("Button", "Max", BS_PUSHBUTTON|WS_CHILD|WS_DLGFRAME|WS_VISIBLE,
 35,10,25,25, hwnd, (HMENU)IDB_MAXIMIZE, hInstance, NULL);
 minButton = CreateWindow("Button", "Min", BS_PUSHBUTTON|WS_CHILD|WS_DLGFRAME|WS_VISIBLE,
 60,10,25,25, hwnd, (HMENU)IDB_MINIMIZE, hInstance, NULL);
 
 //Obtengo el rectangulo del escritorio
 GetClientRect(GetDesktopWindow(), &screen);
 //Obtengo el rectangulo de mi ventana y la centro en la pantalla.
 GetClientRect(hwnd, &rect);
 MoveWindow(hwnd, screen.right/2-rect.right/2, screen.bottom/2 - rect.bottom/2, 300, 300, TRUE);
 break;
 case WM_PAINT:
 {
 //declaro las variables locales a el evento Paint.
 PAINTSTRUCT ps;
 HBRUSH hbrush;
 HBRUSH hatchb;
 HBRUSH blueb;
 HPEN   hpen;
 HPEN   redp;
 HPEN   nullp;
 HDC dc;
 
 //Creao mis plumas y brochas que seran seleccionadas para ser usadan en
 //el dispositivo de contexto(dc).
 hatchb = CreateHatchBrush(HS_CROSS, RGB(0,200,0));
 blueb = CreateSolidBrush(RGB(0,0,150));
 nullp = (HPEN)GetStockObject(NULL_PEN);
 redp = CreatePen(0,5,RGB(255,0,0));
 //En WM_PAINT el dc se obtienen con BeginPaint.
 dc = BeginPaint(hwnd, &ps);
 hbrush = (HBRUSH)SelectObject(dc, blueb);
 hpen = (HPEN)SelectObject(dc, nullp);
 //Dibujo el rectangulo de pie de ventana.
 Rectangle(dc, rect.left, rect.bottom-60, rect.right, rect.bottom);
 SelectObject(dc, hatchb);
 SelectObject(dc, redp);
 //Dibuja un circulo tramado.
 Ellipse(dc, 100, 100, rect.right-100, rect.bottom-100);
 // Seleciono las plumas y brocha por default.
 SelectObject(dc, hbrush);
 SelectObject(dc, hpen);
 //En WM_PAINT el dc se retorna con EndPaint.
 EndPaint(hwnd, &ps);
 
 //Destruyo mis plumas y brochas.
 DeleteObject(hatchb);
 DeleteObject(blueb);
 DeleteObject(nullp);
 DeleteObject(redp);
 
 }
 break;
 case WM_SIZE:  //configuro mi ventana y controles.
 GetClientRect(hwnd, &rect);
 rgn = CreateRoundRectRgn(rect.left+2, rect.top+2, rect.right, rect.bottom,150,150);
 SetWindowRgn(hwnd, rgn, TRUE); //Es esta funcion la que hace el recorte.
 MoveWindow(closButton, rect.right/2+25, rect.bottom-50, 50,40, TRUE);
 MoveWindow(maxButton, rect.right/2-25, rect.bottom-50, 50, 40, TRUE);
 MoveWindow(minButton, rect.right/2-75, rect.bottom-50, 50, 40, TRUE);
 break;
 case WM_COMMAND: //manipulo los mensajes de los botones u otros controles.
 switch(LOWORD(wParam))
 {
 case IDB_CLOSE:
 //Destruyo la ventana.(Esto es para mandar el mensaje WM_DESTROY a mi ventana)
 DestroyWindow(hwnd);
 break;
 case IDB_MAXIMIZE:
 GetWindowPlacement(hwnd, &wp);
 if(wp.showCmd == SW_MAXIMIZE)
 ShowWindow(hwnd, SW_RESTORE);
 else
 ShowWindow(hwnd, SW_MAXIMIZE);
 break;
 case IDB_MINIMIZE:
 ShowWindow(hwnd, SW_MINIMIZE);
 break;
 }
 break;
 case WM_DESTROY: // Cierro la aplicacion.
 PostQuitMessage (0);
 break;
 default:
 return DefWindowProc (hwnd, message, wParam, lParam);
 }
 
 return 0;
 }
 
 Esta compilado con el DevC++, pero no veo por que no se compile perfectamente en Visual C++ o Builder C++.
 
 Saludos.
   Última edición por Nivel7; 29/08/2006 a las 02:47
     |