|
I m sorry;Getipaddress is used for IP Address;also we can retrieve the Motherboard number.
|
|
|
|
|
I like to clear my problem with explanation.
EX:If i used the Usb Drive(pen Drive)to my computer system; I want to extract the Serial Number or any Internal information from the memory of the USB.
If u have any idea plz tell me.
|
|
|
|
|
Ah, okay.
Despite working for a harddisk manufacturer I've never dug around in USB. If you're using Windows then http://www.emmet-gray.com/Articles/USB_SerialNumbers.htm[^] seems to have all the recipes you'd need to grab the serial number from a USB 2.0 device. One problem is that the code is written in VB, but it gives the sequence of Win32 calls you'd need to make to get the information (and it's a bit convoluted - hopefully someone more in the know can point you at a simpler method).
If you're using another OS then there's probably a similar recipe out there somewhere.
Another alternative would be to write a device driver and tickle the device directly through it's I/O ports and see how it giggles. However you'll need to know more than most mortals should need to know about USB - and having seen a colleague of mine go bald reading the OHCI, UHCI and EHCI specs I wouldn't wish that on anyone.
Cheers,
Ash
PS: Perhaps posting another question with "Reading configuration data (e.g. serial number) from a USB device" might attract someone who knows what they're talking about.
|
|
|
|
|
Thanks for this response;
But actually have an other Electronics device Ms-DOS based, Please clerify how to retrieve the information any system which can communicate with Computer System.
|
|
|
|
|
I'm not sure what you mean by a device being MS-DOS based.
If you can expand that a bit I might be able to point you somewhere to help.
Cheers,
Ash
|
|
|
|
|
Hi,
ok ,I have an CMRI is an Energy Meter Reading Device; I want to know the serial no. of CMRI;which is unique & provided by the manufacturer.
CMRI is Ms-Dos based device. PLz help me
|
|
|
|
|
kushMuchaal wrote: CMRI is Ms-Dos based device.
Please explain what is meant by MS-DOS based device - this makes no sense.
It's time for a new signature.
|
|
|
|
|
Seems to me that the manufacturer of the device would have provided such with their API.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Just done a bit of digging...
Okay, looks like CRMI devices are used to read 'leccy and gas meters. They seem to have RS232 or USB interfaces on them and usually come with a suite of tools through which you can connect the CRMI to a host computer. These CRMI things seem to run something that looks like PC-DOS or MS-DOS but that's a complete red herring, it has no bearing on getting data off the device.
Now if the device has a USB port and follows the USB 2.0 specification then the link I dropped in an earlier post will show you the sequence of function calls you need to make to get the device's serial number. From what I've read the USB capable ones are just USB mass storage devices and look like any other disk drive when they plug in. If you want the data on the device you can then just use ordinary C standard library function calls to open the files on it.
Cheers,
Ash
|
|
|
|
|
I do not think you can access the registers directly in C (in C++ use the __asm keyword). However, even if you could address them their content will be meaningless beyond containing a few variables local to your function.
Perhaps you could clarify what you are trying to achieve.
It's time for a new signature.
|
|
|
|
|
I like clear my problem with explanation.
EX:If i used the Usb Drive(pen Drive)to my computer system; I want to extract the Serial Number or any Internal information from the memory of the USB.
If u have any idea plz tell me.
|
|
|
|
|
Hi,I want to draw one line in left side of editbox in dialog,the color will vary depends on the value in editbox.
So im getting the size of the editbox in OnInitDialog() like this.
GetDlgItem(IDC_SPVALUE)->GetWindowRect(&SPclrrect);
Im drawing line in OnPaint()
CPen SPClr;
SPClr.CreatePen(PS_SOLID,4,RGB(255,0,0));
pDC->SelectObject(&SPClr);
pDC->MoveTo(SPclrrect.left-7,SPclrrect.top);
pDC->LineTo(SPclrrect.left-7,SPclrrect.bottom);
But it doesnot draw on the exact place,it draws very below edit control.
SPclrrect shows
bottom-414
left-44
right-131
top-394
But when i give this manual value it exactly draw in right place
pDC->MoveTo(37,345);
pDC->LineTo(37,362);
Then why SPclrrect returns wrong value.
Any other way to do this work?
Anu
|
|
|
|
|
My Question do you want to line to appear inside CEdit Control or outside edit control?
If inside, you have to overide CEdit OnPaint function
if outside, you ClientToScreen or ScreenToClient function to get exact location of point
"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
|
|
|
|
|
I use ScreenToClient().It works.
Thank you so much.
Anu
|
|
|
|
|
Shameless plug: Please vote for answer
"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
|
|
|
|
|
Dear all,
I want to develop a service (that is written by unmanaged C++) in Win7.
This service can detect status of UPS, example: low battery, out of electric, etc..
It connect with UPS by RS232C cable through COM port.
I google and find some funtions: GetCommState, SetCommState, GetCommModemStatus but don't know how to use it to check status of UPS (low battery, out of electric, ...)
Pls. help me to solve it .
Thanks a lot.
Ratkit!
|
|
|
|
|
You havnt said what you want to DO with the UPS status once you've found it - lets assume you wish to write it to the Windows Event Log for start..
I would appoach it in a number of 'phases', not knowing what experience you have
1) build a console mode program capable of writing application events to the event log
2) use something like Serial library for C++[^] in a console mode program to be able to read the UPS data from the serial port - somewhere in the specs for the UPS it will tell you how to interpret the data to give you the status
3) then write a service, make sure you can do the normal things - start, stop, use the knowledge gained from (1) to write an event to the log on a timed basis - eg, every 5 minutes
4) once youve gotten here, you then re-do the service to use the knowledge gained in step 2, to determine and log the UPS status to the event log
Once your service is up and running, you can expand the logging event to (for example) send an email if the UPS needs attention, or (for example) add a system-tray applet and change the colour of it to red
'g'
|
|
|
|
|
Check out the Win32_UninterruptiblePowerSupply WMI class.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
According to the documentation on Win32_UninterruptiblePowerSupply: "Beginning with Windows Vista, this class is obsolete and not available because the UPS service is no longer available."
http://msdn.microsoft.com/en-us/library/aa394503(VS.85).aspx
Can you suggest another way to help me solve it?
|
|
|
|
|
In addition to what David said, you can call GetSystemPowerStatus() to get that information.
|
|
|
|
|
Hi,
I have noticed a problem in windows programming that I am unable to solve. I have created a new thread which should run as a separate process. In this thread I continually update a counter so that I Can visually see if and when my thread is interrupted.
If I put a CComboBox control on my dialog my thread is momentarily interrupted when the CComboBox is clicked and the list drops down.
I have tried creating my thread with realtime priority and the combobox still interrupts my thread when dropped down. Obviously the dropping down of the combobox does not interrupt other applications that are running in separate processes so I do not understand why it would interrupt my thread.
<br />
unsigned threadID;<br />
HANDLE hThread = (HANDLE)_beginthreadex( NULL, 0, &UpdateThread, (void*)this, 0, &threadID );<br />
SetPriorityClass(hThread, HIGH_PRIORITY_CLASS);<br />
SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);<br />
How can I create a thread that will not be interrupted by the dropping down of the combobox?
Thanks,
Greg
|
|
|
|
|
I would start looking at how the threaded procedure is communicating with the dialog
There are a number of good articles around on comms between a dialog and a worker thread - Im almost tempted to point you here http://www.flounder.com/workerthreads.htm[^]
'g'
|
|
|
|
|
I using PostMessage to send a user defined message on the main GUI thread which then calls SetWindowText on the static control that I am using for a counter. From what I have read this is the only safe way to update the GUI From a separate thread. I am still lost on why the dropping down of the combo box would interrupt the drawing of my counter control.
|
|
|
|
|
Greg Ellis wrote: I have created a new thread which should run as a separate process.
What does this mean? Is it a thread in the same process or a separate process?
How does the thread report its progress exactly?
Steve
|
|
|
|
|
R u trying to update the counter in dialog and viewing? if drow down box painter u can see some delay in the counter updation in dialog.
|
|
|
|