Click here to Skip to main content
15,887,404 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Internet Get Connected State Pin
Rajesh R Subramanian18-Mar-10 10:24
professionalRajesh R Subramanian18-Mar-10 10:24 
GeneralRe: Internet Get Connected State Pin
Richard MacCutchan18-Mar-10 10:30
mveRichard MacCutchan18-Mar-10 10:30 
AnswerRe: Internet Get Connected State Pin
Iain Clarke, Warrior Programmer18-Mar-10 10:08
Iain Clarke, Warrior Programmer18-Mar-10 10:08 
GeneralRe: Internet Get Connected State Pin
MrMcIntyre18-Mar-10 10:11
MrMcIntyre18-Mar-10 10:11 
GeneralRe: Internet Get Connected State Pin
Iain Clarke, Warrior Programmer18-Mar-10 10:21
Iain Clarke, Warrior Programmer18-Mar-10 10:21 
GeneralRe: Internet Get Connected State Pin
MrMcIntyre20-Mar-10 6:49
MrMcIntyre20-Mar-10 6:49 
GeneralRe: Internet Get Connected State Pin
Iain Clarke, Warrior Programmer22-Mar-10 8:46
Iain Clarke, Warrior Programmer22-Mar-10 8:46 
AnswerRe: Internet Get Connected State Pin
Bram van Kampen18-Mar-10 15:23
Bram van Kampen18-Mar-10 15:23 
You Don't seem to understand what 'Scope'Means. Maybe you just migrated from QBasic or so...

I'll explain this basic stuff just this once! You Start at File Scope. That's where you declare and define Golbal Variables, and Global Statics. NO ACTION CAN TAKE PLACE THERE! (except assigning Fixed Values to Variables).

Action can only take Place in a Function. Any Statement, (that is things where Action takes Place, susch as c=a+b; if(Something)doSomething(), has to take place inside a Function. A function is a Named Global Variable to which a list of Actions is attached. it is declared and may also defined in the standard way, but it is distinguished as a function because it is followed by (...)

For instance:

int A; declares a Variable of type integer, named 'A'
int A=10; does the same, but also gives it the value 10, (defines it)
int A(); declares a Function Variable Named 'A'
int A(){.....} does the same, but also defines what the function does, by the code included by the brackets. That Code is at Scope Level1 (File Scope being Level 0). This is the plase where the If, When and Whatever Code goes. (As you have in your File). The Scope level can be further increased, by nesting more {...} pairs inside it, but That's a prety advanced subject from where you are now, Save to say, You're NOT allowed to write another function inside the body of a function. (That is Different in languages susch as say Pascal). Try itin C or CPP, and you get plenty of error messages,the compiler will choke.





Functions can only be called from Other functions, and you cannot start a Function in File Scope. So, the phylosophical question arrives, 'How does it all Start'Afteral, in QBasic, it starts with the first line of Code.

That's where a Special function comes in. (Mostly) every C Program starts with a function called 'main()' Some programs start with differently named programs, and in some cases the definition of the main() program is more involved, but again, those are pretty advanced subjects from where you are now.

But, if you want to write a basic program, include all your first actions inside a function called main().

If you try this with the above snippet (I did not try it, I must admit), it will almost certainly NOT work.

The Service 'InternetGetConnectedState'requires a complicated environment around it. This again, is a very advanced subject from where you are now.
Instead of this, why don't you replace it with 'printf("Hello World");'and then build up to more difficult (and more Usefull Cases).

Unfortunately, we in the Code project cannot 'Donate'Knowledge. You have to gain it yourself, and I hope I pointed you in the right direction.

Smile | :)
Bram van Kampen

QuestionOpenGL w/SDL linker problem [modified] Pin
bala_4822518-Mar-10 8:47
bala_4822518-Mar-10 8:47 
AnswerRe: OpenGL w/SDL linker problem Pin
Moak18-Mar-10 10:56
Moak18-Mar-10 10:56 
GeneralRe: OpenGL w/SDL linker problem Pin
bala_4822518-Mar-10 16:26
bala_4822518-Mar-10 16:26 
QuestionA thread that creates multiple dialogs Pin
bu7ch3r18-Mar-10 8:36
bu7ch3r18-Mar-10 8:36 
AnswerRe: A thread that creates multiple dialogs Pin
Maximilien18-Mar-10 9:29
Maximilien18-Mar-10 9:29 
GeneralRe: A thread that creates multiple dialogs Pin
bu7ch3r18-Mar-10 9:36
bu7ch3r18-Mar-10 9:36 
GeneralRe: A thread that creates multiple dialogs Pin
Maximilien18-Mar-10 9:43
Maximilien18-Mar-10 9:43 
GeneralRe: A thread that creates multiple dialogs Pin
bu7ch3r18-Mar-10 9:50
bu7ch3r18-Mar-10 9:50 
AnswerRe: A thread that creates multiple dialogs Pin
Avi Berger18-Mar-10 9:35
Avi Berger18-Mar-10 9:35 
GeneralRe: A thread that creates multiple dialogs Pin
bu7ch3r18-Mar-10 9:40
bu7ch3r18-Mar-10 9:40 
GeneralRe: A thread that creates multiple dialogs Pin
Maximilien18-Mar-10 9:50
Maximilien18-Mar-10 9:50 
GeneralRe: A thread that creates multiple dialogs Pin
Avi Berger21-Mar-10 11:51
Avi Berger21-Mar-10 11:51 
AnswerRe: A thread that creates multiple dialogs Pin
Eugen Podsypalnikov18-Mar-10 9:45
Eugen Podsypalnikov18-Mar-10 9:45 
GeneralRe: A thread that creates multiple dialogs Pin
bu7ch3r18-Mar-10 9:52
bu7ch3r18-Mar-10 9:52 
GeneralRe: A thread that creates multiple dialogs Pin
Eugen Podsypalnikov18-Mar-10 9:57
Eugen Podsypalnikov18-Mar-10 9:57 
GeneralRe: A thread that creates multiple dialogs Pin
bu7ch3r18-Mar-10 9:59
bu7ch3r18-Mar-10 9:59 
QuestionHow Could I Use a define macro identifier in an other define macro replacement list? Pin
A&Ms18-Mar-10 4:08
A&Ms18-Mar-10 4:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.