GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 07-Aug-2005, 20:05
PeteGallo PeteGallo is offline
New Member
 
Join Date: Aug 2005
Posts: 20
PeteGallo is on a distinguished road
Question

please help me with this C code


hi
i do not understand why all the syntax errors.
found antoher post with similar prob. but not exactly.
code
CPP / C++ / C Code:
/*++ BUILD Version: 0002    // Increment this if a change has global effects

Copyright (c) Microsoft Corporation. All rights reserved.

Module Name:

    wincon.h

Abstract:

    This module contains the public data structures, data types,
    and procedures exported by the NT console subsystem.

Created:

    26-Oct-1990

Revision History:

--*/

#ifndef _WINCON_
#define _WINCON_

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _COORD {
    SHORT X;
    SHORT Y;
} COORD, *PCOORD;

typedef struct _SMALL_RECT {
    SHORT Left;
    SHORT Top;
    SHORT Right;
    SHORT Bottom;
} SMALL_RECT, *PSMALL_RECT;

typedef struct _KEY_EVENT_RECORD {
    BOOL bKeyDown;
    WORD wRepeatCount;
    WORD wVirtualKeyCode;
    WORD wVirtualScanCode;
    union {
        WCHAR UnicodeChar;
        CHAR   AsciiChar;
    } uChar;
    DWORD dwControlKeyState;
} KEY_EVENT_RECORD, *PKEY_EVENT_RECORD;

//
// ControlKeyState flags
//

#define RIGHT_ALT_PRESSED     0x0001 // the right alt key is pressed.
#define LEFT_ALT_PRESSED      0x0002 // the left alt key is pressed.
#define RIGHT_CTRL_PRESSED    0x0004 // the right ctrl key is pressed.
#define LEFT_CTRL_PRESSED     0x0008 // the left ctrl key is pressed.
#define SHIFT_PRESSED         0x0010 // the shift key is pressed.
#define NUMLOCK_ON            0x0020 // the numlock light is on.
#define SCROLLLOCK_ON         0x0040 // the scrolllock light is on.
#define CAPSLOCK_ON           0x0080 // the capslock light is on.
#define ENHANCED_KEY          0x0100 // the key is enhanced.
#define NLS_DBCSCHAR          0x00010000 // DBCS for JPN: SBCS/DBCS mode.
#define NLS_ALPHANUMERIC      0x00000000 // DBCS for JPN: Alphanumeric mode.
#define NLS_KATAKANA          0x00020000 // DBCS for JPN: Katakana mode.
#define NLS_HIRAGANA          0x00040000 // DBCS for JPN: Hiragana mode.
#define NLS_ROMAN             0x00400000 // DBCS for JPN: Roman/Noroman mode.
#define NLS_IME_CONVERSION    0x00800000 // DBCS for JPN: IME conversion.
#define NLS_IME_DISABLE       0x20000000 // DBCS for JPN: IME enable/disable.

typedef struct _MOUSE_EVENT_RECORD {
    COORD dwMousePosition;
    DWORD dwButtonState;
    DWORD dwControlKeyState;
    DWORD dwEventFlags;
} MOUSE_EVENT_RECORD, *PMOUSE_EVENT_RECORD;

//
// ButtonState flags
//

#define FROM_LEFT_1ST_BUTTON_PRESSED    0x0001
#define RIGHTMOST_BUTTON_PRESSED        0x0002
#define FROM_LEFT_2ND_BUTTON_PRESSED    0x0004
#define FROM_LEFT_3RD_BUTTON_PRESSED    0x0008
#define FROM_LEFT_4TH_BUTTON_PRESSED    0x0010

//
// EventFlags
//

#define MOUSE_MOVED   0x0001
#define DOUBLE_CLICK  0x0002
#define MOUSE_WHEELED 0x0004

typedef struct _WINDOW_BUFFER_SIZE_RECORD {
    COORD dwSize;
} WINDOW_BUFFER_SIZE_RECORD, *PWINDOW_BUFFER_SIZE_RECORD;

typedef struct _MENU_EVENT_RECORD {
    UINT dwCommandId;
} MENU_EVENT_RECORD, *PMENU_EVENT_RECORD;

typedef struct _FOCUS_EVENT_RECORD {
    BOOL bSetFocus;
} FOCUS_EVENT_RECORD, *PFOCUS_EVENT_RECORD;

typedef struct _INPUT_RECORD {
    WORD EventType;
    union {
        KEY_EVENT_RECORD KeyEvent;
        MOUSE_EVENT_RECORD MouseEvent;
        WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
        MENU_EVENT_RECORD MenuEvent;
        FOCUS_EVENT_RECORD FocusEvent;
    } Event;
} INPUT_RECORD, *PINPUT_RECORD;

//
//  EventType flags:
//

#define KEY_EVENT         0x0001 // Event contains key event record
#define MOUSE_EVENT       0x0002 // Event contains mouse event record
#define WINDOW_BUFFER_SIZE_EVENT 0x0004 // Event contains window change event record
#define MENU_EVENT 0x0008 // Event contains menu event record
#define FOCUS_EVENT 0x0010 // event contains focus change

typedef struct _CHAR_INFO {
    union {
        WCHAR UnicodeChar;
        CHAR   AsciiChar;
    } Char;
    WORD Attributes;
} CHAR_INFO, *PCHAR_INFO;

//
// Attributes flags:
//

#define FOREGROUND_BLUE      0x0001 // text color contains blue.
#define FOREGROUND_GREEN     0x0002 // text color contains green.
#define FOREGROUND_RED       0x0004 // text color contains red.
#define FOREGROUND_INTENSITY 0x0008 // text color is intensified.
#define BACKGROUND_BLUE      0x0010 // background color contains blue.
#define BACKGROUND_GREEN     0x0020 // background color contains green.
#define BACKGROUND_RED       0x0040 // background color contains red.
#define BACKGROUND_INTENSITY 0x0080 // background color is intensified.
#define COMMON_LVB_LEADING_BYTE    0x0100 // Leading Byte of DBCS
#define COMMON_LVB_TRAILING_BYTE   0x0200 // Trailing Byte of DBCS
#define COMMON_LVB_GRID_HORIZONTAL 0x0400 // DBCS: Grid attribute: top horizontal.
#define COMMON_LVB_GRID_LVERTICAL  0x0800 // DBCS: Grid attribute: left vertical.
#define COMMON_LVB_GRID_RVERTICAL  0x1000 // DBCS: Grid attribute: right vertical.
#define COMMON_LVB_REVERSE_VIDEO   0x4000 // DBCS: Reverse fore/back ground attribute.
#define COMMON_LVB_UNDERSCORE      0x8000 // DBCS: Underscore.

#define COMMON_LVB_SBCSDBCS        0x0300 // SBCS or DBCS flag.


typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
    COORD dwSize;
    COORD dwCursorPosition;
    WORD  wAttributes;
    SMALL_RECT srWindow;
    COORD dwMaximumWindowSize;
} CONSOLE_SCREEN_BUFFER_INFO, *PCONSOLE_SCREEN_BUFFER_INFO;

typedef struct _CONSOLE_CURSOR_INFO {
    DWORD  dwSize;
    BOOL   bVisible;
} CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO;

typedef struct _CONSOLE_FONT_INFO {
    DWORD  nFont;
    COORD  dwFontSize;
} CONSOLE_FONT_INFO, *PCONSOLE_FONT_INFO;

#if(_WIN32_WINNT >= 0x0500)
typedef struct _CONSOLE_SELECTION_INFO {
    DWORD dwFlags;
    COORD dwSelectionAnchor;
    SMALL_RECT srSelection;
} CONSOLE_SELECTION_INFO, *PCONSOLE_SELECTION_INFO;

//
// Selection flags
//

#define CONSOLE_NO_SELECTION            0x0000
#define CONSOLE_SELECTION_IN_PROGRESS   0x0001   // selection has begun
#define CONSOLE_SELECTION_NOT_EMPTY     0x0002   // non-null select rectangle
#define CONSOLE_MOUSE_SELECTION         0x0004   // selecting with mouse
#define CONSOLE_MOUSE_DOWN              0x0008   // mouse is down
#endif /* _WIN32_WINNT >= 0x0500 */

//
// typedef for ctrl-c handler routines
//

typedef
BOOL
(WINAPI *PHANDLER_ROUTINE)(
    DWORD CtrlType
    );

#define CTRL_C_EVENT        0
#define CTRL_BREAK_EVENT    1
#define CTRL_CLOSE_EVENT    2
// 3 is reserved!
// 4 is reserved!
#define CTRL_LOGOFF_EVENT   5
#define CTRL_SHUTDOWN_EVENT 6

//
//  Input Mode flags:
//

#define ENABLE_PROCESSED_INPUT 0x0001
#define ENABLE_LINE_INPUT      0x0002
#define ENABLE_ECHO_INPUT      0x0004
#define ENABLE_WINDOW_INPUT    0x0008
#define ENABLE_MOUSE_INPUT     0x0010

//
// Output Mode flags:
//

#define ENABLE_PROCESSED_OUTPUT    0x0001
#define ENABLE_WRAP_AT_EOL_OUTPUT  0x0002

//
// direct API definitions.
//

WINBASEAPI
BOOL
WINAPI
PeekConsoleInputA(
    IN HANDLE hConsoleInput,
    OUT PINPUT_RECORD lpBuffer,
    IN DWORD nLength,
    OUT LPDWORD lpNumberOfEventsRead
    );
WINBASEAPI
BOOL
WINAPI
PeekConsoleInputW(
    IN HANDLE hConsoleInput,
    OUT PINPUT_RECORD lpBuffer,
    IN DWORD nLength,
    OUT LPDWORD lpNumberOfEventsRead
    );
#ifdef UNICODE
#define PeekConsoleInput  PeekConsoleInputW
#else
#define PeekConsoleInput  PeekConsoleInputA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
ReadConsoleInputA(
    IN HANDLE hConsoleInput,
    OUT PINPUT_RECORD lpBuffer,
    IN DWORD nLength,
    OUT LPDWORD lpNumberOfEventsRead
    );
WINBASEAPI
BOOL
WINAPI
ReadConsoleInputW(
    IN HANDLE hConsoleInput,
    OUT PINPUT_RECORD lpBuffer,
    IN DWORD nLength,
    OUT LPDWORD lpNumberOfEventsRead
    );
#ifdef UNICODE
#define ReadConsoleInput  ReadConsoleInputW
#else
#define ReadConsoleInput  ReadConsoleInputA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
WriteConsoleInputA(
    IN HANDLE hConsoleInput,
    IN CONST INPUT_RECORD *lpBuffer,
    IN DWORD nLength,
    OUT LPDWORD lpNumberOfEventsWritten
    );
WINBASEAPI
BOOL
WINAPI
WriteConsoleInputW(
    IN HANDLE hConsoleInput,
    IN CONST INPUT_RECORD *lpBuffer,
    IN DWORD nLength,
    OUT LPDWORD lpNumberOfEventsWritten
    );
#ifdef UNICODE
#define WriteConsoleInput  WriteConsoleInputW
#else
#define WriteConsoleInput  WriteConsoleInputA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
ReadConsoleOutputA(
    IN HANDLE hConsoleOutput,
    OUT PCHAR_INFO lpBuffer,
    IN COORD dwBufferSize,
    IN COORD dwBufferCoord,
    IN OUT PSMALL_RECT lpReadRegion
    );
WINBASEAPI
BOOL
WINAPI
ReadConsoleOutputW(
    IN HANDLE hConsoleOutput,
    OUT PCHAR_INFO lpBuffer,
    IN COORD dwBufferSize,
    IN COORD dwBufferCoord,
    IN OUT PSMALL_RECT lpReadRegion
    );
#ifdef UNICODE
#define ReadConsoleOutput  ReadConsoleOutputW
#else
#define ReadConsoleOutput  ReadConsoleOutputA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
WriteConsoleOutputA(
    IN HANDLE hConsoleOutput,
    IN CONST CHAR_INFO *lpBuffer,
    IN COORD dwBufferSize,
    IN COORD dwBufferCoord,
    IN OUT PSMALL_RECT lpWriteRegion
    );
WINBASEAPI
BOOL
WINAPI
WriteConsoleOutputW(
    IN HANDLE hConsoleOutput,
    IN CONST CHAR_INFO *lpBuffer,
    IN COORD dwBufferSize,
    IN COORD dwBufferCoord,
    IN OUT PSMALL_RECT lpWriteRegion
    );
#ifdef UNICODE
#define WriteConsoleOutput  WriteConsoleOutputW
#else
#define WriteConsoleOutput  WriteConsoleOutputA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
ReadConsoleOutputCharacterA(
    IN HANDLE hConsoleOutput,
    OUT LPSTR lpCharacter,
    IN  DWORD nLength,
    IN COORD dwReadCoord,
    OUT LPDWORD lpNumberOfCharsRead
    );
WINBASEAPI
BOOL
WINAPI
ReadConsoleOutputCharacterW(
    IN HANDLE hConsoleOutput,
    OUT LPWSTR lpCharacter,
    IN  DWORD nLength,
    IN COORD dwReadCoord,
    OUT LPDWORD lpNumberOfCharsRead
    );
#ifdef UNICODE
#define ReadConsoleOutputCharacter  ReadConsoleOutputCharacterW
#else
#define ReadConsoleOutputCharacter  ReadConsoleOutputCharacterA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
ReadConsoleOutputAttribute(
    IN HANDLE hConsoleOutput,
    OUT LPWORD lpAttribute,
    IN DWORD nLength,
    IN COORD dwReadCoord,
    OUT LPDWORD lpNumberOfAttrsRead
    );

WINBASEAPI
BOOL
WINAPI
WriteConsoleOutputCharacterA(
    IN HANDLE hConsoleOutput,
    IN LPCSTR lpCharacter,
    IN DWORD nLength,
    IN COORD dwWriteCoord,
    OUT LPDWORD lpNumberOfCharsWritten
    );
WINBASEAPI
BOOL
WINAPI
WriteConsoleOutputCharacterW(
    IN HANDLE hConsoleOutput,
    IN LPCWSTR lpCharacter,
    IN DWORD nLength,
    IN COORD dwWriteCoord,
    OUT LPDWORD lpNumberOfCharsWritten
    );
#ifdef UNICODE
#define WriteConsoleOutputCharacter  WriteConsoleOutputCharacterW
#else
#define WriteConsoleOutputCharacter  WriteConsoleOutputCharacterA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
WriteConsoleOutputAttribute(
    IN HANDLE hConsoleOutput,
    IN CONST WORD *lpAttribute,
    IN DWORD nLength,
    IN COORD dwWriteCoord,
    OUT LPDWORD lpNumberOfAttrsWritten
    );

WINBASEAPI
BOOL
WINAPI
FillConsoleOutputCharacterA(
    IN HANDLE hConsoleOutput,
    IN CHAR  cCharacter,
    IN DWORD  nLength,
    IN COORD  dwWriteCoord,
    OUT LPDWORD lpNumberOfCharsWritten
    );
WINBASEAPI
BOOL
WINAPI
FillConsoleOutputCharacterW(
    IN HANDLE hConsoleOutput,
    IN WCHAR  cCharacter,
    IN DWORD  nLength,
    IN COORD  dwWriteCoord,
    OUT LPDWORD lpNumberOfCharsWritten
    );
#ifdef UNICODE
#define FillConsoleOutputCharacter  FillConsoleOutputCharacterW
#else
#define FillConsoleOutputCharacter  FillConsoleOutputCharacterA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
FillConsoleOutputAttribute(
    IN HANDLE hConsoleOutput,
    IN WORD   wAttribute,
    IN DWORD  nLength,
    IN COORD  dwWriteCoord,
    OUT LPDWORD lpNumberOfAttrsWritten
    );

WINBASEAPI
BOOL
WINAPI
GetConsoleMode(
    IN HANDLE hConsoleHandle,
    OUT LPDWORD lpMode
    );

WINBASEAPI
BOOL
WINAPI
GetNumberOfConsoleInputEvents(
    IN HANDLE hConsoleInput,
    OUT LPDWORD lpNumberOfEvents
    );

WINBASEAPI
BOOL
WINAPI
GetConsoleScreenBufferInfo(
    IN HANDLE hConsoleOutput,
    OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo
    );

WINBASEAPI
COORD
WINAPI
GetLargestConsoleWindowSize(
    IN HANDLE hConsoleOutput
    );

WINBASEAPI
BOOL
WINAPI
GetConsoleCursorInfo(
    IN HANDLE hConsoleOutput,
    OUT PCONSOLE_CURSOR_INFO lpConsoleCursorInfo
    );

#if(_WIN32_WINNT >= 0x0500)

WINBASEAPI
BOOL
WINAPI
GetCurrentConsoleFont(
    IN HANDLE hConsoleOutput,
    IN BOOL bMaximumWindow,
    OUT PCONSOLE_FONT_INFO lpConsoleCurrentFont
    );

WINBASEAPI
COORD
WINAPI
GetConsoleFontSize(
    IN HANDLE hConsoleOutput,
    IN DWORD nFont
    );

WINBASEAPI
BOOL
WINAPI
GetConsoleSelectionInfo(
    OUT PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo
    );

#endif /* _WIN32_WINNT >= 0x0500 */

WINBASEAPI
BOOL
WINAPI
GetNumberOfConsoleMouseButtons(
    OUT LPDWORD lpNumberOfMouseButtons
    );

WINBASEAPI
BOOL
WINAPI
SetConsoleMode(
    IN HANDLE hConsoleHandle,
    IN DWORD dwMode
    );

WINBASEAPI
BOOL
WINAPI
SetConsoleActiveScreenBuffer(
    IN HANDLE hConsoleOutput
    );

WINBASEAPI
BOOL
WINAPI
FlushConsoleInputBuffer(
    IN HANDLE hConsoleInput
    );

WINBASEAPI
BOOL
WINAPI
SetConsoleScreenBufferSize(
    IN HANDLE hConsoleOutput,
    IN COORD dwSize
    );

WINBASEAPI
BOOL
WINAPI
SetConsoleCursorPosition(
    IN HANDLE hConsoleOutput,
    IN COORD dwCursorPosition
    );

WINBASEAPI
BOOL
WINAPI
SetConsoleCursorInfo(
    IN HANDLE hConsoleOutput,
    IN CONST CONSOLE_CURSOR_INFO *lpConsoleCursorInfo
    );

WINBASEAPI
BOOL
WINAPI
ScrollConsoleScreenBufferA(
    IN HANDLE hConsoleOutput,
    IN CONST SMALL_RECT *lpScrollRectangle,
    IN CONST SMALL_RECT *lpClipRectangle,
    IN COORD dwDestinationOrigin,
    IN CONST CHAR_INFO *lpFill
    );
WINBASEAPI
BOOL
WINAPI
ScrollConsoleScreenBufferW(
    IN HANDLE hConsoleOutput,
    IN CONST SMALL_RECT *lpScrollRectangle,
    IN CONST SMALL_RECT *lpClipRectangle,
    IN COORD dwDestinationOrigin,
    IN CONST CHAR_INFO *lpFill
    );
#ifdef UNICODE
#define ScrollConsoleScreenBuffer  ScrollConsoleScreenBufferW
#else
#define ScrollConsoleScreenBuffer  ScrollConsoleScreenBufferA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
SetConsoleWindowInfo(
    IN HANDLE hConsoleOutput,
    IN BOOL bAbsolute,
    IN CONST SMALL_RECT *lpConsoleWindow
    );

WINBASEAPI
BOOL
WINAPI
SetConsoleTextAttribute(
    IN HANDLE hConsoleOutput,
    IN WORD wAttributes
    );

WINBASEAPI
BOOL
WINAPI
SetConsoleCtrlHandler(
    IN PHANDLER_ROUTINE HandlerRoutine,
    IN BOOL Add
    );

WINBASEAPI
BOOL
WINAPI
GenerateConsoleCtrlEvent(
    IN DWORD dwCtrlEvent,
    IN DWORD dwProcessGroupId
    );

WINBASEAPI
BOOL
WINAPI
AllocConsole( VOID );

WINBASEAPI
BOOL
WINAPI
FreeConsole( VOID );

#if(_WIN32_WINNT >= 0x0500)
WINBASEAPI
BOOL
WINAPI
AttachConsole(
    IN DWORD dwProcessId
    );

#define ATTACH_PARENT_PROCESS ((DWORD)-1)
#endif /* _WIN32_WINNT >= 0x0500 */

WINBASEAPI
DWORD
WINAPI
GetConsoleTitleA(
    OUT LPSTR lpConsoleTitle,
    IN DWORD nSize
    );
WINBASEAPI
DWORD
WINAPI
GetConsoleTitleW(
    OUT LPWSTR lpConsoleTitle,
    IN DWORD nSize
    );
#ifdef UNICODE
#define GetConsoleTitle  GetConsoleTitleW
#else
#define GetConsoleTitle  GetConsoleTitleA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
SetConsoleTitleA(
    IN LPCSTR lpConsoleTitle
    );
WINBASEAPI
BOOL
WINAPI
SetConsoleTitleW(
    IN LPCWSTR lpConsoleTitle
    );
#ifdef UNICODE
#define SetConsoleTitle  SetConsoleTitleW
#else
#define SetConsoleTitle  SetConsoleTitleA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
ReadConsoleA(
    IN HANDLE hConsoleInput,
    OUT LPVOID lpBuffer,
    IN DWORD nNumberOfCharsToRead,
    OUT LPDWORD lpNumberOfCharsRead,
    IN LPVOID lpReserved
    );
WINBASEAPI
BOOL
WINAPI
ReadConsoleW(
    IN HANDLE hConsoleInput,
    OUT LPVOID lpBuffer,
    IN DWORD nNumberOfCharsToRead,
    OUT LPDWORD lpNumberOfCharsRead,
    IN LPVOID lpReserved
    );
#ifdef UNICODE
#define ReadConsole  ReadConsoleW
#else
#define ReadConsole  ReadConsoleA
#endif // !UNICODE

WINBASEAPI
BOOL
WINAPI
WriteConsoleA(
    IN HANDLE hConsoleOutput,
    IN CONST VOID *lpBuffer,
    IN DWORD nNumberOfCharsToWrite,
    OUT LPDWORD lpNumberOfCharsWritten,
    IN LPVOID lpReserved
    );
WINBASEAPI
BOOL
WINAPI
WriteConsoleW(
    IN HANDLE hConsoleOutput,
    IN CONST VOID *lpBuffer,
    IN DWORD nNumberOfCharsToWrite,
    OUT LPDWORD lpNumberOfCharsWritten,
    IN LPVOID lpReserved
    );
#ifdef UNICODE
#define WriteConsole  WriteConsoleW
#else
#define WriteConsole  WriteConsoleA
#endif // !UNICODE

#define CONSOLE_TEXTMODE_BUFFER  1

WINBASEAPI
HANDLE
WINAPI
CreateConsoleScreenBuffer(
    IN DWORD dwDesiredAccess,
    IN DWORD dwShareMode,
    IN CONST SECURITY_ATTRIBUTES *lpSecurityAttributes,
    IN DWORD dwFlags,
    IN LPVOID lpScreenBufferData
    );

WINBASEAPI
UINT
WINAPI
GetConsoleCP( VOID );

WINBASEAPI
BOOL
WINAPI
SetConsoleCP(
    IN UINT wCodePageID
    );

WINBASEAPI
UINT
WINAPI
GetConsoleOutputCP( VOID );

WINBASEAPI
BOOL
WINAPI
SetConsoleOutputCP(
    IN UINT wCodePageID
    );

#if(_WIN32_WINNT >= 0x0500)

#define CONSOLE_FULLSCREEN 1            // fullscreen console
#define CONSOLE_FULLSCREEN_HARDWARE 2   // console owns the hardware

WINBASEAPI
BOOL
APIENTRY
GetConsoleDisplayMode(
    OUT LPDWORD lpModeFlags
    );

WINBASEAPI
HWND
APIENTRY
GetConsoleWindow(
    VOID
    );

#endif /* _WIN32_WINNT >= 0x0500 */

#if(_WIN32_WINNT >= 0x0501)

WINBASEAPI
DWORD
APIENTRY
GetConsoleProcessList(
    OUT LPDWORD lpdwProcessList,
    IN DWORD dwProcessCount);

//
// Aliasing apis.
//

WINBASEAPI
BOOL
APIENTRY
AddConsoleAliasA(
    IN LPSTR Source,
    IN LPSTR Target,
    IN LPSTR ExeName);
WINBASEAPI
BOOL
APIENTRY
AddConsoleAliasW(
    IN LPWSTR Source,
    IN LPWSTR Target,
    IN LPWSTR ExeName);
#ifdef UNICODE
#define AddConsoleAlias  AddConsoleAliasW
#else
#define AddConsoleAlias  AddConsoleAliasA
#endif // !UNICODE

WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasA(
    IN LPSTR Source,
    OUT LPSTR TargetBuffer,
    IN DWORD TargetBufferLength,
    IN LPSTR ExeName);
WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasW(
    IN LPWSTR Source,
    OUT LPWSTR TargetBuffer,
    IN DWORD TargetBufferLength,
    IN LPWSTR ExeName);
#ifdef UNICODE
#define GetConsoleAlias  GetConsoleAliasW
#else
#define GetConsoleAlias  GetConsoleAliasA
#endif // !UNICODE

WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasesLengthA(
    IN LPSTR ExeName);
WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasesLengthW(
    IN LPWSTR ExeName);
#ifdef UNICODE
#define GetConsoleAliasesLength  GetConsoleAliasesLengthW
#else
#define GetConsoleAliasesLength  GetConsoleAliasesLengthA
#endif // !UNICODE

WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasExesLengthA(
    VOID);
WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasExesLengthW(
    VOID);
#ifdef UNICODE
#define GetConsoleAliasExesLength  GetConsoleAliasExesLengthW
#else
#define GetConsoleAliasExesLength  GetConsoleAliasExesLengthA
#endif // !UNICODE

WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasesA(
    OUT LPSTR AliasBuffer,
    IN DWORD AliasBufferLength,
    IN LPSTR ExeName);
WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasesW(
    OUT LPWSTR AliasBuffer,
    IN DWORD AliasBufferLength,
    IN LPWSTR ExeName);
#ifdef UNICODE
#define GetConsoleAliases  GetConsoleAliasesW
#else
#define GetConsoleAliases  GetConsoleAliasesA
#endif // !UNICODE

WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasExesA(
    OUT LPSTR ExeNameBuffer,
    IN DWORD ExeNameBufferLength);
WINBASEAPI
DWORD
APIENTRY
GetConsoleAliasExesW(
    OUT LPWSTR ExeNameBuffer,
    IN DWORD ExeNameBufferLength);
#ifdef UNICODE
#define GetConsoleAliasExes  GetConsoleAliasExesW
#else
#define GetConsoleAliasExes  GetConsoleAliasExesA
#endif // !UNICODE

#endif /* _WIN32_WINNT >= 0x0501 */

#ifdef __cplusplus
}
#endif

#endif // _WINCON_

syntax errors:
Code:
------ Build started: Project: quiksort, Configuration: Debug Win32 ------ Compiling... quiksort.c c:\program files\microsoft platform sdk\include\wincon.h(240) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(246) : error C2085: 'PeekConsoleInputA' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(247) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(264) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(270) : error C2085: 'ReadConsoleInputA' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(271) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(288) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(294) : error C2085: 'WriteConsoleInputA' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(295) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(312) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(319) : error C2085: 'ReadConsoleOutputA' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(320) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(338) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(345) : error C2085: 'WriteConsoleOutputA' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(346) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(364) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(371) : error C2085: 'ReadConsoleOutputCharacterA' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(372) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(390) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(397) : error C2085: 'ReadConsoleOutputAttribute' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(399) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(411) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(418) : error C2085: 'WriteConsoleOutputCharacterW' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(425) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(438) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(445) : error C2085: 'FillConsoleOutputCharacterA' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(446) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(464) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(471) : error C2085: 'FillConsoleOutputAttribute' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(473) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(483) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(487) : error C2085: 'GetNumberOfConsoleInputEvents' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(489) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(499) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(502) : error C2085: 'GetLargestConsoleWindowSize' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(504) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(542) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(545) : error C2085: 'GetNumberOfConsoleMouseButtons' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(547) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(557) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(560) : error C2085: 'SetConsoleActiveScreenBuffer' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(562) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(571) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(575) : error C2085: 'SetConsoleScreenBufferSize' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(577) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(587) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(591) : error C2085: 'SetConsoleCursorInfo' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(593) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(605) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(612) : error C2085: 'ScrollConsoleScreenBufferW' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(619) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(630) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(634) : error C2085: 'SetConsoleTextAttribute' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(636) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(646) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(650) : error C2085: 'GenerateConsoleCtrlEvent' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(652) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(659) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(660) : error C2085: 'FreeConsole' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(673) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(682) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(686) : error C2085: 'GetConsoleTitleW' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(693) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(701) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(704) : error C2085: 'SetConsoleTitleW' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(711) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(723) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(730) : error C2085: 'ReadConsoleW' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(737) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(749) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(756) : error C2085: 'WriteConsoleW' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(765) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(778) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(779) : error C2085: 'GetConsoleCP' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(781) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(790) : error C2054: expected '(' to follow 'WINBASEAPI' c:\program files\microsoft platform sdk\include\wincon.h(791) : error C2085: 'GetConsoleOutputCP' : not in formal parameter list c:\program files\microsoft platform sdk\include\wincon.h(793) : error C2061: syntax error : identifier 'WINBASEAPI' c:\program files\microsoft platform sdk\include\commdlg.h(965) : error C2061: syntax error : identifier 'LPUNKNOWN' c:\program files\microsoft platform sdk\include\commdlg.h(970) : error C2059: syntax error : '}' c:\program files\microsoft platform sdk\include\commdlg.h(991) : error C2061: syntax error : identifier 'LPUNKNOWN' c:\program files\microsoft platform sdk\include\commdlg.h(996) : error C2059: syntax error : '}' c:\program files\microsoft platform sdk\include\commdlg.h(998) : error C2061: syntax error : identifier 'PRINTDLGEX' c:\program files\microsoft platform sdk\include\commdlg.h(998) : error C2059: syntax error : ';' c:\program files\microsoft platform sdk\include\commdlg.h(999) : error C2061: syntax error : identifier 'LPPRINTDLGEX' c:\program files\microsoft platform sdk\include\commdlg.h(999) : error C2059: syntax error : ';' Build log was saved at "file://c:\Documents and Settings\Peter Gallo\My Documents\Visual Studio 2005\Projects\quiksort\quiksort\Debug\BuildLog.htm" quiksort - 86 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

why all this?
Thank You
Pete Gallo
Last edited by admin : 07-Aug-2005 at 21:29. Reason: please insert your example C codes between [c] and [/c] bbcode tags
  #2  
Old 08-Aug-2005, 03:23
maprich maprich is offline
Member
 
Join Date: May 2005
Posts: 163
maprich has a spectacular aura aboutmaprich has a spectacular aura about
From the error list you can see that your compiler doesn't really understand the meaning of "WINBASEAPI" . It is defined in some other windows header file .. maybe in windows.h or somesuch..(sorry busy and no time to search myself) You can try to rearrange the "#include" lines in your program so that "#include <wincon>" is the last include. Also you should probably include the <windows> if you haven't already
  #3  
Old 08-Aug-2005, 09:54
PeteGallo PeteGallo is offline
New Member
 
Join Date: Aug 2005
Posts: 20
PeteGallo is on a distinguished road

<widows> down to 2 warnnings


thanks Maprich your <windows> instead of ""
eliminated 86 errors now down to 2 warnnings.
Code:
Build log was saved at "file://c:\Documents and Settings\Peter Gallo\ My Documents\Visual Studio 2005\Projects\quiksort\quiksort\Debug\BuildLog.htm"

the code
CPP / C++ / C Code:
{
		  printf("CreateEvent returned handle=%08x\n", hEvent);
		  break;
		}
{
		  printf("CreateEvent returned handle=%08x\n", hEvent);
		  break;
		}
any thoughts here?

Thank You
Pete Gallo
Last edited by LuciWiz : 08-Aug-2005 at 10:00. Reason: Please insert your C code between [c] & [/c] tags
  #4  
Old 08-Aug-2005, 10:15
maprich maprich is offline
Member
 
Join Date: May 2005
Posts: 163
maprich has a spectacular aura aboutmaprich has a spectacular aura about
the arrangement of two code blocks is a little wierd. You can of course have code blocks {} for aestetic reasons but it is not recommendable. What was the warning? .. I guess that compiler complains because the break's are without any purpose (since it only breaks out from the surrounding code block). Also get rid of unnecessary { and } Or did you have somekind of a copy-paste error when posting to this forum???

Edit: Looking your code again it simply seems that somewhere there is copy paste error (either in your code or in posting here) and you should just get rid of the second code block and then ... who knows??? Because please show also few previous lines of code. I am in dark here..
  #5  
Old 08-Aug-2005, 17:51
PeteGallo PeteGallo is offline
New Member
 
Join Date: Aug 2005
Posts: 20
PeteGallo is on a distinguished road

link prob. i think?


here i have compiled the entire project
errors:
Code:
------ Rebuild All started: Project: quiksort, Configuration: Debug Win32 ------ Deleting intermediate and output files for project 'quiksort', configuration 'Debug|Win32' Compiling... quiksort.c c:\documents and settings\peter gallo\my documents\visual studio 2005\projects\quiksort\quiksort\quiksort.c(1083) : warning C4313: 'printf' : '%x' in format string conflicts with argument 1 of type 'HANDLE' c:\documents and settings\peter gallo\my documents\visual studio 2005\projects\quiksort\quiksort\quiksort.c(1162) : warning C4313: 'printf' : '%x' in format string conflicts with argument 1 of type 'HANDLE' Compiling manifest to resources... Linking... LINK : fatal error LNK1104: cannot open file 'ntcan.lib' Build log was saved at "file://c:\Documents and Settings\Peter Gallo\My Documents\Visual Studio 2005\Projects\quiksort\quiksort\Debug\BuildLog.htm" quiksort - 1 error(s), 2 warning(s) ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

complete code:
Code:
/************************************************************************** * * * ntcan.h -- NTCAN-API procedure declarations and constant definitions * * * * Copyright (c) 1997-2002, esd gmbh. All rights reserved. * * * **************************************************************************/ #ifndef _ntcan_h_ #define _ntcan_h_ #ifdef __cplusplus extern "C" { #endif #include <windows.h> #if !defined(EXPORT) #define EXPORT __declspec (dllexport) /* Macro to export from DLL */ #endif #if !defined(CALLTYPE) #define CALLTYPE #endif #ifndef UNDER_RTSS # pragma comment(lib,"ntcan.lib") /* Link with NTCAN.LIB (Only for VC++)*/ #endif /*------------------ Defines ------------------------------------------------*/ #define NTCAN_EV_BASE 0x40000000 #define NTCAN_EV_USER 0x40000080 #define NTCAN_EV_LAST 0x400000FF #define NTCAN_EV_CAN_ERROR NTCAN_EV_BASE #define NTCAN_EV_ECHO(NR) 0x40000040 + (NR & 0x1f) /* mode in canOpen() */ #define NTCAN_MODE_OVERLAPPED 0x20000000 /* Open for overlapped operations */ #define NTCAN_MODE_OBJECT 0x10000000 /* Open for Rx object mode */ /* Queue-Size in canOpen() */ #define NTCAN_MAX_TX_QUEUESIZE 2047 #define NTCAN_MAX_RX_QUEUESIZE 2047 #define NTCAN_NO_QUEUE -1 /* Flags in can-ids */ #define NTCAN_20B_BASE 0x20000000 /* Flags in frame-length's */ #define NTCAN_RTR 0x10 #define NTCAN_NO_DATA 0x20 /* No baudrate configured (returned from canGetBaudrate() )*/ #define NTCAN_NO_BAUDRATE 0x7FFFFFFF /*------------------- error-codes--------------------------------------------*/ #define NTCAN_SUCCESS ERROR_SUCCESS #define NTCAN_RX_TIMEOUT 0xE0000001 #define NTCAN_TX_TIMEOUT 0xE0000002 #define NTCAN_TX_ERROR 0xE0000004 #define NTCAN_CONTR_OFF_BUS 0xE0000005 #define NTCAN_CONTR_BUSY 0xE0000006 #define NTCAN_CONTR_WARN 0xE0000007 #define NTCAN_NO_ID_ENABLED 0xE0000009 #define NTCAN_ID_ALREADY_ENABLED 0xE000000A #define NTCAN_ID_NOT_ENABLED 0xE000000B #define NTCAN_INVALID_FIRMWARE 0xE000000D #define NTCAN_MESSAGE_LOST 0xE000000E #define NTCAN_INVALID_HARDWARE 0xE000000F #define NTCAN_PENDING_WRITE 0xE0000010 #define NTCAN_PENDING_READ 0xE0000011 #define NTCAN_INVALID_DRIVER 0xE0000012 /* wrong dll/driver-combination */ #define NTCAN_INVALID_PARAMETER ERROR_INVALID_PARAMETER #define NTCAN_INVALID_HANDLE ERROR_INVALID_HANDLE #define NTCAN_IO_INCOMPLETE ERROR_IO_INCOMPLETE #define NTCAN_IO_PENDING ERROR_IO_PENDING #define NTCAN_NET_NOT_FOUND ERROR_FILE_NOT_FOUND #define NTCAN_INSUFFICIENT_RESOURCES ERROR_NO_SYSTEM_RESOURCES #define NTCAN_OPERATION_ABORTED ERROR_OPERATION_ABORTED #pragma pack(1) typedef struct { long id; /* can-id */ unsigned char len; /* length of message: 0-8 */ unsigned char msg_lost; /* count of lost rx-messages */ unsigned char reserved[2]; /* reserved */ unsigned char data[8]; /* 8 data-bytes */ } CMSG; typedef struct { long evid; /* event-id: possible range:EV_BASE...EV_LAST */ unsigned char len; /* length of message: 0-8 */ unsigned char reserved[3]; /* reserved */ union { unsigned char c[8]; unsigned short s[4]; unsigned long l[2]; } evdata; } EVMSG; typedef struct { unsigned short hardware; unsigned short firmware; unsigned short driver; unsigned short dll; unsigned long boardstatus; unsigned char boardid[14]; unsigned short features; } CAN_IF_STATUS; #pragma pack() /* * Interface/Driver feature flags */ #define NTCAN_FEATURE_FULL_CAN (1<<0) /* Full CAN controller */ #define NTCAN_FEATURE_CAN_20B (1<<1) /* CAN 2.OB support */ #define NTCAN_FEATURE_DEVICE_NET (1<<2) /* Device net adapter */ #define NTCAN_FEATURE_CYCLIC_TX (1<<3) /* Cyclic Tx support */ #define NTCAN_FEATURE_RX_OBJECT_MODE (1<<4) /* Rx object mode support */ /* * IOCTL codes for canIoctl() */ #define NTCAN_IOCTL_FLUSH_RX_FIFO 0x0001 /* Flush Rx FIFO */ #define NTCAN_IOCTL_GET_RX_MSG_COUNT 0x0002 /* Ret # CMSG in Rx FIFO */ #define NTCAN_IOCTL_GET_RX_TIMEOUT 0x0003 /* Ret configured Rx tout */ #define NTCAN_IOCTL_GET_TX_TIMEOUT 0x0004 /* Ret configured Tx tout */ /*...prototypes..............................................................*/ EXPORT DWORD CALLTYPE canSetBaudrate(HANDLE handle, /* nt-handle */ DWORD baud ); /* baudrate-constant */ /*...prototypes..............................................................*/ EXPORT DWORD CALLTYPE canGetBaudrate( /* ret NTCAN_OK, if success */ HANDLE handle, /* nt-handle */ DWORD *baud ); /* baudrate-constant */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canOpen( /* ret NTCAN_OK, if success */ int net, /* net number */ unsigned long flags, /* */ long txqueuesize, /* nr of entries in message queue*/ long rxqueuesize, /* nr of entries in message queue*/ long txtimeout, /* tx-timeout in miliseconds */ long rxtimeout, /* rx-timeout in miliseconds */ HANDLE *handle ); /* out: nt-handle */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canClose( /* ret NTCAN_OK, if success */ HANDLE handle ); /* handle */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canIdAdd( /* ret NTCAN_OK, if success */ HANDLE handle, /* read handle */ long id ); /* can identifier */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canIdRangeAdd( /* ret NTCAN_OK, if success */ HANDLE handle, /* read handle */ long idStart, /* 1st can identifier */ long idEnd ); /* last can identifier */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canIdDelete( /* ret NTCAN_OK, if success */ HANDLE handle, /* read handle */ long id ); /* can identifier */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canIdRangeDelete( /* ret 0, if success */ HANDLE handle, /* read handle */ long idStart, /* 1st can identifier */ long idEnd ); /* last can identifier */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canGetOverlappedResult( /* ret NTCAN_OK, if success */ HANDLE handle, /* handle */ OVERLAPPED *ovrlppd, /* overlapped-structure */ long *len, /* out: cnt of available CMSG-Buffer*/ BOOL bWait ); /* FALSE =>do not wait, else wait */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canTake( /* ret 0, if success */ HANDLE handle, /* handle */ CMSG *cmsg, /* ptr to data-buffer */ long *len ); /* out: size of CMSG-Buffer */ /* in: count of read messages */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canRead( /* ret 0, if success */ HANDLE handle, /* handle */ CMSG *cmsg, /* ptr to data-buffer */ long *len, /* out: size of CMSG-Buffer */ /* in: count of read messages */ OVERLAPPED *ovrlppd); /* NULL or overlapped-structure */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canSend( /* ret 0, if success */ HANDLE handle, /* handle */ CMSG *cmsg, /* ptr to data-buffer */ long *len ); /* size of CMSG-Buffer */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canWrite( /* ret 0, if success */ HANDLE handle, /* handle */ CMSG *cmsg, /* ptr to data-buffer */ long *len, /* size of CMSG-Buffer */ OVERLAPPED *ovrlppd); /* NULL or overlapped-structure */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canReadEvent( HANDLE handle, /* handle */ EVMSG *evmsg, /* ptr to event-msg-buffer */ OVERLAPPED *ovrlppd); /* NULL or overlapped-structure */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canSendEvent( HANDLE handle, /* handle */ EVMSG *evmsg ); /* ptr to event-msg-buffer */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canStatus( HANDLE handle, /* handle */ CAN_IF_STATUS *cstat ); /* ptr to can-status-buffer */ /*...........................................................................*/ EXPORT DWORD CALLTYPE canIoctl( HANDLE handle, /* handle */ unsigned long ulCmd, /* Command */ void * pArg ); /* Ptr to command specific argument */ #ifdef __cplusplus } #endif #endif /* _ntcan_h_ */
i think i have a link prob. with the #include "ntcan.h"
which causes a prob. with "ntcan.lib" i am not sure
if you think so how should i link?
i am useing VS C++ 2005 beta 2.

thank You
Pete Gallo
Last edited by PeteGallo : 08-Aug-2005 at 17:57. Reason: change [quote] to [source]
  #6  
Old 08-Aug-2005, 20:13
maprich maprich is offline
Member
 
Join Date: May 2005
Posts: 163
maprich has a spectacular aura aboutmaprich has a spectacular aura about
Maybe you can write:
CPP / C++ / C Code:
printf("CreateEvent returned handle=%08x\n", (int)hEvent);
to get rid of the warnings

The linking error is more serious one. The linker expects to find the file "ntcan.lib" from the lib directory under the compilers root directory. So ensure that you A) do have the file and B) it's in the right place. And I assume that you really need the "ntcan.h" for your program to function, do you? because otherwise you had already got rid of the include, right?

[edit] The following can be ignored since actually your code has the line that Evil Requiem in the following message mentions[/edit]
You also need to add to your project options a mention to the linker to load ntcan... I got the impression that you use Microsoft, I use dev-c++ so i cannot be more specific about how you should make the setting. In my system I would put a line like "-lntcan" to my linker options. For microsoft tools you better look from MSDN reference or just from some example projects that I am sure comes shipped with your IDE.
Last edited by maprich : 08-Aug-2005 at 20:50.
  #7  
Old 08-Aug-2005, 20:23
Evil Requiem Evil Requiem is offline
New Member
 
Join Date: Aug 2005
Posts: 24
Evil Requiem will become famous soon enough
For a microsoft IDE, you can use the following command:
CPP / C++ / C Code:
#pragma comment(lib, "libname.lib"
  #8  
Old 08-Aug-2005, 20:30
maprich maprich is offline
Member
 
Join Date: May 2005
Posts: 163
maprich has a spectacular aura aboutmaprich has a spectacular aura about
btw there is a separate MS Visual C++ specific GIDForum

and that makes this current forum general or/and more-standard
or/and non-microsoft specific forum.

You got your answer here, at least to some degree I hope.
But in future you may be able to get better help in less time if you ask in the proper forum
 
 

Recent GIDBlogPlanned Network Maintenance on 2013-05-29 by gidnetwork

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Guidelines for posting requests for help - UPDATED! WaltP C++ Forum 1 04-Jun-2011 17:11
Re: Formatting C / C++ code WaltP C Programming Language 1 06-Jan-2008 23:59
Problem with int mixed with char,... leitz C++ Forum 17 07-Dec-2004 20:56
Help! Some basal questions about MFC xutingnjupt MS Visual C++ / MFC Forum 1 05-Dec-2004 03:38

Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 03:05.


vBulletin, Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.