This forum is in archive mode. You will not be able to post new content.

Author Topic: Noob,Problem with Win32Api  (Read 1657 times)

0 Members and 1 Guest are viewing this topic.

Offline Pachelbel

  • /dev/null
  • *
  • Posts: 12
  • Cookies: 0
    • View Profile
Noob,Problem with Win32Api
« on: May 01, 2012, 09:38:43 PM »
Hello I'm Pachelbel, first of all i wanna say that iam a Newb but i wont be crying like many other people that i saw in this posts. I started learning C++, and i wanted to go for Win32 Api.... now there is a problem and i need your help... i was writting this basic Win32 code and when i try to compile it i get this error: ('WindowProcedure' was not declared in this scope) --- line 11. Here is the code:
Code: [Select]
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPSTR lpszCmdParam, int nCmdShow)
{
    HWND hWnd;
    MSG Message;
    WNDCLASS WndClass;
    WndClass.style = CS_HREDRAW | CS_VREDRAW;
    WndClass.lpfnWndProc = WindowProcedure;
    WndClass.cbClsExtra = 0;
    WndClass.cbWndExtra = 0;
    WndClass.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
    WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
    WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    WndClass.hInstance = hInstance;
    WndClass.lpszClassName = "NUESTRA_CLASE";
    WndClass.lpszMenuName = NULL;
    RegisterClass(&WndClass);
    hWnd = CreateWindow(
     "NUESTRA_CLASE",
     "Ventana de Ejemplo",
     WS_OVERLAPPEDWINDOW,
     CW_USEDEFAULT,
     CW_USEDEFAULT,
     320,
     200,
     HWND_DESKTOP,
     NULL,
     hInstance,
     NULL
     );
     ShowWindow(hWnd, SW_SHOWDEFAULT);
     while(TRUE == GetMessage(&Message, 0, 0, 0))
     {
         TranslateMessage(&Message);
         DispatchMessage(&Message);
     }
     return Message.wParam;
}
What should i correct ???. Anyways thanks and sorry for my english, it isnt my mother tonge :P . Win32 API's Tutorials would be really helpfull!
 
 
 
« Last Edit: May 01, 2012, 09:57:42 PM by Kulverstukas »

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: Noob,Problem with Win32Api
« Reply #1 on: May 01, 2012, 10:02:40 PM »
Quote
What should i correct ???

You have to declare WindowProcedure. I don't know where you got this from or what you think WindowProcedure shall do for you. But you are the only one who can tell what this shall be in oder to declare and implement it properly.

Offline Pachelbel

  • /dev/null
  • *
  • Posts: 12
  • Cookies: 0
    • View Profile
Re: Noob,Problem with Win32Api
« Reply #2 on: May 01, 2012, 10:06:46 PM »
So what you are trying to say is that i need to declare it like a prototype under the library????

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: Noob,Problem with Win32Api
« Reply #3 on: May 01, 2012, 10:26:28 PM »

Offline Pachelbel

  • /dev/null
  • *
  • Posts: 12
  • Cookies: 0
    • View Profile
Re: Noob,Problem with Win32Api
« Reply #4 on: May 01, 2012, 10:32:01 PM »
I wasn´t looking at that website, but this will really help... found what i needed , Thank you very much Deque! :)

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.