Board index » cppbuilder » difficulty with macros in Borland C++ 5.02

difficulty with macros in Borland C++ 5.02


2003-09-06 01:23:07 AM
cppbuilder39
I am having difficulty translating code from VC++ to Borland recieving
various error in standard header files.
DWORD_PTR ve_valueptr; line 107
is the line located in WINDDK\2600\INC\WXP\winreg.h
the error message is:
Error: winreg.h(107,26):Type name expected
Error: winreg.h(107,26):Declaration missing ;
As this is a standard header file in the DDK I don't want to begin editing
it. I have included windows.h so the macros should be understood, however,
no luck so far. DWORD is accepted but not DWORD_PTR there are multiple other
errors such as:
Error: winreg.h(145,12):'HKEY' cannot start a parameter declaration
found on the following lines
WINADVAPI
LONG
APIENTRY
RegCloseKey (
IN HKEY hKey
);
so I assume it is just a macro not understood in the borland enviornment but
do not wish to redeclare all macro's again...if it really is a macro issue
as now I'm a little unsure.
I don't explicitly include winreg.h it is implicitly included in another
header header file that I have not been able to track down.
Thank you for any assistance
Trevor Arsenault
 
 

Re:difficulty with macros in Borland C++ 5.02

You are using a 1997 compiler. You should expect that things will have
changed over the 6 years period since your compiler was new.
As expanded for Win32 programs using the header files on my machine, those
from C++ Builder 6. The only include I used in the program whose
preprocessing found these things was WINDEF.H. (I could have used WINDOWS.H
which includes WINDEF.H)
From BASETSD.H
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
HKEY is defined in WINNT.H by
DECLARE_HANDLE(HKEY);
and DECLARE_HANDLE comes about from these lines in WINNT.H but I have added
a backslash continuation character to defend against news reader word
wrapping.
#ifdef STRICT
typedef void *HANDLE;
#define DECLARE_HANDLE(name) \
struct name##__ { int unused; }; typedef struct name##__ *name
#else
typedef PVOID HANDLE;
#define DECLARE_HANDLE(name) typedef HANDLE name
#endif
typedef HANDLE *PHANDLE;
. Ed
Quote
trevor Arsenault wrote in message
news: XXXX@XXXXX.COM ...
I am having difficulty translating code from VC++ to Borland recieving
various error in standard header files.

DWORD_PTR ve_valueptr; line 107
is the line located in WINDDK\2600\INC\WXP\winreg.h
the error message is:
Error: winreg.h(107,26):Type name expected
Error: winreg.h(107,26):Declaration missing ;
As this is a standard header file in the DDK I don't want to begin editing
it. I have included windows.h so the macros should be understood, however,
no luck so far. DWORD is accepted but not DWORD_PTR there are multiple
other
errors such as:
Error: winreg.h(145,12):'HKEY' cannot start a parameter declaration
found on the following lines

WINADVAPI
LONG
APIENTRY
RegCloseKey (
IN HKEY hKey
);

so I assume it is just a macro not understood in the borland enviornment
but
do not wish to redeclare all macro's again...if it really is a macro issue
as now I'm a little unsure.

I don't explicitly include winreg.h it is implicitly included in another
header header file that I have not been able to track down.

Thank you for any assistance
Trevor Arsenault


 

Re:difficulty with macros in Borland C++ 5.02

I realize the compiler is old but I'm working on an assignment in an
education institution so I don't have a choice regarding what I use. I may
have misled you into believing that I am quite knowledgeable regarding Win32
programs...I am just a begginer programmer though and most of your comments
are above my knowledge level.
I included "basetsd.h" into the winreg.h and that cleared up the problem
with the type name expected as DWORD_PTR is declared in "basetsd.h" just
like you said. I'm a little unclear regarding the HKEY though as the error
is
Error: winreg.h(146,12):'HKEY' cannot start a parameter declaration
so is that a problem with the definition of HKEY or the macro IN before it?
Am I missing a path to a lib file that has the full definition of the afore
mentioned usage of HKEY? I tried including winnt.h as well but with no
results should I redefine HKEY and all of it's included macro's or is there
a simpler solution?
if it would be easier to figure out what I'm doing I can send all of the
source files in a zipped packege.
thanks in advance
Trevor
"Ed Mulroy [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
You are using a 1997 compiler. You should expect that things will have
changed over the 6 years period since your compiler was new.

As expanded for Win32 programs using the header files on my machine, those
from C++ Builder 6. The only include I used in the program whose
preprocessing found these things was WINDEF.H. (I could have used
WINDOWS.H
which includes WINDEF.H)

From BASETSD.H

typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;

HKEY is defined in WINNT.H by

DECLARE_HANDLE(HKEY);

and DECLARE_HANDLE comes about from these lines in WINNT.H but I have
added
a backslash continuation character to defend against news reader word
wrapping.

#ifdef STRICT
typedef void *HANDLE;
#define DECLARE_HANDLE(name) \
struct name##__ { int unused; }; typedef struct name##__ *name
#else
typedef PVOID HANDLE;
#define DECLARE_HANDLE(name) typedef HANDLE name
#endif
typedef HANDLE *PHANDLE;

. Ed

>trevor Arsenault wrote in message
>news: XXXX@XXXXX.COM ...
>I am having difficulty translating code from VC++ to Borland recieving
>various error in standard header files.
>
>DWORD_PTR ve_valueptr; line 107
>is the line located in WINDDK\2600\INC\WXP\winreg.h
>the error message is:
>Error: winreg.h(107,26):Type name expected
>Error: winreg.h(107,26):Declaration missing ;
>As this is a standard header file in the DDK I don't want to begin
editing
>it. I have included windows.h so the macros should be understood,
however,
>no luck so far. DWORD is accepted but not DWORD_PTR there are multiple
other
>errors such as:
>Error: winreg.h(145,12):'HKEY' cannot start a parameter declaration
>found on the following lines
>
>WINADVAPI
>LONG
>APIENTRY
>RegCloseKey (
>IN HKEY hKey
>);
>
>so I assume it is just a macro not understood in the borland enviornment
but
>do not wish to redeclare all macro's again...if it really is a macro
issue
>as now I'm a little unsure.
>
>I don't explicitly include winreg.h it is implicitly included in another
>header header file that I have not been able to track down.
>
>Thank you for any assistance
>Trevor Arsenault
>
>


 

{smallsort}

Re:difficulty with macros in Borland C++ 5.02

trevor Arsenault wrote:
Quote
I realize the compiler is old but I'm working on an assignment in an
education institution so I don't have a choice regarding what I use. I may
have misled you into believing that I am quite knowledgeable regarding Win32
programs...I am just a begginer programmer though and most of your comments
are above my knowledge level.
Are you trying to use the headers supplied by Microsoft (in their
DDK)? Don't. They are designed for MS compilers. Use the Borland
headers supplied with the compiler, and which work with the compiler
with which they are distributed.
Just do this
#include <windows.h>
and all should be fine.
Only add more includes when needed by your own code.
For now, only add includes when the compiler complains that it doesn't
know what your own code is doing.
<windows.h>pulls in 95% of the available windows code, so for a
while, it should be plenty.
 

Re:difficulty with macros in Borland C++ 5.02

Go with what Mr Gonder said.
Please do NOT send your source files in a zip. In spite of what it might
seem, this newsgroup offers peer-to-peer assistance. Those who reply to you
are fellow developers on their own time. They typically do not have the
time to debug your program other than by dealing with individualized
problems in newsgroup messages.
. Ed
Quote
trevor Arsenault wrote in message
news:3f58dea9$ XXXX@XXXXX.COM ...
 

Re:difficulty with macros in Borland C++ 5.02

thank you for your attempts at helping. Mr.Gonder's advice was somewhat
useful albeit too simplistic as the DDK did distribute tools for use with
other compilers. Borland'sWindows.h was found severly lacking regarding
macro's needed to establish communication with HID devices.I understand that
no one has the time to view my source and they probally wouldn't understand
what I'm trying to accomplish anyways.
I have decided to invest in a newer compiler and will not be disturbing this
board with further questions.
Trevor
"Ed Mulroy [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
Go with what Mr Gonder said.

Please do NOT send your source files in a zip. In spite of what it might
seem, this newsgroup offers peer-to-peer assistance. Those who reply to
you
are fellow developers on their own time. They typically do not have the
time to debug your program other than by dealing with individualized
problems in newsgroup messages.

. Ed

>trevor Arsenault wrote in message
>news:3f58dea9$ XXXX@XXXXX.COM ...


 

Re:difficulty with macros in Borland C++ 5.02

trevor Arsenault wrote:
Quote
other compilers. Borland'sWindows.h was found severly lacking regarding
macro's needed to establish communication with HID devices.I understand that
Oh, HIDs, kinda complicated for a new programmer IMHO.
There was someone back around 5/2001 getting HIDs to work and another
in 11/2001 about linking the hid.dll
Those were in the old .cppbuilder.winapi group. So they would have
been using Builder 4 or 5.
 

Re:difficulty with macros in Borland C++ 5.02

no worries Bob. I may have been a little deceptive in stating that
I'm a begginer programmer I just want the responses as simplistic as
possible.
As stated before I already have a working version of my code in VC++,
however,
the conversion to Borland 5.02 has not gone smoothly. It is my supervisors
request that I use
Borland 5.02 for my assignment but I will appeal to him regarding the use of
a newer compiler.
As Ed pointed out this compiler is dated and is missing many of the headers
required for my project.
I am curious as how to view older newsgroup messages as my news viewer only
displays back to Aug 7 2003.
Is there an archive group I can subscribe to?As this is no longer a question
for this group feel free to email me privately
to prevent unessecary spam in this message board.
Thanks for all your help.
Trevor
"Bob Gonder" < XXXX@XXXXX.COM >wrote in message
Quote
trevor Arsenault wrote:

>other compilers. Borland'sWindows.h was found severly lacking regarding
>macro's needed to establish communication with HID devices.I understand
that

Oh, HIDs, kinda complicated for a new programmer IMHO.
There was someone back around 5/2001 getting HIDs to work and another
in 11/2001 about linking the hid.dll
Those were in the old .cppbuilder.winapi group. So they would have
been using Builder 4 or 5.



 

Re:difficulty with macros in Borland C++ 5.02

trevor Arsenault wrote:
Quote
I am curious as how to view older newsgroup messages as my news viewer only
displays back to Aug 7 2003.
It helps to have been reading and keeping messages for that long <G>
Quote
Is there an archive group I can subscribe to?As this is no longer a question
Google has many groups archived.
Go to Google and search for "cppbuilder.winapi" and HID
Or just Borland and HID.
You'll probably get hundreds of hits on hide and hidden too.
NTHID might narrow it down, perhaps too much.
 

Re:difficulty with macros in Borland C++ 5.02

trevor Arsenault wrote:
Quote
no worries Bob. I may have been a little deceptive in stating that
I'm a begginer programmer I just want the responses as simplistic as
possible.
As stated before I already have a working version of my code in VC++,
however,
the conversion to Borland 5.02 has not gone smoothly. It is my supervisors
request that I use
Borland 5.02 for my assignment but I will appeal to him regarding the use of
a newer compiler.
Hello,
You may try to use the free compiler Borland C++ 5.5 which is available
for download from Borland's site.
It is in fact the compiler from C++ Builder 5, but command-line only,
no IDE. If you need IDE, look here for possible solutions:
www.sirma.bg/Jogy/bcc55.html
--
Jogy
www.jogy.net/
XXXX@XXXXX.COM