|
|
OMG it took a long time to find the problem in your code
You owe me man I found 3 things - #1 was the tough one...
1) change (in sockets::socket_create()) Note parenthesis
//if( hSocket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ) != INVALID_SOCKET )
if( (hSocket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP )) != INVALID_SOCKET )
2) I added this to sockets::socket_end() (befor WSACleanup() call)
if (hSocket != INVALID_SOCKET)
{
closesocket(hSocket);
hSocket = INVALID_SOCKET;
}
3) change in (sockets::socket_end()) note comparison operator
//if( WSACleanup( ) != 0 ){ return( true ); }
if( WSACleanup( ) == 0 ){ return( true ); }
|
|
|
|
|
I've wasted an entire day over this, I can't find the information in the MSDN..
I'm using the VFW for video recording, I'm unable to enumerate the available video devices available and to select a specific device in code. The only method I found was to open the select device form (WM_CAP_DLG_VIDEOSOURCE) but I don't want any user interaction..
The MSDN states "..Connect and disconnect video and audio input devices dynamically" which is exactly what I want..
|
|
|
|
|
from the Platform SDK
Enumerating Installed Capture Drivers
The following example uses the capGetDriverDescription function to obtain the names and versions of the installed capture drivers.
char szDeviceName[80];
char szDeviceVersion[80];
for (wIndex = 0; wIndex < 10; wIndex++)
{
if (capGetDriverDescription (wIndex, szDeviceName,
sizeof (szDeviceName), szDeviceVersion,
sizeof (szDeviceVersion))
{
}
}
The index is what you're after. You'll need that for the WM_CAP_DRIVER_CONNECT message
Mark
|
|
|
|
|
That returns the driver name ('Microsoft WDM Image Capture (Win32)') not the device name .. ![Frown | :(](https://www.codeproject.com/script/Forums/Images/smiley_frown.gif)
|
|
|
|
|
Yes That's all you get in VFW these days. WDM is a newer driver model so if you use
DirectShow (which supports WDM devices as well as legacy VFW drivers) then you'll see descriptive
names. With VFW you'll only see descriptive names for old devices that haven't moved to WDM.
Mark
|
|
|
|
|
Damn.. that really complicates things I was hoping to avoid DirectX.
It sounds quite absurd that you can open a device, but you can’t know its name.
|
|
|
|
|
tanffn_aj wrote: It sounds quite absurd that you can open a device, but you can’t know its name.
Yeah it's a pain. It makes it impossible to select a device either programmatically or presenting
the user with an intuitive list to choose from.
Microsoft hasn't deprecated VFW yet but the device manufacturers have moved on to WDM for their
drivers. Windows wraps those drivers so they can be used by VFW (that's the generic name you
get).
If only you had wasted a whole day in the DirectShow SDK instead....you'd probably have something
up and running (sorry - salt in the wound)
If you choose to (or have to) go the DirectShow route I'll help out if I can. The code samples
in the SDK work decent - it gets a little wordy with all the COM stuff but it's fairly
straight forward for common video capture tasks. Way more flexible than VFW as well.
Mark
|
|
|
|
|
Thanks for all the help so far Mark.
I’ll try to figure out DirectShow by my self for now. I Don’t want to ask questions that are too dumb.
|
|
|
|
|
I thought only unasked questions were too dumb...
BTW, the DirectShow SDK is in the Platform SDK, not the DirectX SDK if you didn't know already
Good luck!
Mark
|
|
|
|
|
I ended up using DSPACK (delphi). It went a lot faster then I expected, too bad I wasted a day on VFW..
|
|
|
|
|
Hello.
I'm trying to get connection to dBase file by using ODBC.
I'm trying to use code like this:
CDatabase cdb;<br />
cdb.OpenEx( _T("DBQ=F:\\database\\a.dbf;DefaultDir=F:\\database\\;DRIVER=Microsoft dBASE Driver (*.dbf);DriverId=533;MaxBufferSize=2048;PageTimeout=5;"));
But i get message: string F:\database\a.dbf is an invalid path. But this file exactly exists!!!
I'm using Visual Studio 2005. How should I solve the problem please?
|
|
|
|
|
Create a DSN in the ODBC Data Source Administrator. That way you can create the connection settings and test it right there.
led mike
|
|
|
|
|
It looks like the smiley-face-tongue-sticking-out may be the problem.
Otherwise, what led mike said.
Mark
|
|
|
|
|
It's just a guess, but do you need to put ODBC; before DBQ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
Only for test purposes try to change the location. I guess that file is in a network path.
Regards
David Leyva
|
|
|
|
|
|
No.
If I will create DSN, will my application run at the other computer?
|
|
|
|
|
Jackson86 wrote: ...the other computer?
What other computer?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I meant that, if i will create my DSN in ODBC Administrator in my computer, I sure that in another computer will be another DSN.
Bu t I've already done with my problem. I got ODBC connection,using connection string. I understood my error. It's necessary after "DBQ=" in connection string to write path of folder, not of file.
|
|
|
|
|
Jackson86 wrote: It's necessary after "DBQ=" in connection string to write path of folder, not of file.
That must be a dBase thing. I used the following for a DSN-less connection to an Access database:
"ODBC;Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\somefolder\\dataaccess\\ADO\\nwind.mdb;"
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes, you are right. It's dBase thing. But it was main problem for me. ODBC interprets dBase database as folder, where dbf files are located, and dbf files as tables of this database.
|
|
|
|
|
Hi all:
I have the following codes:
<br />
typedef struct Point3Struct {<br />
double x, y, z;<br />
} Point3;<br />
...<br />
Point3 Object1_vertex[] = {...}<br />
...<br />
void someFunction(Point3 *vertex_list){<br />
size_t size = sizeof(vertex_list) / sizeof(Point3);<br />
...<br />
}<br />
<br />
int main(){<br />
someFunction(Object1_vertex);<br />
}<br />
By passing the vertex array into the function "someFunction", I want to calculate the size of the array and do some other operations. But why this doesn't work? When I trace the program, the varialbe size is always 0. And the vertex_list is just the first element of the array.
Other than that, if I try to do something like
size_t size = sizeof(Object1_vertex) / sizeof(Point3);
It will give me an error message saying that
error C2070: 'Point3 []': illegal sizeof operand
which complains about the "sizeof(Object1_vertex)".
How should I solve the problem please? If I want to pass an array into a function, is this the correct way to do that???
Asura
|
|
|
|
|
You'll simply need to pass the size of the array as a separate argument.
If you want to know more details on why this is happening, see this discussion[^], or search for "array decay" on the Internet.
|
|
|
|
|
size_t size = sizeof(vertex_list) / sizeof(Point3);
won't work since vertex_list is a pointer and its size is 4 (or 8).
This...
size_t size = sizeof(Object1_vertex) / sizeof(Point3);
...works for me (size == 3 if I initialize with 3 Point3 structs) but that makes passing the array
useless since the array is accessible from anywhere in the same file anyway.
You may need to pass the size along with the array pointer unless you can define the array with
a set size.
Mark
|
|
|
|