|
Posted by eskomk on June 4, 2008, 7:02 am
Please log in for more thread options
Hi,
How can I solve this problem:
MS VisualStudio C++ thinks that CreateWindow is a macro and tries to
expand it.
It seems that this is a well-known problem, however I have not found
any applicable solution.
-Esko
|
|
Posted by Maxim S. Shatskih on June 4, 2008, 7:09 am
Please log in for more thread options
Correct, this is a macro defined to CreateWindowA or CreateWindowW
Why is this bad?
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
> Hi,
>
> How can I solve this problem:
> MS VisualStudio C++ thinks that CreateWindow is a macro and tries to
> expand it.
>
> It seems that this is a well-known problem, however I have not found
> any applicable solution.
>
> -Esko
|
|
Posted by eskomk on June 5, 2008, 7:24 am
Please log in for more thread options > Correct, this is a macro defined to CreateWindowA or CreateWindowW
>
> Why is this bad?
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> ma...@storagecraft.comhttp://www.storagecraft.com
>
>
>
> > Hi,
>
> > How can I solve this problem:
> > MS VisualStudio C++ thinks that CreateWindow is a macro and tries to
> > expand it.
>
> > It seems that this is a well-known problem, however I have not found
> > any applicable solution.
>
> > -Esko
This clip from
http://www.wincor-nixdorf.com/internet/cae/servlet/contentblob/70232/publicationFile/6402/Opos16readme_download.pdf explains it better than I can:
CLIP1 -->
Remark 2: For the OPOS line display class, it is necessary
to rename the methods:
DestroyWindow -> xDestroyWindow
CreateWindow -> xCreateWindow
in the wrapper class (*.h and *.cpp file). Also,
the access to these methods in the application
should be done with these names. Otherwise the
C++ - compiler will generate many syntax errors
like
"Create Window: illegal number of arguments in
CreateWindowA"
The reason is a "misunderstanding" between the
Class Wizard and the MSVC system headers. In the
system headers the name CreateWindow and
DestroyWindow are used as macro definitions
and they are mapped to DestroyWindowA and
CreateWindowA in the ANSI version. Microsoft uses
this macro-replacing -mechanism to allow ANSI
and UNICODE compiling. However, if you have C++
classes with a method using a "reserved"
word the compiler will generate errors.
In general: you should not use method names
which are already used in the Window API. This is
not a restriction of the language C++ but of the
MSVC compiler.
CLIP1 <--
It is not only when creating with wizard, if you try and modify the
sources to be "CreateWindow", not (e.eg) "xCreateWindow", error
messages follows.
Now I had #undef:ed CreateWindow, but it still gives me error
error C2059: syntax error : 'constant'
on a header file which the compiler generates, on the last line of
this clip:
CLIP2 -->
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
CreateWindow(
LONG LViewportRow,
LONG LViewportColumn,
LONG LViewportHeight,
LONG LViewportWidth,
LONG LWindowHeight,
LONG LWindowWidth) = 0;
CLIP2 <--
-Esko
|
|
Posted by cod on June 5, 2008, 3:55 pm
Please log in for more thread options Do you work with MSVC++ 6.0 or a major release of VC? and also.. why
you don't create a class for your driver? This can help the compiler
to solve correctly the resolution of names... from local scope to
global scope...
cod
|
|
Posted by eskomk on June 6, 2008, 3:54 am
Please log in for more thread options > Do you work with MSVC++ 6.0 or a major release of VC? and also.. why
> you don't create a class for your driver? This can help the compiler
> to solve correctly the resolution of names... from local scope to
> global scope...
>
> cod
Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1
It is already a class (I think, I am not comfortably accustomed to COM
objects), here is how CreateWindow is implemented in my
LineDisplay01.cpp:
CLIP LineDisplay01.cpp -->
STDMETHODIMP CLineDisplay01::CreateWindow0(LONG LViewportRow, LONG
LViewportColumn, LONG LViewportHeight, LONG LViewportWidth, LONG
LWindowHeight, LONG LWindowWidth)
{
// TODO: Add your implementation code here
// return S_OK;
return OPOS_E_ILLEGAL;
}
CLIP LineDisplay01.cpp <--
The CLineDisplay01 class is defined in respective .h file
(LineDisplay01.h), where there is defined
a public member function:
CLIP LineDisplay01.h -->
STDMETHOD(CreateWindow0)(LONG LViewportRow, LONG LViewportColumn, LONG
LViewportHeight, LONG LViewportWidth, LONG LWindowHeight, LONG
LWindowWidth);
CLIP LineDisplay01.h <--
And here's a line from .idl file
CLIP .idl -->
[id(15), helpstring("method CreateWindow0")] HRESULT
CreateWindow0(LONG LViewportRow, LONG LViewportColumn, LONG
LViewportHeight, LONG LViewportWidth, LONG LWindowHeight, LONG
LWindowWidth);
CLIP .idl <--
> from local scope to
> global scope
Should I try to put this driver (LineDisplay01.*) things to a new
namespace (e.g. oposlinedisplay) ?
-Esko
|
| Similar Threads | Posted | | OPOS for Casio QT-6060D LineDisplay | August 8, 2007, 3:12 pm |
| TM-T88III OPOS Font problem | January 9, 2006, 3:27 pm |
| Epson T88II OPOS Problem | December 20, 2006, 12:25 pm |
| Problem installing EPSON OPOS drivers | January 5, 2006, 6:56 am |
| Opos setu problem Epson TM88IV | June 26, 2007, 6:30 am |
| OPOS Problem to read codes Magellan 8100 | November 3, 2008, 10:46 am |
| OPOS | June 8, 2008, 3:13 pm |
| USB or OPOS | December 18, 2008, 10:44 pm |
| OPOS Driver | October 3, 2005, 9:48 am |
| OPOS VERSION | December 17, 2005, 10:17 pm |
|
|