Programming: "Hello World " Program in C++

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
mopopo





Posts: 84
Joined: Wed Mar 23, 2005 5:58 pm
Contact:

Post by mopopo »

Prior to discussing asynchronous operations over the Internet, let's touch on one important part of data transferring. Regardless of the established session type (synchronous or asynchronous), users of your application probably will appreciate it if it somehow indicates that lengthy operations are advancing and still alive. WinInet provides a callback mechanism for such purposes. An application may register such a callback to retrieve asynchronous notifications about the desired operation's progress. You should use the following function:

typedef void (CALLBACK *INTERNET_STATUS_CALLBACK) (
HINTERNET hInternet,
DWORD_PTR dwContext,
DWORD dwInternetStatus,
LPVOID lpvStatusInformation,
DWORD dwStatusInformationLength
);

INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallback(
HINTERNET hInternet,
INTERNET_STATUS_CALLBACK lpfnInternetCallback
);

InternetSetStatusCallback takes a pointer to the application-defined function, which then is called by WinInet when progress is made on the specified operation. Saying it briefly, all you need to do is to define the following function:

void CALLBACK YourInternetCallback(
HINTERNET hInternet,
DWORD_PTR dwContext,
DWORD dwInternetStatus,
LPVOID lpvStatusInformation,
DWORD dwStatusInformationLength
);

All parameters are described in detail in online documentation, so we won't copy it here. Let's just highlight several useful points. The second parameter of the callback function is an application-defined context for the hInternet handle. This gives you a convenient way to implement different behavior for each context value; for example, for uploading and downloading data. Another thing to be noted is the dwInternetStatus parameter. You will use its values to inform the user about actual operation progress and to detect the moment when the asynchronous operation is completed. Thus, such a callback may look like the following:

void CALLBACK InternetCallback(HINTERNET hInternet,
DWORD_PTR dwContext,
DWORD dwInternetStatus,
LPVOID lpvStatusInformation,
DWORD dwStatusInformationLength)
{
switch (dwContext)
{
case X:
...
switch (dwInternetStatus)
{
...
case INTERNET_STATUS_CONNECTED_TO_SERVER:
// Notify the user...
...
break;
case INTERNET_STATUS_REQUEST_COMPLETE:
// Asynchronous request was completed
...
break;
case INTERNET_STATUS_RESPONSE_RECEIVED:
// Process this event...
...
break;
...
}
break;
}
}

The Compact Framework still does not provide the same mechanism as C++ does, but we will see what C# offers for asynchronous calls in the next section.

This is a code ok? i know c++ now shut the **** up you fatuous poser
live2board





Posts: 17
Joined: Sun Mar 27, 2005 10:08 am

Post by live2board »

http://www.developer.com/net/cplus/article.php/3436841
nice try buddy. and don'y tell me you wrote that because I know you didn't. You should've atleast changed the text so it would've been harder than a google search. Especially when its the first site that comes up.
Cheech|N|Chong





Posts: 115
Joined: Fri Jan 14, 2005 9:26 am
Location: Why The Fuck Would I Tell You? Indiana...
Contact:

Post by Cheech|N|Chong »

live2board wrote:http://www.developer.com/net/cplus/article.php/3436841
nice try buddy. and don'y tell me you wrote that because I know you didn't. You should've atleast changed the text so it would've been harder than a google search. Especially when its the first site that comes up.
lmmfao...d.amn
maybe he'll get fined for claiming its his work ? maybe its
Signature exceeded 75KB.
mopopo





Posts: 84
Joined: Wed Mar 23, 2005 5:58 pm
Contact:

Post by mopopo »

did i say i wrote that? NO. i said it was an example of a code i understood. if i wanted to i could show you a total 100% my code example and you can search the internet for a day and you wont find anything. though your conviction is true there is some truth in your fiction and some fiction in your truth.
live2board





Posts: 17
Joined: Sun Mar 27, 2005 10:08 am

Post by live2board »

post it than. Nobody is holding you back. Show us your mad C++ programming skillz. Because we all know your a l33t haxx0rz!
kyboren





Posts: 58
Joined: Thu Feb 12, 2004 8:49 pm

Post by kyboren »

Lmao.

I wasn't trying to insult you, I was just calling you on your outrageous claims. There comes a time when you just have to move on. That's what I'm doing right now. Hopefully I'll see you again soon somewhere and we can chat again.
mopopo





Posts: 84
Joined: Wed Mar 23, 2005 5:58 pm
Contact:

Post by mopopo »

wow look what a hello world program created lol. no hard feelings :)
phantom48





Posts: 3
Joined: Sun Feb 06, 2005 12:45 pm
Location: high charity
Contact:

Post by phantom48 »

what? i got DEV-C++ and it says it needs the make file thing, where do i get that? and where do i put it. post links please! :wink:
kyboren





Posts: 58
Joined: Thu Feb 12, 2004 8:49 pm

Post by kyboren »

How about
1) You be more specific
2) Create a thread with a topic pertinent to what you are discussing
3) You do a little thinking and research on your own, and at least TRY to solve your own problems instead of having other people spoon feed you...
kaptainkommie




Wordewatician 500

Posts: 732
Joined: Wed Nov 26, 2003 11:59 pm
Location: Raleigh, NC, USA

Post by kaptainkommie »

[Locked]
User avatar
Locke




Socialist Advisor Translator

Posts: 2225
Joined: Fri Aug 06, 2004 1:42 am
Location: Woot.com
Contact:

Post by Locke »

kaptainkommie wrote:[Locked]
***Notices KK didnt lock it
*Locks
Image
Feel free to send me an instant message if you need anything.
Locked