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

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  [SOLUCIONADO] ¿Cómo añadir dos botones al formulario?
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: 1 [2] 3 Ir Abajo Respuesta Imprimir
Autor Tema: [SOLUCIONADO] ¿Cómo añadir dos botones al formulario?  (Leído 10,574 veces)
Meta


Desconectado Desconectado

Mensajes: 3.438



Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #10 en: 7 Abril 2018, 21:19 pm »

Buenas:

No se ni donde poner ese código.

aaaa.cpp:
Código
  1. // aaaa.cpp: define el punto de entrada de la aplicación.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "aaaa.h"
  6.  
  7. #define MAX_LOADSTRING 100
  8.  
  9. // Variables globales:
  10. HINSTANCE hInst;                                // Instancia actual
  11. WCHAR szTitle[MAX_LOADSTRING];                  // Texto de la barra de título
  12. WCHAR szWindowClass[MAX_LOADSTRING];            // nombre de clase de la ventana principal
  13.  
  14. // Declaraciones de funciones adelantadas incluidas en este módulo de código:
  15. ATOM                MyRegisterClass(HINSTANCE hInstance);
  16. BOOL                InitInstance(HINSTANCE, int);
  17. LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
  18. INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);
  19.  
  20. int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
  21.                     _In_opt_ HINSTANCE hPrevInstance,
  22.                     _In_ LPWSTR    lpCmdLine,
  23.                     _In_ int       nCmdShow)
  24. {
  25.    UNREFERENCED_PARAMETER(hPrevInstance);
  26.    UNREFERENCED_PARAMETER(lpCmdLine);
  27.  
  28.    // TODO: colocar código aquí.
  29.  
  30.    // Inicializar cadenas globales
  31.    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
  32.    LoadStringW(hInstance, IDC_AAAA, szWindowClass, MAX_LOADSTRING);
  33.    MyRegisterClass(hInstance);
  34.  
  35.    // Realizar la inicialización de la aplicación:
  36.    if (!InitInstance (hInstance, nCmdShow))
  37.    {
  38.        return FALSE;
  39.    }
  40.  
  41.    HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_AAAA));
  42.  
  43.    MSG msg;
  44.  
  45.    // Bucle principal de mensajes:
  46.    while (GetMessage(&msg, nullptr, 0, 0))
  47.    {
  48.        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  49.        {
  50.            TranslateMessage(&msg);
  51.            DispatchMessage(&msg);
  52.        }
  53.    }
  54.  
  55.    return (int) msg.wParam;
  56. }
  57.  
  58.  
  59.  
  60. //
  61. //  FUNCIÓN: MyRegisterClass()
  62. //
  63. //  PROPÓSITO: registrar la clase de ventana.
  64. //
  65. ATOM MyRegisterClass(HINSTANCE hInstance)
  66. {
  67.    WNDCLASSEXW wcex;
  68.  
  69.    wcex.cbSize = sizeof(WNDCLASSEX);
  70.  
  71.    wcex.style          = CS_HREDRAW | CS_VREDRAW;
  72.    wcex.lpfnWndProc    = WndProc;
  73.    wcex.cbClsExtra     = 0;
  74.    wcex.cbWndExtra     = 0;
  75.    wcex.hInstance      = hInstance;
  76.    wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_AAAA));
  77.    wcex.hCursor        = LoadCursor(nullptr, IDC_ARROW);
  78.    wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
  79.    wcex.lpszMenuName   = MAKEINTRESOURCEW(IDC_AAAA);
  80.    wcex.lpszClassName  = szWindowClass;
  81.    wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
  82.  
  83.    return RegisterClassExW(&wcex);
  84. }
  85.  
  86. //
  87. //   FUNCIÓN: InitInstance(HINSTANCE, int)
  88. //
  89. //   PROPÓSITO: guardar el identificador de instancia y crear la ventana principal
  90. //
  91. //   COMENTARIOS:
  92. //
  93. //        En esta función, se guarda el identificador de instancia en una variable común y
  94. //        se crea y muestra la ventana principal del programa.
  95. //
  96. BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
  97. {
  98.   hInst = hInstance; // Almacenar identificador de instancia en una variable global
  99.  
  100.   HWND hWnd = CreateWindowW(
  101.   szWindowClass,
  102.   szTitle,
  103.   WS_OVERLAPPEDWINDOW,
  104. CW_USEDEFAULT,
  105.   0,
  106.   CW_USEDEFAULT,
  107.   0,
  108.   nullptr,
  109.   nullptr,
  110.   hInstance,
  111.   nullptr);
  112.  
  113.   if (!hWnd)
  114.   {
  115.      return FALSE;
  116.   }
  117.  
  118.   ShowWindow(hWnd, nCmdShow);
  119.   UpdateWindow(hWnd);
  120.  
  121.   return TRUE;
  122. }
  123.  
  124. // ######################################################################
  125.  
  126. HWND hwndButton = CreateWindow(
  127. L"BUTTON",  // Predefined class; Unicode assumed
  128. L"OK",      // Button text
  129. WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,  // Styles
  130. 10,         // x position
  131. 10,         // y position
  132. 100,        // Button width
  133. 100,        // Button height
  134. m_hwnd,     // Parent window
  135. NULL,       // No menu.
  136. (HINSTANCE)GetWindowLong(m_hwnd, GWL_HINSTANCE),
  137. NULL);      // Pointer not needed.
  138.  
  139. // ######################################################################
  140.  
  141. //
  142. //  FUNCIÓN: WndProc(HWND, UINT, WPARAM, LPARAM)
  143. //
  144. //  PROPÓSITO:  procesar mensajes de la ventana principal.
  145. //
  146. //  WM_COMMAND  - procesar el menú de aplicaciones
  147. //  WM_PAINT    - Pintar la ventana principal
  148. //  WM_DESTROY  - publicar un mensaje de salida y volver
  149. //
  150. //
  151. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  152. {
  153.    switch (message)
  154.    {
  155.    case WM_COMMAND:
  156.        {
  157.            int wmId = LOWORD(wParam);
  158.            // Analizar las selecciones de menú:
  159.            switch (wmId)
  160.            {
  161.            case IDM_ABOUT:
  162.                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
  163.                break;
  164.            case IDM_EXIT:
  165.                DestroyWindow(hWnd);
  166.                break;
  167.            default:
  168.                return DefWindowProc(hWnd, message, wParam, lParam);
  169.            }
  170.        }
  171.        break;
  172.    case WM_PAINT:
  173.        {
  174.            PAINTSTRUCT ps;
  175.            HDC hdc = BeginPaint(hWnd, &ps);
  176.            // TODO: Agregar cualquier código de dibujo que use hDC aquí...
  177.            EndPaint(hWnd, &ps);
  178.        }
  179.        break;
  180.    case WM_DESTROY:
  181.        PostQuitMessage(0);
  182.        break;
  183.    default:
  184.        return DefWindowProc(hWnd, message, wParam, lParam);
  185.    }
  186.    return 0;
  187. }
  188.  
  189. // Controlador de mensajes del cuadro Acerca de.
  190. INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  191. {
  192.    UNREFERENCED_PARAMETER(lParam);
  193.    switch (message)
  194.    {
  195.    case WM_INITDIALOG:
  196.        return (INT_PTR)TRUE;
  197.  
  198.    case WM_COMMAND:
  199.        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
  200.        {
  201.            EndDialog(hDlg, LOWORD(wParam));
  202.            return (INT_PTR)TRUE;
  203.        }
  204.        break;
  205.    }
  206.    return (INT_PTR)FALSE;
  207. }
  208.  

Hay dos códigos más, el del botón:
Código
  1. HWND hwndButton = CreateWindow(
  2.    L"BUTTON",  // Predefined class; Unicode assumed
  3.    L"OK",      // Button text
  4.    WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,  // Styles
  5.    10,         // x position
  6.    10,         // y position
  7.    100,        // Button width
  8.    100,        // Button height
  9.    m_hwnd,     // Parent window
  10.    NULL,       // No menu.
  11.    (HINSTANCE)GetWindowLong(m_hwnd, GWL_HINSTANCE),
  12.    NULL);      // Pointer not needed.

Que lo dice aquí, y el punto de coordenada que lo dice aquí como han puesto.

Coordenada.
Código
  1. void CMyApp::OnHideApplication()
  2. {
  3.   //m_pMainWnd is the main application window, a member of CMyApp
  4.   ASSERT_VALID(m_pMainWnd);
  5.  
  6.   // hide the application's windows before closing all the documents
  7.   m_pMainWnd->ShowWindow(SW_HIDE);
  8.   m_pMainWnd->ShowOwnedPopups(FALSE);
  9.  
  10.   // put the window at the bottom of z-order, so it isn't activated
  11.   m_pMainWnd->SetWindowPos(&CWnd::wndBottom, 0, 0, 0, 0,
  12.      SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
  13. }

Saludos.


En línea

srWhiteSkull


Desconectado Desconectado

Mensajes: 444



Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #11 en: 7 Abril 2018, 21:50 pm »

Puedes meter la función en la misma función de instancia. Jo que tampoco es nada del otro mundo :

Código:
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   hInst = hInstance; // Almacenar identificador de instancia en una variable global
 
   HWND hWnd = CreateWindowW(
  szWindowClass,
  szTitle,
  WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
  0,
  CW_USEDEFAULT,
  0,
  nullptr,
  nullptr,
  hInstance,
  nullptr);
 
   if (!hWnd)
   {
      return FALSE;
   }
 
   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);
   // AQUI POR EJEMPLO!!! pos : (100,100), size(600,400)
   SetWindowPos(hWnd, 0, 100, 100, 600, 400, NULL);
 
   return TRUE;
}


En línea

Meta


Desconectado Desconectado

Mensajes: 3.438



Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #12 en: 7 Abril 2018, 22:21 pm »

Muchas gracias campeón.

Aún así me dice algo más de un error.

Código
  1. #include "stdafx.h"
  2. #include "aaaa.h"
  3.  
  4. #define MAX_LOADSTRING 100
  5.  
  6. // Variables globales:
  7. HINSTANCE hInst;                                // Instancia actual
  8. WCHAR szTitle[MAX_LOADSTRING];                  // Texto de la barra de título
  9. WCHAR szWindowClass[MAX_LOADSTRING];            // nombre de clase de la ventana principal
  10.  
  11. // Declaraciones de funciones adelantadas incluidas en este módulo de código:
  12. ATOM                MyRegisterClass(HINSTANCE hInstance);
  13. BOOL                InitInstance(HINSTANCE, int);
  14. LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
  15. INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);
  16.  
  17. int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
  18.                     _In_opt_ HINSTANCE hPrevInstance,
  19.                     _In_ LPWSTR    lpCmdLine,
  20.                     _In_ int       nCmdShow)
  21. {
  22.    UNREFERENCED_PARAMETER(hPrevInstance);
  23.    UNREFERENCED_PARAMETER(lpCmdLine);
  24.  
  25.    // TODO: colocar código aquí.
  26.  
  27.    // Inicializar cadenas globales
  28.    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
  29.    LoadStringW(hInstance, IDC_AAAA, szWindowClass, MAX_LOADSTRING);
  30.    MyRegisterClass(hInstance);
  31.  
  32.    // Realizar la inicialización de la aplicación:
  33.    if (!InitInstance (hInstance, nCmdShow))
  34.    {
  35.        return FALSE;
  36.    }
  37.  
  38.    HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_AAAA));
  39.  
  40.    MSG msg;
  41.  
  42.    // Bucle principal de mensajes:
  43.    while (GetMessage(&msg, nullptr, 0, 0))
  44.    {
  45.        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  46.        {
  47.            TranslateMessage(&msg);
  48.            DispatchMessage(&msg);
  49.        }
  50.    }
  51.  
  52.    return (int) msg.wParam;
  53. }
  54.  
  55.  
  56.  
  57. //
  58. //  FUNCIÓN: MyRegisterClass()
  59. //
  60. //  PROPÓSITO: registrar la clase de ventana.
  61. //
  62. ATOM MyRegisterClass(HINSTANCE hInstance)
  63. {
  64.    WNDCLASSEXW wcex;
  65.  
  66.    wcex.cbSize = sizeof(WNDCLASSEX);
  67.  
  68.    wcex.style          = CS_HREDRAW | CS_VREDRAW;
  69.    wcex.lpfnWndProc    = WndProc;
  70.    wcex.cbClsExtra     = 0;
  71.    wcex.cbWndExtra     = 0;
  72.    wcex.hInstance      = hInstance;
  73.    wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_AAAA));
  74.    wcex.hCursor        = LoadCursor(nullptr, IDC_ARROW);
  75.    wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
  76.    wcex.lpszMenuName   = MAKEINTRESOURCEW(IDC_AAAA);
  77.    wcex.lpszClassName  = szWindowClass;
  78.    wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
  79.  
  80.    return RegisterClassExW(&wcex);
  81. }
  82.  
  83. //
  84. //   FUNCIÓN: InitInstance(HINSTANCE, int)
  85. //
  86. //   PROPÓSITO: guardar el identificador de instancia y crear la ventana principal
  87. //
  88. //   COMENTARIOS:
  89. //
  90. //        En esta función, se guarda el identificador de instancia en una variable común y
  91. //        se crea y muestra la ventana principal del programa.
  92. //
  93. BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
  94. {
  95.   hInst = hInstance; // Almacenar identificador de instancia en una variable global
  96.  
  97.   HWND hWnd = CreateWindowW(
  98.   szWindowClass,
  99.   szTitle,
  100.   WS_OVERLAPPEDWINDOW,
  101. CW_USEDEFAULT,
  102.   0,
  103.   CW_USEDEFAULT,
  104.   0,
  105.   nullptr,
  106.   nullptr,
  107.   hInstance,
  108.   nullptr);
  109.  
  110.   if (!hWnd)
  111.   {
  112.      return FALSE;
  113.   }
  114.  
  115.   ShowWindow(hWnd, nCmdShow);
  116.   UpdateWindow(hWnd);
  117.  
  118.   return TRUE;
  119. }
  120.  
  121. // ######################################################################
  122.  
  123. BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
  124. {
  125. hInst = hInstance; // Almacenar identificador de instancia en una variable global
  126.  
  127. HWND hWnd = CreateWindowW(
  128. szWindowClass,
  129. szTitle,
  130. WS_OVERLAPPEDWINDOW,
  131. CW_USEDEFAULT,
  132. 0,
  133. CW_USEDEFAULT,
  134. 0,
  135. nullptr,
  136. nullptr,
  137. hInstance,
  138. nullptr);
  139.  
  140. if (!hWnd)
  141. {
  142. return FALSE;
  143. }
  144.  
  145. ShowWindow(hWnd, nCmdShow);
  146. UpdateWindow(hWnd);
  147. // AQUI POR EJEMPLO!!! pos : (100,100), size(600,400)
  148. SetWindowPos(hWnd, 0, 100, 100, 600, 400, NULL);
  149.  
  150. return TRUE;
  151. }
  152.  
  153. // ######################################################################
  154.  
  155. //
  156. //  FUNCIÓN: WndProc(HWND, UINT, WPARAM, LPARAM)
  157. //
  158. //  PROPÓSITO:  procesar mensajes de la ventana principal.
  159. //
  160. //  WM_COMMAND  - procesar el menú de aplicaciones
  161. //  WM_PAINT    - Pintar la ventana principal
  162. //  WM_DESTROY  - publicar un mensaje de salida y volver
  163. //
  164. //
  165. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  166. {
  167.    switch (message)
  168.    {
  169.    case WM_COMMAND:
  170.        {
  171.            int wmId = LOWORD(wParam);
  172.            // Analizar las selecciones de menú:
  173.            switch (wmId)
  174.            {
  175.            case IDM_ABOUT:
  176.                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
  177.                break;
  178.            case IDM_EXIT:
  179.                DestroyWindow(hWnd);
  180.                break;
  181.            default:
  182.                return DefWindowProc(hWnd, message, wParam, lParam);
  183.            }
  184.        }
  185.        break;
  186.    case WM_PAINT:
  187.        {
  188.            PAINTSTRUCT ps;
  189.            HDC hdc = BeginPaint(hWnd, &ps);
  190.            // TODO: Agregar cualquier código de dibujo que use hDC aquí...
  191.            EndPaint(hWnd, &ps);
  192.        }
  193.        break;
  194.    case WM_DESTROY:
  195.        PostQuitMessage(0);
  196.        break;
  197.    default:
  198.        return DefWindowProc(hWnd, message, wParam, lParam);
  199.    }
  200.    return 0;
  201. }
  202.  
  203. // Controlador de mensajes del cuadro Acerca de.
  204. INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  205. {
  206.    UNREFERENCED_PARAMETER(lParam);
  207.    switch (message)
  208.    {
  209.    case WM_INITDIALOG:
  210.        return (INT_PTR)TRUE;
  211.  
  212.    case WM_COMMAND:
  213.        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
  214.        {
  215.            EndDialog(hDlg, LOWORD(wParam));
  216.            return (INT_PTR)TRUE;
  217.        }
  218.        break;
  219.    }
  220.    return (INT_PTR)FALSE;
  221. }

Gravedad   Código   Descripción   Proyecto   Archivo   Línea   Estado suprimido
Error   C2084   la función 'BOOL InitInstance(HINSTANCE,int)' ya tiene un cuerpo   aaaa   c:\users\usuario\documents\visual studio 2017\projects\aaaa\aaaa\aaaa.cpp   130   
En línea

srWhiteSkull


Desconectado Desconectado

Mensajes: 444



Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #13 en: 7 Abril 2018, 22:23 pm »

A ver Mc fly, no deberías tener dos funciones de instancia  :rolleyes:
En línea

Meta


Desconectado Desconectado

Mensajes: 3.438



Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #14 en: 7 Abril 2018, 23:14 pm »

Buenas:

El como lo hice me funciona pero no aparece botón ni cambio de tamaño del formulario.
Código
  1. // aaaa.cpp: define el punto de entrada de la aplicación.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "aaaa.h"
  6.  
  7. #define MAX_LOADSTRING 100
  8.  
  9. // Variables globales:
  10. HINSTANCE hInst;                                // Instancia actual
  11. WCHAR szTitle[MAX_LOADSTRING];                  // Texto de la barra de título
  12. WCHAR szWindowClass[MAX_LOADSTRING];            // nombre de clase de la ventana principal
  13.  
  14. // Declaraciones de funciones adelantadas incluidas en este módulo de código:
  15. ATOM                MyRegisterClass(HINSTANCE hInstance);
  16. BOOL                InitInstance(HINSTANCE, int);
  17. LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
  18. INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);
  19.  
  20. int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
  21.                     _In_opt_ HINSTANCE hPrevInstance,
  22.                     _In_ LPWSTR    lpCmdLine,
  23.                     _In_ int       nCmdShow)
  24. {
  25.    UNREFERENCED_PARAMETER(hPrevInstance);
  26.    UNREFERENCED_PARAMETER(lpCmdLine);
  27.  
  28.    // TODO: colocar código aquí.
  29.  
  30.    // Inicializar cadenas globales
  31.    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
  32.    LoadStringW(hInstance, IDC_AAAA, szWindowClass, MAX_LOADSTRING);
  33.    MyRegisterClass(hInstance);
  34.  
  35.    // Realizar la inicialización de la aplicación:
  36.    if (!InitInstance (hInstance, nCmdShow))
  37.    {
  38.        return FALSE;
  39.    }
  40.  
  41.    HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_AAAA));
  42.  
  43.    MSG msg;
  44.  
  45.    // Bucle principal de mensajes:
  46.    while (GetMessage(&msg, nullptr, 0, 0))
  47.    {
  48.        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  49.        {
  50.            TranslateMessage(&msg);
  51.            DispatchMessage(&msg);
  52.        }
  53.    }
  54.  
  55.    return (int) msg.wParam;
  56. }
  57.  
  58.  
  59.  
  60. //
  61. //  FUNCIÓN: MyRegisterClass()
  62. //
  63. //  PROPÓSITO: registrar la clase de ventana.
  64. //
  65. ATOM MyRegisterClass(HINSTANCE hInstance)
  66. {
  67.    WNDCLASSEXW wcex;
  68.  
  69.    wcex.cbSize = sizeof(WNDCLASSEX);
  70.  
  71.    wcex.style          = CS_HREDRAW | CS_VREDRAW;
  72.    wcex.lpfnWndProc    = WndProc;
  73.    wcex.cbClsExtra     = 0;
  74.    wcex.cbWndExtra     = 0;
  75.    wcex.hInstance      = hInstance;
  76.    wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_AAAA));
  77.    wcex.hCursor        = LoadCursor(nullptr, IDC_ARROW);
  78.    wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
  79.    wcex.lpszMenuName   = MAKEINTRESOURCEW(IDC_AAAA);
  80.    wcex.lpszClassName  = szWindowClass;
  81.    wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
  82.  
  83.    return RegisterClassExW(&wcex);
  84. }
  85.  
  86. //
  87. //   FUNCIÓN: InitInstance(HINSTANCE, int)
  88. //
  89. //   PROPÓSITO: guardar el identificador de instancia y crear la ventana principal
  90. //
  91. //   COMENTARIOS:
  92. //
  93. //        En esta función, se guarda el identificador de instancia en una variable común y
  94. //        se crea y muestra la ventana principal del programa.
  95. //
  96. BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
  97. {
  98.   hInst = hInstance; // Almacenar identificador de instancia en una variable global
  99.  
  100.   HWND hWnd = CreateWindowW(
  101.   szWindowClass,
  102.   szTitle,
  103.   WS_OVERLAPPEDWINDOW,
  104. CW_USEDEFAULT,
  105.   0,
  106.   CW_USEDEFAULT,
  107.   0,
  108.   nullptr,
  109.   nullptr,
  110.   hInstance,
  111.   nullptr);
  112.  
  113.   if (!hWnd)
  114.   {
  115.      return FALSE;
  116.   }
  117.  
  118.   ShowWindow(hWnd, nCmdShow);
  119.   UpdateWindow(hWnd);
  120.  
  121.   return TRUE;
  122.  
  123.   // ######################################################################
  124.   hInst = hInstance; // Almacenar identificador de instancia en una variable global
  125.  
  126.   HWND hWnd2 = CreateWindowW(
  127.   szWindowClass,
  128.   szTitle,
  129.   WS_OVERLAPPEDWINDOW,
  130.   CW_USEDEFAULT,
  131.   0,
  132.   CW_USEDEFAULT,
  133.   0,
  134.   nullptr,
  135.   nullptr,
  136.   hInstance,
  137.   nullptr);
  138.  
  139.   if (!hWnd2)
  140.   {
  141.   return FALSE;
  142.   }
  143.  
  144.   ShowWindow(hWnd2, nCmdShow);
  145.   UpdateWindow(hWnd2);
  146.   // AQUI POR EJEMPLO!!! posición(100,100), tamaño(600,400)
  147.   SetWindowPos(hWnd2, 0, 100, 100, 600, 400, NULL);
  148.  
  149.   return TRUE;
  150.   // ######################################################################
  151. }
  152.  
  153. //
  154. //  FUNCIÓN: WndProc(HWND, UINT, WPARAM, LPARAM)
  155. //
  156. //  PROPÓSITO:  procesar mensajes de la ventana principal.
  157. //
  158. //  WM_COMMAND  - procesar el menú de aplicaciones
  159. //  WM_PAINT    - Pintar la ventana principal
  160. //  WM_DESTROY  - publicar un mensaje de salida y volver
  161. //
  162. //
  163. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  164. {
  165.    switch (message)
  166.    {
  167.    case WM_COMMAND:
  168.        {
  169.            int wmId = LOWORD(wParam);
  170.            // Analizar las selecciones de menú:
  171.            switch (wmId)
  172.            {
  173.            case IDM_ABOUT:
  174.                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
  175.                break;
  176.            case IDM_EXIT:
  177.                DestroyWindow(hWnd);
  178.                break;
  179.            default:
  180.                return DefWindowProc(hWnd, message, wParam, lParam);
  181.            }
  182.        }
  183.        break;
  184.    case WM_PAINT:
  185.        {
  186.            PAINTSTRUCT ps;
  187.            HDC hdc = BeginPaint(hWnd, &ps);
  188.            // TODO: Agregar cualquier código de dibujo que use hDC aquí...
  189.            EndPaint(hWnd, &ps);
  190.        }
  191.        break;
  192.    case WM_DESTROY:
  193.        PostQuitMessage(0);
  194.        break;
  195.    default:
  196.        return DefWindowProc(hWnd, message, wParam, lParam);
  197.    }
  198.    return 0;
  199. }
  200.  
  201. // Controlador de mensajes del cuadro Acerca de.
  202. INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  203. {
  204.    UNREFERENCED_PARAMETER(lParam);
  205.    switch (message)
  206.    {
  207.    case WM_INITDIALOG:
  208.        return (INT_PTR)TRUE;
  209.  
  210.    case WM_COMMAND:
  211.        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
  212.        {
  213.            EndDialog(hDlg, LOWORD(wParam));
  214.            return (INT_PTR)TRUE;
  215.        }
  216.        break;
  217.    }
  218.    return (INT_PTR)FALSE;
  219. }
  220.  
En línea

srWhiteSkull


Desconectado Desconectado

Mensajes: 444



Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #15 en: 7 Abril 2018, 23:19 pm »

Es algún tipo de broma?

Código:
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{ // de verdad esto es serio?
   hInst = hInstance; // Almacenar identificador de instancia en una variable global
 
   HWND hWnd = CreateWindowW(
   szWindowClass,
   szTitle,
   WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
   0,
   CW_USEDEFAULT,
   0,
   nullptr,
   nullptr,
   hInstance,
   nullptr);
 
   if (!hWnd)
   {
      return FALSE;
   }
 
   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);
 
   return TRUE; // me estas vacilando o algo asi?
 
   // ######################################################################
   hInst = hInstance; // Almacenar identificador de instancia en una variable global
 
   HWND hWnd2 = CreateWindowW(
   szWindowClass,
   szTitle,
   WS_OVERLAPPEDWINDOW,
   CW_USEDEFAULT,
   0,
   CW_USEDEFAULT,
   0,
   nullptr,
   nullptr,
   hInstance,
   nullptr);
 
   if (!hWnd2)
   {
   return FALSE;
   }
 
   ShowWindow(hWnd2, nCmdShow);
   UpdateWindow(hWnd2);
   // AQUI POR EJEMPLO!!! posición(100,100), tamaño(600,400)
   SetWindowPos(hWnd2, 0, 100, 100, 600, 400, NULL);
 
   return TRUE;
   // ######################################################################
}

Simplemente te tienes que deshacer de las primeras líneas de la instancia... y si en verdad esto es serio creo que lo primero que deberías hacer es aprender a programar C en la consola y luego pasar a cosas mayores.
En línea

Meta


Desconectado Desconectado

Mensajes: 3.438



Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #16 en: 8 Abril 2018, 00:10 am »

Ejecuta pero no hace nada, misma pantalla, el tamaño, aunque lo varíe, no hace nada.

Código
  1. #include "stdafx.h"
  2. #include "aaaa.h"
  3.  
  4. #define MAX_LOADSTRING 100
  5.  
  6. // Variables globales:
  7. HINSTANCE hInst;                                // Instancia actual
  8. WCHAR szTitle[MAX_LOADSTRING];                  // Texto de la barra de título
  9. WCHAR szWindowClass[MAX_LOADSTRING];            // nombre de clase de la ventana principal
  10.  
  11. // Declaraciones de funciones adelantadas incluidas en este módulo de código:
  12. ATOM                MyRegisterClass(HINSTANCE hInstance);
  13. BOOL                InitInstance(HINSTANCE, int);
  14. LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
  15. INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);
  16.  
  17. int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
  18.                     _In_opt_ HINSTANCE hPrevInstance,
  19.                     _In_ LPWSTR    lpCmdLine,
  20.                     _In_ int       nCmdShow)
  21. {
  22.    UNREFERENCED_PARAMETER(hPrevInstance);
  23.    UNREFERENCED_PARAMETER(lpCmdLine);
  24.  
  25.    // TODO: colocar código aquí.
  26.  
  27.    // Inicializar cadenas globales
  28.    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
  29.    LoadStringW(hInstance, IDC_AAAA, szWindowClass, MAX_LOADSTRING);
  30.    MyRegisterClass(hInstance);
  31.  
  32.    // Realizar la inicialización de la aplicación:
  33.    if (!InitInstance (hInstance, nCmdShow))
  34.    {
  35.        return FALSE;
  36.    }
  37.  
  38.    HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_AAAA));
  39.  
  40.    MSG msg;
  41.  
  42.    // Bucle principal de mensajes:
  43.    while (GetMessage(&msg, nullptr, 0, 0))
  44.    {
  45.        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  46.        {
  47.            TranslateMessage(&msg);
  48.            DispatchMessage(&msg);
  49.        }
  50.    }
  51.  
  52.    return (int) msg.wParam;
  53. }
  54.  
  55.  
  56.  
  57. //
  58. //  FUNCIÓN: MyRegisterClass()
  59. //
  60. //  PROPÓSITO: registrar la clase de ventana.
  61. //
  62. ATOM MyRegisterClass(HINSTANCE hInstance)
  63. {
  64.    WNDCLASSEXW wcex;
  65.  
  66.    wcex.cbSize = sizeof(WNDCLASSEX);
  67.  
  68.    wcex.style          = CS_HREDRAW | CS_VREDRAW;
  69.    wcex.lpfnWndProc    = WndProc;
  70.    wcex.cbClsExtra     = 0;
  71.    wcex.cbWndExtra     = 0;
  72.    wcex.hInstance      = hInstance;
  73.    wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_AAAA));
  74.    wcex.hCursor        = LoadCursor(nullptr, IDC_ARROW);
  75.    wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
  76.    wcex.lpszMenuName   = MAKEINTRESOURCEW(IDC_AAAA);
  77.    wcex.lpszClassName  = szWindowClass;
  78.    wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
  79.  
  80.    return RegisterClassExW(&wcex);
  81. }
  82.  
  83. //
  84. //   FUNCIÓN: InitInstance(HINSTANCE, int)
  85. //
  86. //   PROPÓSITO: guardar el identificador de instancia y crear la ventana principal
  87. //
  88. //   COMENTARIOS:
  89. //
  90. //        En esta función, se guarda el identificador de instancia en una variable común y
  91. //        se crea y muestra la ventana principal del programa.
  92. //
  93.  
  94.  
  95.   // ######################################################################
  96. BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
  97. { // de verdad esto es serio?
  98. hInst = hInstance; // Almacenar identificador de instancia en una variable global
  99.  
  100. HWND hWnd = CreateWindowW(
  101. szWindowClass,
  102. szTitle,
  103. WS_OVERLAPPEDWINDOW,
  104. CW_USEDEFAULT,
  105. 0,
  106. CW_USEDEFAULT,
  107. 0,
  108. nullptr,
  109. nullptr,
  110. hInstance,
  111. nullptr);
  112.  
  113. if (!hWnd)
  114. {
  115. return FALSE;
  116. }
  117.  
  118. ShowWindow(hWnd, nCmdShow);
  119. UpdateWindow(hWnd);
  120.  
  121. return TRUE; // me estas vacilando o algo asi?
  122.  
  123. // ######################################################################
  124. hInst = hInstance; // Almacenar identificador de instancia en una variable global
  125.  
  126. HWND hWnd2 = CreateWindowW(
  127. szWindowClass,
  128. szTitle,
  129. WS_OVERLAPPEDWINDOW,
  130. CW_USEDEFAULT,
  131. 0,
  132. CW_USEDEFAULT,
  133. 0,
  134. nullptr,
  135. nullptr,
  136. hInstance,
  137. nullptr);
  138.  
  139. if (!hWnd2)
  140. {
  141. return FALSE;
  142. }
  143.  
  144. ShowWindow(hWnd2, nCmdShow);
  145. UpdateWindow(hWnd2);
  146. // AQUI POR EJEMPLO!!! posición(100,100), tamaño(600,400)
  147. SetWindowPos(hWnd2, 0, 50, 50, 100, 100, NULL);
  148.  
  149. return TRUE;
  150. // ######################################################################
  151. }
  152.   // ######################################################################
  153.  
  154.  
  155. //
  156. //  FUNCIÓN: WndProc(HWND, UINT, WPARAM, LPARAM)
  157. //
  158. //  PROPÓSITO:  procesar mensajes de la ventana principal.
  159. //
  160. //  WM_COMMAND  - procesar el menú de aplicaciones
  161. //  WM_PAINT    - Pintar la ventana principal
  162. //  WM_DESTROY  - publicar un mensaje de salida y volver
  163. //
  164. //
  165. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  166. {
  167.    switch (message)
  168.    {
  169.    case WM_COMMAND:
  170.        {
  171.            int wmId = LOWORD(wParam);
  172.            // Analizar las selecciones de menú:
  173.            switch (wmId)
  174.            {
  175.            case IDM_ABOUT:
  176.                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
  177.                break;
  178.            case IDM_EXIT:
  179.                DestroyWindow(hWnd);
  180.                break;
  181.            default:
  182.                return DefWindowProc(hWnd, message, wParam, lParam);
  183.            }
  184.        }
  185.        break;
  186.    case WM_PAINT:
  187.        {
  188.            PAINTSTRUCT ps;
  189.            HDC hdc = BeginPaint(hWnd, &ps);
  190.            // TODO: Agregar cualquier código de dibujo que use hDC aquí...
  191.            EndPaint(hWnd, &ps);
  192.        }
  193.        break;
  194.    case WM_DESTROY:
  195.        PostQuitMessage(0);
  196.        break;
  197.    default:
  198.        return DefWindowProc(hWnd, message, wParam, lParam);
  199.    }
  200.    return 0;
  201. }
  202.  
  203. // Controlador de mensajes del cuadro Acerca de.
  204. INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  205. {
  206.    UNREFERENCED_PARAMETER(lParam);
  207.    switch (message)
  208.    {
  209.    case WM_INITDIALOG:
  210.        return (INT_PTR)TRUE;
  211.  
  212.    case WM_COMMAND:
  213.        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
  214.        {
  215.            EndDialog(hDlg, LOWORD(wParam));
  216.            return (INT_PTR)TRUE;
  217.        }
  218.        break;
  219.    }
  220.    return (INT_PTR)FALSE;
  221. }
En línea

ivancea96


Desconectado Desconectado

Mensajes: 3.412


ASMático


Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #17 en: 8 Abril 2018, 12:42 pm »

No se programa copiando y pegando código. Ni el código de srWhiteSkull leíste...

Lo mejor es que intentes otro tipo de proyecto de consola, como dice srWhiteSkull. WinAPI no es complicada, pero hay que saber C para usarla. Y saber C no es copiar y pegar trozos de código de la MSDN. Saber C es saber hacer ese código tú; saberlo leer e interpretar, o por lo menos, esforzarse en entenderlo.

Te podemos hacer el código nosotros con un botón. Pero dime tú que utilidad tendría eso.
En línea

Meta


Desconectado Desconectado

Mensajes: 3.438



Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #18 en: 8 Abril 2018, 21:22 pm »

Hola:

Leer, leer y leer he leído hasta las cejas.

Quiero redimensionar el formulario a 300 x 300 o al menos por ahí de ese tamaño. En cuanto a los dos botones, lo que quiero hacer, es ponerlo en el formulario. Lo que hace el botón, simplemente es abrir la bandeja del disco o lector y el otro cerrar.

En Win32 modo consola C++ es así.
Código
  1. #include "stdafx.h"
  2. #include "Windows.h"
  3. #include "iostream"
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. // Título de la ventana.
  10. SetConsoleTitle(L"Consola C++ Win32 2017");
  11.  
  12. // Variable.
  13. char entrada[] = "\0"; // Guarda A, a, C, y c tipo string que introduces desde la consola.
  14.  
  15. while (true)
  16. {
  17. // Muestra en pantalla textos.
  18. cout << "Control bandeja del lector: " << endl << endl;
  19. cout << "A - Abrir bandeja." << endl;
  20. cout << "C - Cerrar bandeja." << endl;
  21. cout << "==========================" << endl;
  22.  
  23. cin >> entrada; // Aquí introduces letras A, a, C, y c.
  24.  
  25. cout << "\n" << endl;
  26.  
  27. // Abrir bandeja.
  28. if ((entrada[0] == 'a') || (entrada[0] == 'A'))
  29. {
  30. cout << "Abriendo..." << endl << endl; // Muestra en pantalla textos.
  31. mciSendString(L"set cdaudio door open", nullptr, 0, nullptr);
  32. cout << "Abierto." << endl << endl; // Muestra en pantalla textos.
  33. }
  34. // Cerrar bandeja.
  35. else if ((entrada[0] == 'c') || (entrada[0] == 'C'))
  36. {
  37. cout << "Cerrando..." << endl << endl; // Muestra en pantalla textos.
  38. mciSendString(L"set cdaudio door closed", nullptr, 0, nullptr);
  39. cout << "Cerrado." << endl << endl; // Muestra en pantalla textos.
  40. }
  41. // Si haz pulsado otro caracter distinto de A, C, a, y c aparece
  42. else
  43. {
  44. cout << "Solo pulsar A o C." << endl << endl; // este mensaje.
  45.  
  46. }
  47. }
  48. return EXIT_SUCCESS;
  49. }

Consola C++ CLR .net:
Código
  1. #include "stdafx.h"
  2.  
  3. using namespace System;
  4. using namespace System::Runtime::InteropServices;
  5. using namespace System::Text;
  6.  
  7. [DllImport("winmm.dll")]
  8. extern Int32 mciSendString(String^ lpstrCommand, StringBuilder^ lpstrReturnString,
  9. int uReturnLength, IntPtr hwndCallback);
  10.  
  11. static void DoEvents()
  12. {
  13. Console::SetCursorPosition(0, 6);
  14. Console::Write("Abriendo...");
  15. }
  16.  
  17. static void DoEvents2()
  18. {
  19. Console::SetCursorPosition(0, 6);
  20. Console::Write("Cerrando...");
  21. }
  22.  
  23. int main(array<System::String ^> ^args)
  24. {
  25. StringBuilder^ rt = gcnew StringBuilder(127);
  26.  
  27. // Título de la ventana.
  28. Console::Title = "Consola C++ CLR 2017";
  29.  
  30. // Tamaño ventana consola.
  31. Console::WindowWidth = 29; // X. Ancho.
  32. Console::WindowHeight = 8; // Y. Alto.
  33.  
  34.   // Cursor invisible.
  35. Console::CursorVisible = false;
  36.  
  37. // Posición del mansaje en la ventana.
  38. Console::SetCursorPosition(0, 0);
  39. Console::WriteLine("Control bandeja del lector : \n\n" +
  40. "A - Abrir bandeja. \n" +
  41. "C - Cerrar bandeja. \n" +
  42. "========================== \n");
  43.  
  44. ConsoleKey key;
  45. //Console::CursorVisible = false;
  46. do
  47. {
  48. key = Console::ReadKey(true).Key;
  49.  
  50. String^ mensaje = "";
  51.  
  52. //Asignamos la tecla presionada por el usuario
  53. switch (key)
  54. {
  55. case ConsoleKey::A:
  56. mensaje = "Abriendo...";
  57. Console::SetCursorPosition(0, 6);
  58. DoEvents();
  59. mciSendString("set CDAudio door open", rt, 127, IntPtr::Zero);
  60. mensaje = "Abierto.";
  61. break;
  62.  
  63. case ConsoleKey::C:
  64. mensaje = "Cerrando...";
  65. Console::SetCursorPosition(0, 6);
  66. DoEvents2();
  67. mciSendString("set CDAudio door closed", rt, 127, IntPtr::Zero);
  68. mensaje = "Cerrado.";
  69. break;
  70. }
  71.  
  72. Console::SetCursorPosition(0, 6);
  73. Console::Write("           ");
  74. Console::SetCursorPosition(0, 6);
  75. Console::Write(mensaje);
  76.  
  77. } while (key != ConsoleKey::Escape);
  78. return 0;
  79. }

Formulario C++ CLR .net: (Sólo pongo una imagen, si quieren el código lo subo).

Lo quiero que salga como abajo en formulario pero en Win32. ;)


Para dejarlo más claro.

Para abrir bandeja se usa este código.
Código
  1. mciSendString(L"set cdaudio door open", nullptr, 0, nullptr);

Cerrar bandeja.
Código
  1. mciSendString(L"set cdaudio door closed", nullptr, 0, nullptr);

Dejando claro que el Winmm.lib está cargado en el Visual Studio.

Es todo lo que quiero saber, antes que nada, crear botones y redimensionar formulario como quiera.

Saludos.



Edito:
Lo que he hecho.

De este código que viene predeterminado.
Código
  1.   HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
  2.      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

De los 0 le puse 300 ya que quiero 300 x 300 y no funciona.
Código
  1.   HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
  2.      CW_USEDEFAULT, 300, CW_USEDEFAULT, 300, nullptr, nullptr, hInstance, nullptr);

Tuve que cambiar el orden del CW_USEDEFAULT y 300 como indica abajo y por fin funciona la redimensión.
Código
  1.   HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
  2.      CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, nullptr, nullptr, hInstance, nullptr);

Por fin funciona esa parte.
La otra parte de los botones no.
« Última modificación: 8 Abril 2018, 22:10 pm por Meta » En línea

srWhiteSkull


Desconectado Desconectado

Mensajes: 444



Ver Perfil WWW
Re: ¿Cómo añadir dos botones al formulario?
« Respuesta #19 en: 8 Abril 2018, 22:06 pm »

Si has leído y no has revisado el código y ves normal que una función retorne impidiendo que parte del código repetido no se ejecute, donde se incluye la función de redimensionar y posicionar, entonces no hay mucho que hacer... a lo mejor en otra vida puede que te des cuenta  :xD
En línea

Páginas: 1 [2] 3 Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines