There are 3 possible return values for recv: The number of bytes received, 0 if the connection has been closed gracefully, and SOCKET_ERROR if something went wrong. In the last case, you would call WSAGetLastError to obtain the error information. recv will NOT return WSACONNRESET, so you shouldn't check for it. A slightly modified loop might work better for you:
int bytesRecv = 0;
bytesRecv = recv(ConnectSocket, recvbuf, 32, 0);
if (0 == bytesRecv)
} while (SOCKET_ERROR != bytesRecv);
if (SOCKET_ERROR == bytesRecv)
printf("Socket Error: %08X\n", WSAGetLastError());
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
* I have created a MFC DLL
* I added a dialog box into it and create the class for that dialog box
* I have a function that call DoModal for that dialog
* But that function failed and returns an error "1812(The specified image file did not contain a resource section.)"
*Can any one help me in that regards
When i see your reply i think you have problem with mci functions but now that i see your reply it seems that you have a problem with CAnimateCtrl well first you dont need to use create you can insert this control from toolbox.
You said that path is correct well if you use from example clock.avi that is in windows whats happen?
are you getting same error or not,check this file and answer to me,please
When I run the file clock.avi , every thing is OK
But When I use the same program with my own avi file ie: day1.avi , the program does not work.
Is there a problem with my avi file? I can run it with microsoft window media player , no problem.
Hi Mr alex_kenobe
Well i dont know whats your avi file?you have a avi file or you create a avi file in a program like 3dmax and now you want to open it
but if you can open this file with media player and you sure that path is correct in your program i can say one suggestion to you.Used from mci
if you use from mci functions you can open avi,mp3,mpg and.... whit it because you can open clock.avi so your code doesnt any problem and problem is path or avi
but i guess if you can open it with medai player you can open your file with mci.
I hope its helpful for you but if you have questions if i can i help to you.
Tanks for your help, I read from msdn that CAnimateCtrl can only play non-compressed avi file.
I got the avi file from the internet and I donnot know if it is compressed. I am now trying mci and vfw hopefully can get some result.
Do you have any suggestions of how to use mci or vfw?
I am trying to use mciSendString to display the video , how do I postion the vido display in relative to my dialogBased application? , or If I can you other mci commoand which allows me to position the video display.
Hi alex, How are you,i think its morning in your country,right?
You want to set location from your video window,right? MoveWindow(...),SetWindowPos(...)are for position and size(dimensions) from a window
well you want to change position from your window so you need to get a HWND of your window
for example ::MoveWindow(m_hWnd,0,0,200,200,1);.
Now when you run previous code you get a handle(HWND) and you can set new location.You can get GetClientRect(hWnd,LPRECT); ScreenToClient(LPRECT); for retrieves coordinates from window.
well whats your problem?Do you have any problem yet?
I am very thankful of your kind patient and help, very much appreciated.
Yes, I have a problem.
What I am trying to do is to crate a dialogbased application using vc++.net.
On the application dialog box, I have a "play video" button, when I press the button, I like to have a video file playing on the right hand side of the dialog box ( within the application dialogbox).
I am using mci command, my problem is how to display the video at the location I wanted.
I'm trying to develop a communication between my computer (which runs on windows XP) and an external device which is connected through USB. I've built a driver using libusb-w32 which seems to be running fine. Then, following some tutorials I've found, after enumerating all the USB devices I'm using CreateFile function to establish a link. The problem is, the function returns a bad pointer (0x00000fb8) but GetLastError() returns 0, so I can't figure out what's happening...
Does anyone know why this happens? Isn't there an easier way to communicate w/ a USB device or is CreateFile the easiest?
Yep, tried using that pointer, but ReadFile returns a error. Error 9, I think... So, after that I checked the handle and it is invalid (hUsbDev = INVALID_HANDLE_VALUE). It also seemed valid too me, but it seems it isn't... =S
However, CreateFile returns 0, so it succeeds. Now what?
Last Visit: 31-Dec-99 18:00 Last Update: 18-Jun-21 15:05