|
What does the documentation say about the format of this value? Your original sample code stated that it is an INT8 , but you are displaying it as (a very small) floating point number.
Use the best guess
|
|
|
|
|
hello Friends
I am accessing USB Devices through SetupDiCalls. I am able to get USb printers'Device Path to communicate with them and its working fine. I want to know that How can I access their name also using SetuDiCalls so that I can differentiate between USB Printer Devices to with whom I have to communicate.
I tried EnumPrinters to get Printers name but that doesn't provide device Path for which we needed to pass to createFile fn for communication with USB Printer. And Nothing else I found common between ENumprinter returns or setupDicalls so that I will access from their.
Any Ideas ?
Thanks & Regards
Y
|
|
|
|
|
When already using Setup API functions, call one that accepts a pointer to a SP_DEVINFO_DATA structure (e.g. SetupDiGetDeviceInterfaceDetail() or SetupDiEnumDeviceInfo() ). Then call SetupDiGetDeviceRegistryProperty() passing the structure to get the SPDRP_FRIENDLYNAME property which contains the name as shown by Windows. If that fails, you can fallback to get the SPDRP_DEVICEDESC property.
|
|
|
|
|
Thanks For your Reply.
I tried Friendlyname,it is returning NULL. then I tried DeviceDesc , it is returning
"USB PRINTING SUPPORT " for each USB connected Printer.
I tried by passing SPDRP_MFG even, it is returning Microsoft.
Any other way to get name so, I can differentiate.
Thanks & Regards
Y
|
|
|
|
|
It seems that you have enumerated the generic Microsoft USB printing support devices. You should look up the specific printers instead which usually provide a friendly name. If that did not provide the device path, you must perform two enumerations and compare common data (e.g. the hardware ID).
|
|
|
|
|
Ahh, But I used Class ID
#define CLSID_STR_WEIUSB (L"{28D78FAD-5A12-11D1-AE5B-0000F803A8C2}") to get List of USB Printer Devices.
I tried one another too #define CLSID_STR_WEIUSB1 (L"{A5DCBF10-6530-11D2-901F-00C04FB951ED}")
but this one was not showing some of printers while Enumerating.
Give me some Idea.How can I look up specific printers only and their Friendlynames?
Regards
Y
|
|
|
|
|
Those IDs seem to belong to specific devices.
It is often difficult to get the proper GUID. See System-Defined Device Setup Classes[^] for a list of GUIDs. You may try the Printers GUID from that list and if that does not find all try also the USB Devices GUID.
|
|
|
|
|
I tried system Defined specific printer GUID and USB GUID too.
Printer = {4d36e979-e325-11ce-bfc1-08002be10318}
USB = {88BAE032-5A81-49f0-BC3D-A4FF138216D6}
but in this case it is not providing any device while enumerating.
Y
|
|
|
|
|
|
I am using it like this
#define CLSID_STR_WEIUSB1 (L"{A5DCBF10-6530-11D2-901F-00C04FB951ED}")
GUID DevClass;
CLSIDFromString(CLSID_STR_WEIUSB1, &DevClass);
SetupDiGetClassDevs(
&DevClass, NULL, NULL, DIGCF_DEVICEINTERFACE + DIGCF_PRESENT
|
|
|
|
|
I found another fn but I don't know it is useful or am I using it Wrong ?
SetupDiOpenDeviceInterfaceRegKey
Passing SP_DEVICE_INTERFACE_DATA DevNode which we Get from SetupDiEnumDeviceInterfaces
HKEY hKey = SetupDiOpenDeviceInterfaceRegKey(hDevInfoSet,&DevNode,0,KEY_READ);
RegQueryValueEx(hKey,_T("Port"),NULL,NULL,(LPBYTE)buf,&dwBufSize);
But When I tried buf is coming NULL always.
Is it Right way to find from resitry?
Regards
Y
|
|
|
|
|
The GUID you are using is GUID_DEVINTERFACE_USB_DEVICE[^]. You should use this or a similar name when not using the predefined one. Using this GUID, you are enumerating the raw USB devices which may not provide the user friendly name.
You also may have a look at the USBView sample application[^].
To check if there is any entry for your printers with the user friendly name, enumerate all devices (GUID NULL, DIGCF_ALLCLASSES ) and compare the hardware ID or other properties with those found enumerating the raw devices.
|
|
|
|
|
Look at handling plug an play in applications. The DDK has a ection on it, and it gives a lot of detail on device enumeration.
==============================
Nothing to say.
|
|
|
|
|
The following code returns isMatch true in VS 2008 not in VS 2010
CString strPattern = _T("(\\+|00)\\s*\\d{2}(\\s?\\d{3}){2}\\s?\\d{4}");
CString strValue = _T("0044 207 689 0000");
CT2CA pszFind(strPattern);
const std::tr1::regex pattern(pszFind ,std::tr1::regex_constants::nosubs | std::tr1::regex_constants::ECMAScript);
CT2CA pszData(strValue);
std::string strSearch(pszData);
isMatch = regex_search(strSearch.begin(), strSearch.end(), pattern);
Any idea why?
Thanks in advance
|
|
|
|
|
Hi,
I am working on a project in which I am using DirectShow to play audio and video files. I have used a volume button, the state of which indicates whether Audio is On/Off. On clicking this button, I want to mute the sound from the speakers while video file continue playing. Is there any method to do so.?
Your help will be appreciated.
Regards,
Mbatra
|
|
|
|
|
mbatra31 wrote: On clicking this button, I want to mute the sound from the speakers while video file continue playing. Is there any method to do so.?
waveOutSetVolume [^] window api
Edit....
David already answer that Here[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
modified 4-Jun-13 2:31am.
|
|
|
|
|
See here.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi,
I am working on a project program that have the popup progress bar with "continue" and "pause" buttons in the dialog. I have the problem to pause and to continue the progress. For example, when the progress dialog starts, the user click on the "pause" button, the progress bar must be paused until the "continue" button is pressed but I don't know how to pause the progress when the pause button is pressed and how to continue the progress bar when the continue button is pressed.
Any help will be appreciated.
Regards,
Mbatra
|
|
|
|
|
mbatra31 wrote: but I don't know how to pause the progress when the pause button is pressed and how to continue the progress bar when the continue button is pressed.
stop function which calling ProgressCtrl.StepIt() function!, during the time user pressed pause!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
Thanx for the reply. I have used ProgressCtrl.StepIt() function inside OnTimer() so that while playing the video, timer will increment and progress bar also steps up.
I Can't stop this one. Because In StopTimer function I have set the state of the timer and progress bar to zero.
Basically I am incrementing the Progress Bar along with the timer. When User Presses Pause button, both the progress bar as well as timer should stop at their current state. ANd when user presses play button Timer and progress bar should continue from their last stopped state.
I have used ProgressBarCtrl.SetState(PBST_PAUSED); function, this works and progress bar stops at its current state, but its not so smooth, when user presses play button, progress bar increments by not just 1 step, but 3 -4 steps. Also I am not able to stop the timer. it keeps on incrementing.
Please let me know your idea / suggestion to solve this.
Regards,
Mbatra
|
|
|
|
|
mbatra31 wrote: I Can't stop this one. Because In StopTimer function I have set the state of the timer and progress bar to zero.
you might need to decouple both! either create new functions like PauseTimer(BOOL bPause), that decision on stopping and starting of timer in that function, without actually modifying your timer or progressctrl state.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
I was able to Pause the progress Bar on clicking Pause btn and again start from the same position on Play button, But Still unable to do the same for Timer.
I am using this piece of code to get the current time elapsed and display the same in the static and also stop the timer at that point.
KillTimer(nVID);
m_VideoPlay = 0;
GetTime = CTime::GetCurrentTime();
CString t = GetTimeElapsed(GetTime);
mStaticElapsedTime.SetWindowTextW(t);
GetTimeElapsed
() function returns the time in CString format (00:00:00) to display in a static box.
KillTimer function not working here.
Regards,
Mbatra
|
|
|
|
|
mbatra31 wrote: m_VideoPlay = 0;
what is the role of above
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
this is the return value from SetTimer function.
m_VideoPlay = SetTimer(Event ID, 500, NULL);
Now I was able to stop the progress bar and the timer also, but how to start the timer from the same position when user clicks on play button.
Suppose if user has paused the video at 6 secs, then when the user clicks on the play button timer should start from 6 sec only.
Any idea about this scenario.
Regards,
Mbatra
|
|
|
|
|
mbatra31 wrote: Suppose if user has paused the video at 6 secs, then when the user clicks on the play button timer should start from 6 sec only.
which control are you using to display the video!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|