AllScreen

  • Thread starter Thread starter jainharsh
  • Start date Start date
J

jainharsh

Hi Guyz,

I am trying to get the number of screens and its resolution in windows.

When I do this...

Screen [] screens = Screen.AllScreens;
upperBound = screens.GetUpperBound(0);
I get this error:

error C2059: syntax error : ']'
error C2065: 'Screen' : undeclared identifier
error C2065: 'screens' : undeclared identifier
error C2228: left of '.GetUpperBound' must have class/struct/union type

Any help would be appreciated...
Thanks,
Harsh
 
Hi
This is the part of my code...

..... Code.....
....
....
#ifdef SIMWIN
using System.Windows.Forms;
#endif

void screeninfo(void)
{

int num_screens;
int i = 0;
int j = 0;
int cord=0;
int width,height;
char pstr[10];
Symbol *s;

#ifdef DEBUG
printf ("screeninfo\n");
#endif

#ifndef SIMWIN
...........Code for Unix
#else

int upperBound;
Screen [] screens = Screen.AllScreens;
upperBound = screens.GetUpperBound(0);
s = (Symbol *) emalloc(sizeof(Symbol));
s->type = ARRAY;
SetArrayClass(s);
s->memory_size = 1;
s->u.sym = (Symbol **)ecalloc(1, sizeof(Symbol *));
j = num_screens;

#endif

s->num_elements =j;
PushSymbol(s);
}


and I am getting this error now:

c:\harshwork\com\src\simmacro\code.c(9572): error C2059: syntax error :
'.'
c:\harshwork\com\src\simmacro\code.c(9572): error C2143: syntax error :
missing ';' before '.'
c:\harshwork\com\src\simmacro\code.c(9572): error C2873: 'System' :
symbol cannot be used in a using-declaration
c:\harshwork\com\src\simmacro\code.c(9641): error C2059: syntax error :
']'
c:\harshwork\com\src\simmacro\code.c(9641): error C2065: 'Screen' :
undeclared identifier
c:\harshwork\com\src\simmacro\code.c(9642): error C2065: 'screens' :
undeclared identifier
c:\harshwork\com\src\simmacro\code.c(9642): error C2228: left of
'.GetUpperBound' must have class/struct/union type
type is ''unknown-type''

am i doing something wrong?




Jakob said:
Did you create a reference to System.Windows.Forms and put a using statement
at the top:

using System.Windows.Forms;

HTH, Jakob.

--
http://www.dotninjas.dk


jainharsh said:
Hi Guyz,

I am trying to get the number of screens and its resolution in windows.

When I do this...

Screen [] screens = Screen.AllScreens;
upperBound = screens.GetUpperBound(0);
I get this error:

error C2059: syntax error : ']'
error C2065: 'Screen' : undeclared identifier
error C2065: 'screens' : undeclared identifier
error C2228: left of '.GetUpperBound' must have class/struct/union type

Any help would be appreciated...
Thanks,
Harsh
 
What language is this??
Is this Managed C++ 1.0? (as opposed to ManagedC++ 2.0) I don't know it's
syntax well, so I could only guess.
But I would bet that

"using System.Windows.Forms;" is wrong, it should (probably be) "using
namespace System::Windows::Forms;"
" Screen [] screens = Screen.AllScreens;" is wrong, it should probably be "
array<Screen*>* screens = Screen::AllScreens;"
etc...
you should read the Managed C++ 1.0 documentation to learn the proper syntax
or ask the managed C++ group (there are probably some peoply who used the
old syntax and might answer your questions)

jainharsh said:
Hi
This is the part of my code...

.... Code.....
...
...
#ifdef SIMWIN
using System.Windows.Forms;
#endif

void screeninfo(void)
{

int num_screens;
int i = 0;
int j = 0;
int cord=0;
int width,height;
char pstr[10];
Symbol *s;

#ifdef DEBUG
printf ("screeninfo\n");
#endif

#ifndef SIMWIN
...........Code for Unix
#else

int upperBound;
Screen [] screens = Screen.AllScreens;
upperBound = screens.GetUpperBound(0);
s = (Symbol *) emalloc(sizeof(Symbol));
s->type = ARRAY;
SetArrayClass(s);
s->memory_size = 1;
s->u.sym = (Symbol **)ecalloc(1, sizeof(Symbol *));
j = num_screens;

#endif

s->num_elements =j;
PushSymbol(s);
}


and I am getting this error now:

c:\harshwork\com\src\simmacro\code.c(9572): error C2059: syntax error :
'.'
c:\harshwork\com\src\simmacro\code.c(9572): error C2143: syntax error :
missing ';' before '.'
c:\harshwork\com\src\simmacro\code.c(9572): error C2873: 'System' :
symbol cannot be used in a using-declaration
c:\harshwork\com\src\simmacro\code.c(9641): error C2059: syntax error :
']'
c:\harshwork\com\src\simmacro\code.c(9641): error C2065: 'Screen' :
undeclared identifier
c:\harshwork\com\src\simmacro\code.c(9642): error C2065: 'screens' :
undeclared identifier
c:\harshwork\com\src\simmacro\code.c(9642): error C2228: left of
'.GetUpperBound' must have class/struct/union type
type is ''unknown-type''

am i doing something wrong?




Jakob said:
Did you create a reference to System.Windows.Forms and put a using
statement
at the top:

using System.Windows.Forms;

HTH, Jakob.

--
http://www.dotninjas.dk


jainharsh said:
Hi Guyz,

I am trying to get the number of screens and its resolution in windows.

When I do this...

Screen [] screens = Screen.AllScreens;
upperBound = screens.GetUpperBound(0);
I get this error:

error C2059: syntax error : ']'
error C2065: 'Screen' : undeclared identifier
error C2065: 'screens' : undeclared identifier
error C2228: left of '.GetUpperBound' must have class/struct/union type

Any help would be appreciated...
Thanks,
Harsh
 
Back
Top