|
Hi,
Originally the issue was that connect() has a 20 second timeout in it. I switched to some code I found that makes the connect() not blocking, and I can certainly get program control back in 5 seconds, but this module needs to load and unload and I can't get it to unload without the full 20s wait because WSACleanup must wait for that original non blocking connect to complete before it releases.
I've tried various linger options and calling or not calling shutdown and closesocket, but nothing makes a difference. I don't want to not call WSACleanup as I figure that might be a big deal.
Is there a way to tell winsock to stop trying to connect so it doesn't wait out the 20s?
Thanks,
Alan
|
|
|
|
|
A non-blocking socket should return in like 5 micro-sec. Not 5 sec. How did you make the socket non-blocking?
-- Gisle V.
|
|
|
|
|
Sorry about the confusion - yes I am using select to make the timeout 5s. That is the timeout I would like and that part is working fine. It is the WSACleanup that isn't quickly returning that is the problem. I am hoping there is something I can do to shutdown the connect attempt before I call WSACleanup that would stop WSACleanup from taking the remaining 15s...
|
|
|
|
|
Hello.
I'm trouble in MCI T-T
this is my video spec.
General
Complete name : C:\Users\Administrator\Desktop\abdd\abc.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 5.66 MiB
Duration : 1mn 22s
Overall bit rate : 577 Kbps
Writing application : Lavf53.32.100
Video
ID : 0
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L3.0
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=3
Codec ID : H264
Duration : 1mn 22s
Bit rate : 575 Kbps
Width : 320 pixels
Height : 240 pixels
Display aspect ratio : 4:3
Frame rate : 12.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.623
Stream size : 5.63 MiB (100%)
when I open this video.
originally my code is...
MCI_ANIM_OPEN_PARMS *mciOpen = new MCI_ANIM_OPEN_PARMS;
mciOpen->lpstrDeviceType = _T("AVIVideo");
but It doesn't work.
This file extension name is .avi.
so I thought this lpstrDevicetype is also Avi.
but It has matter.
so now my changed code is...
MCI_ANIM_OPEN_PARMS *mciOpen = new MCI_ANIM_OPEN_PARMS;
mciOpen->lpstrDeviceType = _T("MPEGVideo");
It work!!!
1. Is it different file extension name and codec(for lpstrDeviceType) ?
2. I think my codec is lavf53.32.100 in ffmpeg, doesn't it?
so how to put code lpstrDeviceType ? MPEGVideo2, MPEGVideo4, MPEGVideo, FFMPEG??
I can't choose the lpstrDeviceType.
help me plz!
|
|
|
|
|
Hello. I am trying to compile VLC player source code in visual studio. I have got all the header and implementation files. But I am getting alot of errors (77K+ to be precise). There are some options that have to changed to compile it successfully? What should I look for? Thanks.
|
|
|
|
|
The first one I would guess at is to turn the unicode on the API interface off.
Project->Properties->configuration properties->character set
It will be defaulted to "Use Unicode Character Set" change it to "not set"
However I seem to recall you can't compile VLC on visual studio because it needs MingGW-64 and that won't compile on Visual Studio because of C++ abi and name convention differences. So unless things have changed I think it is not possible.
In vino veritas
|
|
|
|
|
|
Suppose we represent rectangle with CRect(MFC), its edges is parallel to Ox and Oy. now we have N rectangles(N might be a very large number, for instance N = 9999).
Now I want to determine whether there is(are) overlapping in these rectangles, of course I want the best algorithm.
Anybody can help me?
|
|
|
|
|
The Bounding Box method is fairly simple, this technique involves checking whether an object has intercepted (overlapped) an invisible square boundary that is usually placed over, and often remains relative to, a game object.
int bounding_box_collision(int b1_x, int b1_y, int b1_w, int b1_h, int b2_x, int b2_y, int b2_w, int b2_h)
{
if ((b1_x > b2_x + b2_w - 1) || (b1_y > b2_y + b2_h - 1) || (b2_x > b1_x + b1_w - 1) || (b2_y > b1_y + b1_h - 1)) {
return 0;
}
return 1;
}
http://wiki.allegro.cc/index.php?title=Bounding_Box[^]
modified 5-May-14 9:51am.
|
|
|
|
|
The best algorithm is up to you, of course.
A naive algorithm would use a simple nested loop
for (i=0; i<N-1; ++i)
for (j=i+1; j<N; ++j)
if ( IntersectRect(&rcOut, &rc[i], &rc[j] )
{
}
Veni, vidi, vici.
|
|
|
|
|
That is possibly a terrible idea you have 9999 Rect's as you are hoping it's singular process and you can process them on the fly. If you need to come back to them you just wasted a whole pile of time which you will have to repeat.
If there is that many entries you would use the bounding box method as discussed by Supercoder and it may be better to bubble sort them or separate them into their own list at the same time while doing the test. At least then for any further processing you don't have to do the long overlap test again.
So I am not convinced at all you would process them as per above it really depends what happens next.
In vino veritas
|
|
|
|
|
Hi,
I am using my own gridview derived from Clistview.
My problem is to make the first column always fixed on Horizontal scroll.
Can anybody knows the best solution for this in MFC..
Thank you in advance...
|
|
|
|
|
sma123# wrote: ...first column always fixed on Horizontal scroll. What exactly do you mean by this?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hi David,
I have a grid control derived from Cwnd. I am displaying the grid on ClistView.
The problem is when I using horizontal scroll all columnc are shifting including first column. I need to fix the first column remaining can move with scroll.
I am using MFC control which is older one.
If you have any suggestion on this?
Thanks in advance.
|
|
|
|
|
Handle the HDN_BEGINTRACK message by returning TRUE . If you are using MFC, check out OnHeaderBeginTrack() . There are plenty of examples of both of these.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
You need to look at the attributes of the columns in your control. You could possibly change the order or set the width to zero. However, you probably need to either subclass this control to manage this behaviour, or even create a new control from scratch.
|
|
|
|
|
Hello...This question may sound silly to some of you but I've been stuck on it for few days and can't find any answer... So I need to have the mouse position x and y displayed in the status bar.
So far I add new string to the table, in the indicators array,
afx_msg void OnUpdateCurPos(CCmdUI *pCmdUI) in the message map and ON_UPDATE_COMMAND_UI(ID_INDICATOR_CURSOR,OnUpdateCurPos)
When I run it's there but can't find the right way to update the cords. I think it must work with ON_MOUSEMOVE func...I've tried several codes in ON_MOUSEMOVE and OnUpdateCurPos but it doesn't work at all...
Working with SDI.
|
|
|
|
|
What does your OnUpdateCurPos() and OnMouseMove() functions look like? Have you called SetCapture() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Well that is the problem :P I've added SetCapture() when you press LButton, but I'm not rly sure if I need it?
void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point)
{
SetCapture();
CFrameWnd::OnLButtonDown(nFlags, point);
}
void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
{
if(GetCapture()==this){
posX=point.x;
posY=point.y;
}
CFrameWnd::OnMouseMove(nFlags, point);
}
void CMainFrame::OnUpdateCursor(CCmdUI *pCmdUI){
CString pos;
pos.Format(ID_INDICATOR_CURSOR,posX,posY);
m_wndStatusBar.SetPaneText(m_wndStatusBar.CommandToIndex(ID_INDICATOR_CURSOR),pos);
}
Well atleast now the sting is updated with 0's. Its defined as " x: %d ,y: %d ". So the OnUpdateCursor() is working but not with the right values...
|
|
|
|
|
What happens when you change your Format statement to
pos.Format(" x: %d ,y: %d " ,posX,posY);
|
|
|
|
|
Nothing. Stays the same:
"x: 0 , y: 0"
|
|
|
|
|
It that the value of pos immediately after the Format() call?
|
|
|
|
|
Yes... Seems like OnMouseMove doesn't update posX and posY.
If I do :
void CMainFrame::OnUpdateCursor(CCmdUI *pCmdUI){
CString pos;
posX=100;
posY=200;
pos.Format(L" x: %d ,y: %d ",posX,poxY);
m_wndStatusBar.SetPaneText(m_wndStatusBar.CommandToIndex(ID_INDICATOR_CURSOR),pos);
}
It does put
"x: 100,y: 200"
in the status bar...
|
|
|
|
|
So, it looks like GetCapture() != this, perhaps have a look at this[^] article.
|
|
|
|
|
In OnMouseMove() , what is the value of point.x and point.y ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|