PC Review


Reply
 
 
jainharsh
Guest
Posts: n/a
 
      14th Dec 2006
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

 
Reply With Quote
 
 
 
 
jainharsh
Guest
Posts: n/a
 
      14th Dec 2006
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 Christensen wrote:
> 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" wrote:
>
> > 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
> >
> >


 
Reply With Quote
 
Lloyd Dupont
Guest
Posts: n/a
 
      14th Dec 2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 Christensen wrote:
>> 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" wrote:
>>
>> > 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
>> >
>> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen.AllScreen Peter Larsen [CPH] Microsoft Dot NET Framework Forms 2 16th Apr 2010 09:11 AM
How to develop application for allscreen resolution? Amit Khatu Microsoft Dot NET Framework Forms 2 21st Dec 2003 12:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:09 AM.