|
There's an easy way to communicate with usb devices. With build in usb device io you're not really able to write to usb devices easily.
Just install the libusb drivers which has a filesize of about 1/7 MB. There are alreay src samples delivered with this package. You just need to know what you would like to send to the device.
|
|
|
|
|
Can I know where is the website for this libusb driver?
I downloaded and install the files from
http://libusb-win32.sourceforge.net/#support
1) libusb-win32-filter-bin-0.1.10.1.exe
2) libusb-win32-src-0.1.10.1.tar.gz
3)libusb-win32-device-bin-0.1.10.1.tar.gz
I could not find any documentation to link it with
visual C ++ . Can anyone advise me? Or link me to one
documentation?
THere is error whenever i try to use the data
structure in libusb.
Thanks
cheers
Dingyao
|
|
|
|
|
Just a sample for libusb libusb-win32-filter-bin-0.1.8.0.exe
To enumerate all webcams connected to your usb port..... looks a bit messy here
1)
struct usb_bus *bus;
struct usb_device *dev;
usb_init();
usb_find_busses();
usb_find_devices();
for (bus = usb_get_busses(); bus; bus = bus >next)
{
for (dev = bus->devices; dev; dev = dev->next)
{
usb_dev_handle *udev;
if (!((dev->descriptor.idVendor==PRODUCT_VENDOR_ID) && (dev->descriptor.idProduct == PRODUCT_ID)))
continue;
udev = usb_open(dev);
if (udev)
{
..... Do something here
usb_close (udev);
}
}
// ---------------------------------------------
To send something to the usb device ....
buf[0] = pan & 0xff;
buf[1] = (pan>>8) & 0xff;
buf[2] = tilt & 0xff;
buf[3] = (tilt>>8) & 0xff;
usb_control_msg(udev, XX, XX, XX, XX, buf, X, XX);
..where XX is device specific
-- modified at 12:28 Wednesday 14th September, 2005
|
|
|
|
|
I'm puzzled by ON_WM_CREATE() macro's definition
{ WM_CREATE, 0, 0, 0, AfxSig_is, \
(AFX_PMSG)(AFX_PMSGW)(int (AFX_MSG_CALL CWnd::*)(LPCREATESTRUCT))&OnCreate }
I know that the text in bold is a pointer to CWnd's function, and I know the statement after the last period is the "routine to call", But I don't quite understand what the statement trying to accomplish, Is it just a cast for function OnCreate?
|
|
|
|
|
Hello,
First, why do you wan't to know how the message macro's work?
I created a thread class, that also has a message map and the following explanation comes from my experiance.
The message map of MFC is an array of structs. These structs have one general pointer to a message. (Casting back to the right form is done using signatures.)
The statement is casting a function pointer to a general pointer used by the the message map of MFC. This is done in multiple steps, since you cannot cast it directly. The compiler will complain heavily about casting function pointers. For this reason it is first casted to a base class member function pointer. Second it is casted to an intermediate type and finally it is casted to the general type.
I hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
First, why do you wan't to know how the message macro's work?
Out of curiosity, and what's more I'm trying to understand how my dialog based class hear the Windows calling, such that I'm not take for granted everytime I put a message macro in my class!Your reply did help!
Thanks Bob!;)
|
|
|
|
|
Bob Stanneveld wrote:
First, why do you wan't to know how the message macro's work?
Out of curiosity, and what's more I'm trying to understand how my dialog based class hear the Windows calling, such that I'm not take for granted everytime I put a message macro in my class!Your reply did help!
Thanks Bob!
|
|
|
|
|
You're welcome
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Dear all,
I have a problem in Visual Studio .NET 2003 about implementing tooltips for dialog based controls e.g. buttons migrating from Visual Studio 6.0 which drives me crazy. In VS 6.0 the tooltips work without any problem for all controls using the method listed below:
void ...:: OnInitDialog()
{ ...
EnableToolTips (TRUE);
... };
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify)
BOOL ...::OnToolTipNotify (UINT id, NMHDR* pNMHDR, LRESULT* pResult)
{
// Tooltip Daten holen
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT*) pNMHDR;
// ID des sendenden Dialogelementes holen
UINT nID = pTTT->hdr.idFrom;
...}
If I compile and link the source code using .NET 2003 Professional the tooltips appear for some controls, and for some controls NOT. I don't know why. I found that for some controls the message handler OnToolTipNotify will be started, for some controls not. I could check it setting a break point.
Is there any solution for this problem known ? Thanks for all help.
Ulrich
|
|
|
|
|
Hi all,
iam working in vc++, i want to fetch the columns from a table.
CDatabase db;
CRecordset myset(&db);
myset.open(CRecordset::snapshot,"Select *from mytable");
this my code. Here error is
"No columns were bound prior to calling SQLFetchScroll/SQLExtendedFetch"
so what is it mean. Mytable contains 4 rows and two columns
how can i slove this problem...........
plz help me
|
|
|
|
|
I had this error before and I think I solved it by opening the recordset with the CRecordset::dynaset option:
myset.open(CRecordset::dynaset,"Select *from mytable");<br />
But I'm not sure anymore, so don't blame me if this doesn't work
|
|
|
|
|
Hello all,
I am using iocp in an application that routes frames between
clients.
However the threads in the iocp framework continue to exit (Return code: 0x0).
Can anyone throw any ideas of what can make them do this?
In advance thanks.
Michael Olsen
|
|
|
|
|
Difficult to say with such a level of info I have. But when I assume that you implemented the iocp correctly, it can be that you simply end the thread proc. somewhere - forgotten return, uncatched exception whatever like that
|
|
|
|
|
I am trying to show jpeg images in an ordinary dialog using visual c++ but
i am looking for help. Many thanx
Phil
|
|
|
|
|
jj921 wrote:
I am trying to show jpeg images in an ordinary dialog using visual c++
This link will Help :-
CEnBitmap[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
Please Check again!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi All
Can anyone plz give sample code for receiving call by using Tapi3.0 or higher.
Thanks
Nayan
|
|
|
|
|
I see this statement "#if(WINVER >= 0x0500)" in winuser.h . I am using WinXP still I cant use the definitions defined below it. What compiler settings do i need ?
|
|
|
|
|
|
You need to set the WINVER macro to a higer version. If you are using VC 6. the windows version is set to 0x0400. This is because MS thinks that you must know what platform you are targetting if you wan't to use functions that are not supported by previous versions of windows.
See here[^] for more information about windows versions and the marcos associated with it.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
so, I have an .exe-file on my USB-stick(I wrote this exe.-file myself). now I need a command for another application. this application has to search where is USB-stick (A: or C: or D: or F with my .exe-file. Because the location of it is different at all users. at me for example the location is F: , at my friend E: . and then this .exe-file must run automaticaly...
thank you
|
|
|
|
|
If the file is always in a constant location on the volume, you could just iterate through each volume, tack on the path and file, until you find it.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi !
I have created a menu on the fly. Now I want to catch messages when an item is selected from menu. How do i do it. I am doing it by catching WM_MENUCOMMAND but I get undeclared error. I defined it my cpp file with the value of 0x0126 which i checked in winuser.h . Still I dont catch any msg.
Can some1 explain me the mechanism and why do i I get this compile error when I use WM_MENUCOMMAND while on the other hand WM_COMMAND or WM_MENUSELECT can be used without any prob. ?
Regards
|
|
|
|
|