|
Hello,
I am kind of worried about the following bit of code.. is it possible to have a socket block indefinitely? If so what could cause that?
if(sock == INVALID_SOCKET)
return FALSE;
while(true)
{
int nSend = send(sock,(char FAR*)&sSend, sizeof(sSend), 0);
if(nSend == SOCKET_ERROR)
{
if(WSAGetLastError() != WSAEWOULDBLOCK)
return FALSE;
}
else
break;
}
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
RobJones wrote:
is it possible to have a socket block indefinitely?
No. If there's no error, then it will send eventually. If there is an error, it will not block, but will return the error immediately.
And even if it takes ages to send the data, TCP includes timeouts, so it won't block forever - it will return a timeout error.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
Thank you for stopping by.
I have a number of dlls written for VC++ 6 and I have been asked to make them available to a VB app (perhaps in the form of a .def file).
I would be very grateful to know what or how to go about doing this.
Any pointers would be much appreciated - the possibility of PAID work after so long is certainly a good incentive - I am sure you understand.
Please note that I am a VC++ programmer on version 6. I have yet to transition to .NET.
Thanks
Michael
|
|
|
|
|
Assuming the functions/classes in the C++ are exported, why not just add
Declare Function NameOfFunction Lib "NameOfLib" (ParameterList) As ReturnType
to the top of your VB modules?
|
|
|
|
|
Hi David,
Thank you for responding.
I have never produced a dll so I am completely ignorant of the terms, which I know is going to make this coding difficult. I guess I will have to go away and get familiar with how dlls are coded and generally fiddle around with them, since at this point I don't even know what 'exported' means.
At least you have given me a starting point and thanks for that.
Thanks
Michael
|
|
|
|
|
|
Excellent resource.
Thank you so much! I think this will do it.
Thanks again. You are a star!
Michael
|
|
|
|
|
Hello
I have a HWND of a window and the coordinates of the pixel. How can I get a current color of this pixel?
The window is from another application.
Thank you in advance
|
|
|
|
|
hi..
if you know that coordinate's of pixel,you can use this function.
COLORREF GetPixel(
int x,
int y
)
like this..
COLORREF color;
color=GetPixel(10,10);
int red=GetRValue(color);
int blue=GetBValue(color);
int green=GetGValue(color);
Good Work...
|
|
|
|
|
Thanks
It was the first useful reply on my questions on this forum.
Thanks again
|
|
|
|
|
Sure you can turn off the precompiled header option but, unless this file is also used by a 'C' project some where, all you need to do is changed the extension and #include then stdafx.h file at the top of the file.
INTP
|
|
|
|
|
You must either add
#include "stdafx.h"
at the top of your c file, or change the c file "Settings" -> "Precompiled Headers" to "Not using precompiled headers".
Cheers,
Andy
|
|
|
|
|
In my VC++ project i had to add a .c file that just had this data
int cycleTableSize=3;
int camData[] = {0,1,2,3,4,5,6};
I am getting the error
fatal error C1010: unexpected end of file while looking for precompiled header directive
What am i doing wrong ?
|
|
|
|
|
In the Project/Settings dialog box (Alt+F7), select the .C file in the list on the left. Then select the C++ tab, Precompiled Headers category. Select the Not using precompiled headers radio button.
Otherwise, you'll need to add #include "stdafx.h" to the top of the .C file.
|
|
|
|
|
|
Go to project Settings, Alt+F7, and in the right pane, select the file, then select the C++ tab and in the precompiled header category, select not using precompiled header.
This should solve your problem.
cheers
Daniel Cespedes
"There are 10 types of people, those who understand binary and those who do not"
"Santa Cruz de la Sierra Paraiso Terrenal!"
daniel.cespedes@ieee.org
|
|
|
|
|
|
I posted a message board similair to it but I just don't understand can anyone tell me how to CLEAR the recent file list in detail..
<marquee>Universal Project
|
|
|
|
|
You've asked this same question twice before, but have not indicated if the suggestions have helped, or what you have tried/not tried. Show us some code of what is not working and we can guide you through it.
|
|
|
|
|
Hi guys,
Does anyone how to create a pointer to the document class while you are in the mainframe class.
Raj
|
|
|
|
|
GetActiveDocument() does that!
|
|
|
|
|
Use: AfxGetApp()->m_pDocManager
Here is an modified example that may help:
void MyApp::InvalidateAllViews()
{
POSITION pos = m_pDocManager->GetFirstDocTemplatePosition();
while( pos )
{
CDocTemplate* pTemplate = m_pDocManager->GetNextDocTemplate(pos);
POSITION pos2 = pTemplate->GetFirstDocPosition();
while( pos2 )
{
CMyDoc* pDoc = (CMysDoc*)(pTemplate->GetNextDoc(pos2));
if( pDoc )
{
POSITION pos3 = pDoc->GetFirstViewPosition();
while( pos3 )
{
CMyView* pView = (CVMyView*)(pDoc->GetNextView(pos3));
pView->Invalidate();
}
}
}
}
}
INTP
|
|
|
|
|
Hi,
I have the code from CodeProject on Framegrabbers which is written in VC++ (MDI).....
it displays the video in the view class, how can I display the video in a dialog?
Ehsan Behboudi
|
|
|
|
|
Hi,
I have a (read-only) Rich Edit box and I need both bold and normal text in it, as it displays helpful information about my app under various titles (so I want the titles in bold and the main text not in bold). I've seen this done, but I have no idea how to go about having one long string containing different format.
At the moment I am just using SetDlgItemText to set the text in the Rich Edit box...
Any help much appreciated.
Oh, and I'm using the straight WinAPI SDK with _no_ MFC, btw.
Many thanks,
KB
|
|
|
|
|
You'll need to select the appropriate text with the EM_EXSETSEL message. Then, you can set that selection's font using the EM_SETCHARFORMAT message.
|
|
|
|