Ir a contenido

PURCHASE MEMBERSHIP AT A 25% DISCOUNT Apply here

GET 1 MONTH OF MEMBERSHIP BY CHOOSING THE NEW NAME OF OUR COMPANY! Apply here


Photo

Duda c++ con win32 api


      
Duda c++ con win32 api TvOTohoDuda c++ con win32 api TvOToho
Duda c++ con win32 api

CrazyFrog98
#1

CrazyFrog98
  • CrazyFrog98
  • member
  • Mensajes :
    27
  • Reputación :
    2
  • Points :
    0
  • Registrado :
    2012-08-10
Buenas, alguno a utilizado la api de win32 en c++ antes?
Porque da problemas de inclusión
:Y_Y:

Kirby_Blue
#2

Kirby_Blue
  • Kirby_Blue
  • super moderator
  • Mensajes :
    1056
  • Reputación :
    87
  • Points :
    0
  • Registrado :
    2012-08-08
Acción aplicada: Moved!

Motivo: Esto no va aquí! (HS4L Team :: Dudas, Preguntas y Sugeréncias -> Programación / Hacking :: Dudas, Preguntas y Sugeréncias)

ZzcarloszZ
#3

ZzcarloszZ
  • ZzcarloszZ
  • administrator
  • Mensajes :
    625
  • Reputación :
    220
  • Points :
    6
  • Registrado :
    2012-08-08
Prueba incluyendo las librerías en el Stadaft.h smid_4

CrazyFrog98
#4

CrazyFrog98
  • CrazyFrog98
  • member
  • Mensajes :
    27
  • Reputación :
    2
  • Points :
    0
  • Registrado :
    2012-08-10
Dudo enormemente que el error esté en las librerías, pues hice una versión en la que incluía el código en la form y aun así me daba errores.(Y no precisamente de libs)

Aquí el código:

Code:
#include <windows.h>
#include <iostream>
#include <string>
#include <psapi.h>
#include <sstream>
#pragma comment(lib, "psapi")
using namespace std;
float CharToInt(char* value) {
   stringstream str;
   str << value;
   float x;
   str >> x;
   return x;
}

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

static char *title = TEXT("Check Box");

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
   LPSTR lpCmdLine, int nCmdShow)
{
   MSG  msg;
   WNDCLASS wc = { 0 };
   wc.lpszClassName = TEXT("Check Box");
   wc.hInstance = hInstance;
   wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
   wc.lpfnWndProc = WndProc;
   wc.hCursor = LoadCursor(0, IDC_ARROW);


   RegisterClass(&wc);
   CreateWindow(wc.lpszClassName, title,
      WS_OVERLAPPEDWINDOW | WS_VISIBLE,
      150, 150, 230, 150, 0, 0, hInstance, 0);

   while (GetMessage(&msg, NULL, 0, 0)) {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
   }
   return (int)msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

   switch (msg)
   {
   case WM_CREATE:
   {
      CreateWindow(TEXT("button"), TEXT("Show Title"),
         WS_VISIBLE | WS_CHILD | BS_CHECKBOX,
         20, 20, 185, 35,
         hwnd, (HMENU)1, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
      CheckDlgButton(hwnd, 1, BST_CHECKED);
      break;
   }

   case WM_COMMAND:
   {
      BOOL checked = IsDlgButtonChecked(hwnd, 1);
      if (checked) {
         CheckDlgButton(hwnd, 1, BST_UNCHECKED);
         SetWindowText(hwnd, TEXT(""));
         //Code Should be here like action();
      }
      else {
         CheckDlgButton(hwnd, 1, BST_CHECKED);
         SetWindowText(hwnd, title);
         //and here like anotheraction();
      }
      break;
   }

   case WM_DESTROY:
   {
      PostQuitMessage(0);
      break;
   }
   }
   return DefWindowProc(hwnd, msg, wParam, lParam);
}




errores: https://i.gyazo.com/168a1f19c97cd5f53d36d2ec069568ef.png


De todas formas sigo googleando, a ver si encuentro la solución.. creo que incluso podría beneficiar a la comunidad si hago un tuto :super:

CrazyFrog98
#5

CrazyFrog98
  • CrazyFrog98
  • member
  • Mensajes :
    27
  • Reputación :
    2
  • Points :
    0
  • Registrado :
    2012-08-10
Acabo de comprobar que el problema era que lo había duplicado en otro cpp que estaba vinculado(aun) después de eliminarlo del proyecto.

Aun investigando como poner el código en otro archivo*

CrazyFrog98
#6

CrazyFrog98
  • CrazyFrog98
  • member
  • Mensajes :
    27
  • Reputación :
    2
  • Points :
    0
  • Registrado :
    2012-08-10
Arreglado, por favor cerrad

Sponsored content
#7

Sponsored content

      

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in
You cannot reply to topics in this forum
Staff online
Sponsors
  •  TOTAL POSTS
  •  TOTAL MEMBERS
  •  NEWEST MEMBER