|
Maximum connection per server for Wininet library is 2 by default for HTTP 1.1, and 4 for HTTP 1.0. Please refer to the article:
http://support.microsoft.com/kb/183110
I also had encountered the same problem before. Because I did it for my own usage, I just increased the values in the registry. However, according to RFC2616, it is not recommended to maintain more than 2 concurrent connections from the single client to the same server.
BTW, for that small program, I make sure that each worker thread keeps its own internet session and internet connection. Maybe you could try it.
One more thing, if I am not wrong, INTERNET_FLAG_KEEP_CONNECTION flag enforces the client to reuse the existing connection. To verify that multiple connections are opened, in the command prompt, type "netstat -a".
Good luck!
|
|
|
|
|
_AFXWIN_INLINE LRESULT CWnd::SendMessage(UINT message, WPARAM wParam, LPARAM lParam)
{ ASSERT(::IsWindow(m_hWnd)); return ::SendMessage(m_hWnd, message, wParam, lParam); }
getting a debug assertion falied error in this line......
can anybody tell me the cause of this problem....
|
|
|
|
|
neha.agarwal27 wrote: can anybody tell me the cause of this problem....
Yes, you are trying to send a message to a non-existent window.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
but the window is existing.......can you tell me the way to resolve it.....
|
|
|
|
|
neha.agarwal27 wrote: but the window is existing.......
Apparently not. The CWnd object might exist, but not the underling window.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Are you sure CWnd of that window is valid?
|
|
|
|
|
Hi All
I have been puzzelled, actually problem is that I run a code in C# project and in Console based project of Visual Stdio 2005.
code is as follows:
int i = 1;
int j = (++i) + (++i) + (++i);
Now I found different values for j in C# project( j = 9) and console based project( j= 12).
So please suggest me the answer behind this different values of j in both projects.
Thansk & Regards
|
|
|
|
|
C++ does not guarantee an evaluation order for operations within an expression. The compiler is free to, as in this case, perform all three preincrement operations first and then sum the results. Sometimes this gives the compiler greater opportunity for optimization. The solution is not to preincrement or postincrement a variable multiple times in the same expression.
C# guarantees left-to-right evaluation order, so the result is always 2 + 3 + 4 = 9.
|
|
|
|
|
True, but the answer should still be 9 whether left to right or right to left or any other order.
Where is that 12 coming from? Hmmm…
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
It was just explained. The compiler can evaluate all 3 ++ operations before performing the rest of the arithmetic. Thus you end up with i++, i++, i++ so i = 4. Now j = 4 + 4 + 4 = 12. I'm not that familiar with C# and its compiler so I can't speak for why Console apps in C# do it. But it certainly makes sense in a C++ context.
|
|
|
|
|
Actually it makes no sense in a C++ context, unless the compiler is flawed. But I do see what the problem is now. I do not write code in the form presented for reasons like that, but a compiler should know how to handle it correctly (even with optimization). I suspect that the standard leaves this possibility open, but logic should prevail where the standard fails.
By the way there is a major difference between i++ and ++i (in code) in C++; C is more forgiving, but not with integral types.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Presumably getting such a thing working is just extra work to enable horribly confusing code. I'm pretty content to let the compiler discourage people from writing statements filled with pre and post increments nested in other operations.
|
|
|
|
|
I agree; it is just that the code presented was not ‘horribly confusing’. I have seen ‘horribly confusing code’ and that did not even come close. Now take away the parenthesis and the compiler will interpret it the same, but the viewer would have to stop and think about it.
Oh well, its does not matter to me because I don’t do that. Thanks for you explanation of how the 12 came about.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
John R. Shaw wrote: By the way there is a major difference between i++ and ++i...
How so?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
For one, in the original question ‘j’ would have been equal to 3. Second if ‘i’ was a class instead of an ‘int’, then the overhead could be expensive in C++. But you already know that. Always prefer ‘++i’ to ‘i++’.
Just add support for ‘++’ (pre & post) to any class and you will see the problem, the compiler does not optimize that away.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I'm using a spin button for the first time. I've set up a buddy window. However, it is working in reverse. If I click on the top arrow button or hit the up arrow key on the keyboard the value decrements. If I click on the bottom arrow button or hit the down arrow key on the keyboard then the value increments. What am I doing wrong?!?!?!
|
|
|
|
|
It has been a long time, but you might have to reverses the minimum and maximum values for the spin control. At least I think that is how it works.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Yes that worked. I hadn't set up a range at all. Using SetRange cure the problem.
Thanks
|
|
|
|
|
Glad I could help!
Be careful, not knowing the limits, of anything, can get you into trouble. Too many people make assumptions about limits that often do not hold up in the long run, usually after they are long gone though. I wrote a program that allowed for future changes, but I made a fatal mistake in that my original calculations (equations) where based on hardware limitations at the time. It got me a contract to come back, 7 years after writing it, but 1 hours work + testing is no excuse for my original mistake (personal thing).
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Per MSDN:
The default range for the spin button has the maximum set to zero (0) and the minimum set to 100. Since the maximum value is less than the minimum value, clicking the up arrow will decrease the position and clicking the down arrow will increase it. Use CSpinButtonCtrl::SetRange() (or SBM_SETRANGE ) to adjust these values.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am new to directshow. I am coding an application which can capture a image from live video from web camera. I am using two picture controls captioned: Live Video and Capture video. In Live video picture control I am able to get the live video and in capture video I am getting the current image.This works perfect BUT
When i try to display the current capture image in live video picture control and I able to display it but not able to see the live video again. I tried to call the run member function but still the live video does not display
S.Yamini
|
|
|
|
|
yaminisridaran wrote: When i try to display the current capture image in live video picture control
How are you doing that? Caqn you show some code?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Hi Folks,
How can I change the ParentWindow of an ActiveX Control dynamically... I'll Explain what I have done...
I have an ActiveX Control placed statically on the Main Dialog(this Dialog being the first parent of the ActiveX Control).Then I am creating another Parent(a Modeless Dialog ) on the button click Event of the main dialog..After Creating this modeless dialog.. I am changing the parent of the ActiveX Control from the Main Dialog to the new created modeless Dialog..So far fine...the ActiveX Control was moving to the new parent too..but if I click on the ActiveX Control on the new Parent..it is jumping backto the Old Parent(the Main Dialog)...this is happening only with ActiveX Controls...(I tried wid many ActiveX Controls)...Can Anyone provide some solution or atleast throw some light on it.. This is what I have written(slightly modified)
myModeless = new CNewDlg(NULL); // myModeless is pointer to new dialog to be created
if (myModeless->Create(IDD_DIALOG1) == TRUE)
{
myModeless->ShowWindow(TRUE);
}
CCalendar *aBtn = ((CCalendar *)GetDlgItem(IDC_CALENDAR1));
CRect aCtrlRect;
aBtn->GetClientRect(aCtrlRect);
if(NULL != myModeless)
{
aBtn->SetParent(myModeless);
aBtn->MoveWindow(aCtrlRect);
}
Regards
Naveen.V
|
|
|
|
|
Hi,
My application consists if a parent window and a child window which pop up when i click a button in the parent window.I have many controls in it and my problem a control is active by default i.e,even if i didnot select it,it is becoming active.How can i restrict a control to be active untill we click on it.
Thanks
|
|
|
|
|
kiranin wrote: I have many controls in it...
On the parent or child?
kiranin wrote: even if i didnot select it...
Select what?
kiranin wrote: How can i restrict a control to be active untill we click on it.
You want a control to be "active" until you click on it?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|