Click here to Skip to main content
15,913,722 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MDI and Multiple File Opens Pin
Chris Meech22-Nov-02 5:52
Chris Meech22-Nov-02 5:52 
GeneralRe: Scaling Progress Steps :: MFC Pin
valikac21-Nov-02 10:39
valikac21-Nov-02 10:39 
Generalchanging font in static text control Pin
ckr21-Nov-02 8:46
ckr21-Nov-02 8:46 
GeneralRe: changing font in static text control Pin
James R. Twine21-Nov-02 9:19
James R. Twine21-Nov-02 9:19 
GeneralATL & BSTR Pin
AJ12321-Nov-02 8:43
AJ12321-Nov-02 8:43 
GeneralRe: ATL & BSTR Pin
Christian Graus21-Nov-02 9:06
protectorChristian Graus21-Nov-02 9:06 
GeneralWinsock2 network events.. in a UI thread. Pin
RobJones21-Nov-02 8:23
RobJones21-Nov-02 8:23 
Hello,
First off im no guru on this.. I am trying to learn how to use network event objects...
I followed an article here on Codeproject and have been researching this on Google and MSDN but I can't figure it out.. I guess I have a few questions.. 1st.. Does the third value in WSAWaitForMultipleEvents sleep the thread when its set to TRUE?? If its supposed to then something is wrong with my code because it doesn't sleep..
2nd.. Does this code look right? Am I missing something? I put a break point on the if((wsaCloseEvent.lNetworkEvents & FD_CLOSE)) and it goes right past.. doesn't seem like the thread is waiting for the event to happen.. It just goes right past..
3rd.. any suggestions on where i can get more info on Network event objects and some samples?

Thanks!!
Rob


    WSAEVENT hEvent = WSACreateEvent();
WSAEventSelect(s,hEvent,FD_CLOSE);
int nErrorSelect = WSAGetLastError();
if(nErrorSelect != 0)
{
    // I do some error reporting.......
}
else
{
    WSANETWORKEVENTS wsaCloseEvent;
    WSAEnumNetworkEvents(s, hEvent, &wsaCloseEvent);
    WSAEVENT* pEvents = (WSAEVENT*)::calloc(1, sizeof(WSAEVENT));
    pEvents[0] = hEvent;

    // Sleep the thread until we receive a FD_CLOSE..
    WSAWaitForMultipleEvents(1, pEvents,
                TRUE, INFINITE, FALSE);

    if((wsaCloseEvent.lNetworkEvents & FD_CLOSE))
    {
        WSACloseEvent(hEvent);
        closesocket(s);
        PostThreadMessage(UWM_CLOSE_SOCKET,0,0); //Cleanup and exit thread..
    }

GeneralDetermining if the taskbar is visible or not and its height... Pin
Joan M21-Nov-02 8:06
professionalJoan M21-Nov-02 8:06 
GeneralRe: Determining if the taskbar is visible or not and its height... Pin
Paul M Watt21-Nov-02 8:14
mentorPaul M Watt21-Nov-02 8:14 
GeneralCannot Create Window Pin
Toni7821-Nov-02 7:58
Toni7821-Nov-02 7:58 
GeneralRe: Cannot Create Window Pin
Toni7822-Nov-02 9:09
Toni7822-Nov-02 9:09 
Generalvisual c++ and vt100 Pin
carmudav21-Nov-02 7:49
carmudav21-Nov-02 7:49 
GeneralRe: visual c++ and vt100 Pin
Maximilien21-Nov-02 9:14
Maximilien21-Nov-02 9:14 
GeneralRe: visual c++ and vt100 Pin
Joaquín M López Muñoz21-Nov-02 9:54
Joaquín M López Muñoz21-Nov-02 9:54 
GeneralRe: visual c++ and vt100 Pin
James R. Twine21-Nov-02 17:41
James R. Twine21-Nov-02 17:41 
GeneralRe: visual c++ and vt100 Pin
carmudav22-Nov-02 4:16
carmudav22-Nov-02 4:16 
GeneralRe: visual c++ and vt100 Pin
Maximilien22-Nov-02 4:22
Maximilien22-Nov-02 4:22 
GeneralManually create a wave file Pin
Hamza21-Nov-02 7:34
Hamza21-Nov-02 7:34 
GeneralExposing a 3rd Party ActiveX control to VBA Pin
Zac Howland21-Nov-02 6:46
Zac Howland21-Nov-02 6:46 
GeneralOpinion: Remote SQL Server Pin
clintsinger21-Nov-02 6:46
clintsinger21-Nov-02 6:46 
GeneralRe: Opinion: Remote SQL Server Pin
James R. Twine21-Nov-02 17:53
James R. Twine21-Nov-02 17:53 
QuestionWhere does MSVS 6 store its settings? Pin
User 665821-Nov-02 6:29
User 665821-Nov-02 6:29 
AnswerRe: Where does MSVS 6 store its settings? Pin
Fazlul Kabir21-Nov-02 6:43
Fazlul Kabir21-Nov-02 6:43 
GeneralThanks! Pin
User 665821-Nov-02 6:49
User 665821-Nov-02 6:49 

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.