|
You have to get a handle to the driver that is supplied with the USB device (using CreateFile). Then you can communicate with the driver using WriteFile and ReadFile. For more advanced stuff, you can then use DeviceIOControl. Anyway, all of that should be documented with the device. You also need to have the device driver.
|
|
|
|
|
Firstly I have not the control codes for the device. I am understanding that I should want the control codes from the producer company?
And If I know the contol code how can I use it?
|
|
|
|
|
Where did you get this device from ? I guess you should have received some documentation with it. Did you take a look at it ?
|
|
|
|
|
iayd wrote: And If I know the contol code how can I use it?
No information about the device = use it a paperweight, depending on how pretty it is.
I've had to deal with some odd devices in my time, and most supplier companies are quite good at emailling you the obsolete device pdfs if you ask politely and give them some time. After all, you're not spending money with them at the moment... That's already happened.
Or get numbers off it, and google it. You'd be surprised just how much info on odd wacky stuff is floating about out there.
Once you have the information, you may even get a COM object that does the work for you, or you'll need WriteFile / ReadFile / DeviceIOControl to talk directly to the driver.
Iain.
-- Edited once I reread original post!
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hi all,
How can I differentiate between SATA and IDE/ATA hard drive.
I have more than one hard drive attached to my machine, Now I have to code in VC++ by which it can be recognize that this is SATA hard drive and this is IDE/ATA.
I am thrying to get it by using Win32_diskdrive WMI class. There is one property "InterfaceType" that is returning IDE for both hard drive, while I have one SATA and one ATA/IDE.
Is there any other WMI class by which it can be recognized?
thanks.
|
|
|
|
|
I there
I' new into dynamic programming and i have to write some code using OpenCV lib.
I did my job until now, but my software doesn't reuse memory. My application use 4mb/sec from my RAM.
How to check what part of my code consume so much memory?
I'm using VS 2005 and my application is written in VC++ with OpenCV
Edit/Delete Message
|
|
|
|
|
If you want to find leak memory on your project see Visual Leak Detector[^] if else more info is helpfuls.
|
|
|
|
|
I want to know how to detect object presence in a scene.Will the opencv functions edge detection and square detection do it?
|
|
|
|
|
|
Sir,
I have tried with the code.But i get an error message as
"fatal error C1083: Cannot open include file: 'cvaux.h': No such file or directory"
Please do help me in doing the code.ie,how to arrange all the files..
|
|
|
|
|
Have you included the # include and the file with "Add to project" ?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
I have added all the files using "Add to Project".
It shows an error "missing file dshow.h"
"see previous definition of '_WIN32_WINDOWS'"
|
|
|
|
|
Hello,
I have an windows application that has been working for about a year.
It consists of an application that uses dlls to provide localized langauge support. Each dll simply contains the dialogs used in the main app but with the text translated. They also contain the resource.h file.
I have recently made some updates to the main app which have required new buttons and text on the dialogs. The same changes have been made to the dialogs in the dlls.
When I run the app and select an alternate language the appropriate dll is loaded. However a call to GetDlgItem fails because it cannot find the Resource ID listed as it's argument. I know this ID exists, and in fact have placed the offending code within #ifdef just to prove that the symbol is indeed defined.
The same resource ID names are used in both the main app and the dlls.
When using the mains apps dialogs (english) all is fine, but when using the dialogs loaded from the dll a NULL pointer is returned by GetDlgItem.
The call to getDlgItem is not new and has been working fine until now.
Can anyone offer any insight?
The code is listed below. Originally I had this all on one line as per the line commented out. However I have expanded to debug.
Cheers
Rich
Static* pItem;
#ifdef IDC_STATIC_OTHER_CURR
pItem= (CStatic*) GetDlgItem(IDC_STATIC_OTHER_CURR);
if(pItem == NULL)
{
}
else
{
pItem->GetWindowPlacement(&wpa);
}
#endif
|
|
|
|
|
kildareflare wrote: The same resource ID names are used in both the main app and the dlls.
Can you check ,although the ID names (MACROS) are same, the values of the IDs are same. I mean IDC_STATIC_OTHER_CURR in exe may be 100 while in dll it may be 200.
|
|
|
|
|
Hi Rajkumar
Yes it has the same ID number in both and the name is identical too.
Rich
|
|
|
|
|
The actual location of the failure is in the function below
BOOL CWnd::GetWindowPlacement(WINDOWPLACEMENT* lpwndpl) const
{
ASSERT(::IsWindow(m_hWnd));
lpwndpl->length = sizeof(WINDOWPLACEMENT);
return ::GetWindowPlacement(m_hWnd, lpwndpl);
}
It fails at the ASSERT becuase m_hWnd cannot be evaluated
"unused CXX0030: Error: expression cannot be evaluated"
the following function call precedes the one above (see original post):
CWnd* CWnd::GetDlgItem(int nID) const
{
ASSERT(::IsWindow(m_hWnd));
if (m_pCtrlCont == NULL)
return CWnd::FromHandle(::GetDlgItem(m_hWnd, nID));
else
return m_pCtrlCont->GetDlgItem(nID);
}
In this case m_hWnd does have a value, so it's somehow lost between the two calls...? Like I say this has allways worked fine until now...
Rich
|
|
|
|
|
kildareflare wrote: In this case m_hWnd does have a value, so it's somehow lost between the two calls...?
no, GetDlgItem is called for your dialog (Parent) window, while GetWindowPlacement is called for the expected child window (static control) so m_hWnd is different and unique.
|
|
|
|
|
kildareflare wrote:
pItem= (CStatic*) GetDlgItem(IDC_STATIC_OTHER_CURR);
can you try get what is the error by,
::GetDlgItem(GetSafeHwnd(), IDC_STATIC_OTHER_CURR);
dwErr = ::GetLastError(void);
can you ensure whether the dialog resource is successfully loaded from dll, did you successfully displayed the dialog, from the next post of you, it seems the m_hWnd handle is not valid, means the dialog may be not successfully created from resource of dll, can you post how you create the dialog from dll resource. at which method of dialog class you are calling the GetDlgItem() function.
|
|
|
|
|
Error 1421 "Control ID not found" is the error reported.
The dll is loaded as follows:
if((CString)langID == LANGUAGE_SPANISH)
{
hInst = AfxLoadLibrary(_T("CalcESP.dll"));
if(hInst == NULL)
AfxMessageBox("Could not load CalcESP.dll");
}
AfxSetResourceHandle(hInst);
The handle hInst is valid and I belive the resource is loaded OK as some of the resource IDs are found OK - it's just some that are not. Is there a more precise way I can check what has been loaded?
To be honest I do not know dlls that well, however...
The appropriate dll is loaded in the applications InitInstance() function as shown above and then the handle retuned is used to set the default resouce location. Next views are created from doc templates and then the main MDI Frame window is created.
All dialogs are created using standard constructors - im assuming that they will use the default resource which has been set above.
The application would run and the dialogs load if I managed to comment out all the IDs that were "not found".
If I force the application to use the english hInst then everything works OK, as would be expected since this is the same as not changing the language.
However, if instead I copy the engligh dialog and resource.h file over the spanish ones - it has the same problem - even though it is now using the english resources which I know work OK and this is surely the same thing as forcing the application to use the english resouce path i.e hInst...?
Thanks again
Rich
modified on Tuesday, May 13, 2008 8:49 AM
|
|
|
|
|
kildareflare wrote: Is there a more precise way I can check what has been loaded?
see Iain clarke's reply below to use spy++, spy++ is a tool comes with visual studio tools you can get the window properties like control ID and verify the values using easy to use window finder tool.
|
|
|
|
|
In addition to the other suggestions, the NO_FAIL_CREATE style for a dialog is very useful. Then with a lot of commenting out, you can show the dialog, and (a) see if the static control is even there, and (b) using spy++ see if the ctrl id is the one you expect.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hi Guys,
I was aware of Spy did not think it would be much use wihtout a window, thanks for the no fail create tip though as that takes care of that.
After considerable commenting out I now have the app up and running.
using spy I can see that virtually all the static controls have an ID of
FFFFFFFF (Chris Waddle ). On this particular dialog, all bar one of the static controls have this ID. All the Edit and button controls have sensible IDs that match the resource file.
So any ideas why they should all be FFFFFFFF?
Out of interest I just ran the default version of the app that has no problems to see what the IDs were listed as there. The majority of the static controls have sensible IDs however one or two were as above, FFFFFFFF, but in this case they caused no problems....
Rich
modified on Tuesday, May 13, 2008 9:24 AM
|
|
|
|
|
kildareflare wrote: So any ideas why they should all be FFFFFFFF?
FFFFFFFF -> -1 -> IDS_STATIC. Your dialog editor will use this by default for static controls, as they don't in general need an ID code. They're just lumps of text plonked on your dialog.
If you want to do something useful with them, then you'd need to add control with a UNIQUE (to that box!) ID so you can use the GetDlgItem function to turn the ID into a HWND/CWnd.
The IDE's dialog editor will complain about any non-unique id except for -1 (said with no actual testing done) which is why it is used.
So, now you know the issue, you can start putting "I'm spanish!" into your dialog boxes to makee sure you're loading the correct ones, and go through them checking that you have assigned IDs properly.
Straightforward, but not speedy work.
Iain.
ps, love the fast show reference, though I usually follow it by "Scorchio!" in my head.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Buone Estente ;0)
hehe - though it might be a long shot but could no resist.
Thanks for that Iain. Im a bit confused though. All these IDs that are being listed as FFFFFFFF do actually have unique IDs. I move all lot of them around depending on what "view" the user is currenlty using E.g. advanced/basic.
E.g. in all dialog versions (English, Spanish,...) there is a control called IDC_STATIC_OTHER_CURR with an ID 1464. So it's not generic and so the call to getDlgItem() should not fail, no?
In fact it's currently on these lines that it is failing. With reference to my original post, if I hover the ID that is the argument to GetDlgItem() then it's correct ID is displayed (E.g. 1464 or such). If it "knows" enough to know the ID has a value then I find it a bit baffling that it can't find it. Im also quite surprised to see them listed as generic FFFFFFFF's using spy.
modified on Tuesday, May 13, 2008 10:26 AM
|
|
|
|
|
No, I'm not espanol - just picking on one of them funny furrin' made up languages that those funny people who live elsewhere pretend they use, so they don;t have to listen to english, even when I use it slowly and LOUDLY.
I'd trust spy++ myself though.
Have you tried looking at the raw resource code, rather than using the pretty editor? Just use file, open, pick a resource file, and tell it its type is text.
Then change an ID or two to actual numbers, rather than IDC_BLAH.
I also meant it about putting some silly unique thing in each dialog, so you know which one that is actually being used.
It may also be that your static control has ended up with a text id, rather than numeric, but I'd have to go digging to find a decent example. That's why I'm suggesting you use an actual number for this test, to narrow things down.
Good luck - you have a fiddly problem.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|