Link to home
Start Free TrialLog in
Avatar of mythgops
mythgops

asked on

kbhit( ) problem

friends:
theres problem with kbhit() function. my program takes input from user (from keyboard) and specifies which button he has pressed...but due to the getch the program terminates if any key is pressed..the message i get later is that there was an illegal operation and hence terminated.
can someguys help me out..
Mithun
Avatar of Member_2_1001466
Member_2_1001466

Can you please post some lines of code and the exact error messages.
Avatar of mythgops

ASKER


friends & experts:
 
can anyone tell me which all libraries do i need to work on windows programming..i came to know that c++ has no GUI facility..so i have to go thru the win32 api tutorials..
i have just downloaded <windows.h> and <commdlg.h> header files...so do i need to download more header files for win32 api to work on my turbo c++?
friends & experts & Steh:

i wrote the following code:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
    return 0;
}

i got the error message as:
type mismatch in redeclaration in pascal winmain..parameter hinstance..hprevinsatnce..lpcmdline is never used
hope u could help

Mithun
ASKER CERTIFIED SOLUTION
Avatar of Member_2_1001466
Member_2_1001466

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try changing the calling convention to PASCAL.

#include <windows.h>

int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
WINAPI should translate into PASCAL if available. VC++6 and later don't support PASCAL but WINAPI is changing linking options to achieve the same in those cases. So I would suggest to leave WINAPI as it is but try to see how WINAPI is defined in your case (do you hae the correct header file in your include search path?).
Avatar of Axter
If you're creating a WIN32 console application, you don't need <windows.h>

If you're trying to convert a program for Turbo C++ to VC++, the best thing to do is trying making a WIN32 console application.
It shouldn't require that much modifications.

Exactly what type of application are you trying to build, and what compiler are you using?
am using turboc++ complier..need to start making games..
for that i need a response from key board..which unfortunately is not happening..some required header files seems to be missing.