|
Yes - I am starting to see the problem.
The USB devices are layered on top of the Root USB device. They won't appear in the list the sample retrieves.
I think in general the idea is that you know the name of the device you want to work with, and use the USBD_ fns or the IoBuildDeviceIoControlRequest call with the IOCTL_INTERNAL_USB_SUBMIT_URB type to get things going, and somehow identify the instance handle as a Device Extension to the USB device object.
As I google and grep one eyeball is making a concerted effort to crawl into the other socket - I realize now that we're dealing with more difficult stuff than I thought, and I hate posting msgs when I just _know_ I'm dealing with forces I cannot possibly comprehend.
But...
One thing you might find helpful on W2K is an examination of the keys in HKLM\SYSTEM\CurrentControlSet\Enum\USB. This should contain some sort of string for the printer driver - maybe something that can be used as the Enumerator param for SetupDiGetClassDevs - do the USB devs classify as PnP? (?).
I just don't see a generic USB device enumeration procedure, although some sort of use of UsbBuildGetDescriptorRequest might be able to do it.
Looks like working with USB devices is worth a book on its own - the WDM book I mentioned devotes a chapter to it, but at my rate I won't get there till... lets see... the time_t bug rears its ugly head...
|
|
|
|
|
For someone who says he doesn't know much you sure know a lot more about this stuff than me! Thank you for your very helpful tips.
The whole device/driver architecture/interface from MS is absolutely shocking. I have spent THREE whole days trying to do something which is trivial (send a "keep alive" null message every 5 minutes to a USB POS printer, an insignificant task for LPT1: or PRN: ) and I'm still scratching my head. But I did manage to answer the original question about SetupDiEnumDeviceInterfaces() parameters.
To help others struggling with this stuff, the "Pointer to a GUID that specifies the device interface class for the requested interface" mentioned in the ISDN, can be found in HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses. MS does not want us to access these directly but I have found no other way.
NOTE that there are a set of GUIDS which are the SETUP classes and are given in devguid.h. They won't work with this call but can be used in SetupDiGetClassDevs etc. as selectors for restricting the device data.
I am going to use IOCTL as per your suggestion. Who knows! In another ten years or so I might even understand all this.
|
|
|
|
|
Cool. I have printer off a copy of your reply which I hope I will understand someday.
Maybe you could resurrect this thread when you get things going - I'd be interested - my post was more of a 'well maybe its got something to do with' attempt than anything else.
Glad it helped! What a neat site.
|
|
|
|
|
I have solved my original problem. I will post a solution as a new thread because it has some very interesting implications for direct access to devices. As I suspected, the solution is grotesque but works very well.
|
|
|
|
|
Data persistence using the serialization mechanism provided by MFC is a very simple way of storing the data of a program. However, what happens if we don't want to use MFC!?? Does another mechanism exist that is just as easy to use?
My problem is that I am writing a program that will need to be used cross-platform and -OS, and so I am trying to get away from being too reliant on MFC (no matter how hard that may be making my life! )
I suppose what I am asking is either this:
1) Has anyone else came up with an easy way to do this? Or (a more likely scenario...)
2) Has anyone got any information on how MFC actually serializes the data streams to file? What steps does it take to achieve this? And similarly, when reading the data back in.
Any help would be greatly appreciated!
Cheers!
Baz
Baz
|
|
|
|
|
You need IOStreams. They work pretty much the same way, you can write IOStream handlers for any type and the whole thing is cross platform.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Hi,
I'm trying to dynamically add/remove buttons in a toolbar, and have used the AddButtons(...) function to do so. I need to process the toolbar messages by value (ie, call another function based on the value of the toolbar button) so I have overridden the OnCommand(...) function in the MainFrame. If I do it this way instead of adding a command handler for the message, I can never un-gray the toolbar button. I'm obviously overlooking something here... can someone help me out? Its very urgent!
Thanks a lot.
Jojo!
|
|
|
|
|
If your SDI program has not command message handler for menu/toolbar item, it remains disabled (Microsoft beleives this is better for us). To enable item you need to write it's ON_COMMAND handle or enable it in ON_UPDATE_COMMAND_UI handle.
|
|
|
|
|
I think this will work:
If you add any function (like paste,undo and..) with class wizard you'll see
some codes add to your MESSAGE_MAP and header file ,you do the same for your dynamic toolbar then it'll ungray
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Thanks for the replies guys. Maybe I didnt make it very clear in the original posting... but I have, say an array of max 256 buttons... and all of these are handled as such
OnCommand(...)
{
if (wParam >= ID_TOOLBAR_BTN_START && wParam <= ID_TOOLBAR_BTN_STOP)
{
DoSomething(wParam - ID_TOOLBAR_BTN_START);
}
OnCommand(...)
}
I dont think it'd be very good to add so many handlers to the window. My question is, is there any way to disable MFC's default behavior of disabling buttons if there is no handler. If someone could help me out, i'd be very very grateful.
thanks,
Jojo!
|
|
|
|
|
MFC Hell;)
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Are you maybe looking for ON_COMMAND_RANGE ?
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
Thank you very much Fredrik. That was EXACTLY what I was looking for.
Cheers,
Jojo!
|
|
|
|
|
Hi there
I had my Application running in system tray .
to Activate the Aplication i have to double Click on it .
can any body tell me , How can i Assign a hotkey , such that Just Pressing that Key , my application should get Acivated .
If any code is avalable ,please let me know .
Please let me know
My email is kanojia@infinit-esolutions.com
|
|
|
|
|
I think it sounds like keyboard hooks.
Look in the DLL section here on CP how doing that.
Because, you want your program to be shown/activated when pressing F9 or 'H' or just something...
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
But consider carefully before using a hook to do this. A hook would mean that every keyboard message would be screened by your function. This would be pretty slow, for not much gain.
Personally I wouldn't do this... Perhaps there is another way to implement what you need?
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I'm doint an app that uses my e-mail passwords and login. I want to save these data into the registry but how to make the string that contains the password to be unvisible.
I don't want to write the password directly to the registry, pretty unsafely!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
If you want to be on the safe side, use wellknown cryptography (CryptoAPI or any available Crypto Library). See MSDN for samples.
But for your stated purpose, I suppose something simple would do it too.
I will post the next days a string class for simple and fast "crypt" which would fit this purpose well.
cheers
Andreas
PS: I see that you changed your signature style again. Did CG not approve the design?
|
|
|
|
|
DAMN thank you!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
One old way:
You can decode to binary with a string key.To tell the truth I don't know the name of function that do this,but there are some article in CP abuot that in "Programming Tips" part
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
GREETINGS
Please, could you help me with the network and CryptoAPI?
I neet to make a program that scans all hard drives in the local network. How to access the drives int the net? And how to find other comps?
And about CryptoApi. If you have any sources of encrypting/decrypting, please could you send it to me? SAV@Altavista.com
Many thanks!
May the LOVE enter your heart and the PEACE enter your soul.
LOVE & PEACE to everyone
|
|
|
|
|
SAV wrote:
I neet to make a program that scans all hard drives in the local network. How to access the drives int the net? And how to find other comps?
To find other computers take a look at the WNetEnumResource() function, it includes a starting sample. Or you might consider using ADSI (Active Directory Service Interfaces) ?
And as for accessing drives on the net - this is a tough issue. There are many problems involved. But basically you can access any drive on any machine by using UNC paths \\machinename\drivespec. Although in 90% of all cases in proper configured networks this wont suffice.
SAV wrote:
And about CryptoApi. If you have any sources of encrypting/decrypting, please could you send it to me?
Again, the MSDN contains some working samples for this too.
cheers
Andreas
|
|
|
|
|
Hi,
4 DLL's of a large project I'm on have a 8MB+ .bss section, and I'm lost at tracking it back to the cause. Other similar DLL's don't have this, but the affected DLL's make heavy use of some templated library.
excerpt from MAP file:
0003:000001c0 00003560H .data DATA
0003:00003720 008006a4H .bss DATA
0004:00000000 00000cc4H .rsrc$01 DATA
...
0003:00003bf4 ?secAttrDefault@CCRegKey@@2PAU_SECURITY_ATTRIBUTES@@A 004adbf4 cxlibatl:cxRegKey.obj
0003:00803d08 ?_Nilrefs@?$_Tree@VCString@@U?$pair@$$CBVCString@@M@std@@U_Kfn@?$map@VCString@@MU?$less@VCString@@@std@@V?$allocator@M@3@@3@U?$less@VCString@@@3@V?$allocator@M@3@@std@@1IA
00cadd08 FWorkLib:DlgConflict.obj
the secAttrDefault is declared:
class CCRegKey
{
static LPSECURITYATTRIBUTES secAttrDefault;
};
LPSECURITYATTRIBUTES CCRegKey::secAttrDefault;
(and it's unlikely that this is the cause as is, since the class is used in other dll's as well....)
the _NilRefs thing seems to be a map<cstring,???>::allocator member; where CString is a MFC ripoff for use with ATL...
Any ideas where this can come from?
--------------------
don't be surprised if you see this Q in other places as well, yes, it's me...
|
|
|
|
|
Hi everyone. I have a webbrowser2 control on a dialog, with which I am using it to show an html document (a report) my program creates.
I want to stop the control from displaying the properties menu when the user right clicks on it. I found a question someone asked previously about doing this, but I am still not quite sure how to do this. What should I override to do this, and how?
Also, I am using a control bar toolbar of my own on the dialog, and I want to activate the button when the user highlights text, and deactive the button when there is no highlighted text (so the user can copy the text to the clipboard, of course they could hit ctrl-c to copy, but I want to give the user a queue that they can copy off the report to the clipboard). Is there an OnHighlightText type message that does not appear in ClassWizard?
Thanks in advance for any help!
|
|
|
|
|
John Clump wrote:
I want to stop the control from displaying the properties menu when the user right clicks on it. I found a question someone asked previously about doing this, but I am still not quite sure how to do this. What should I override to do this, and how?
If all you want to do is disable the menu and not change it thats easy
IDocHostUIHandler::ShowContextMenu and return S_OK
HTH
Laterz!!!;P
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|