|
|
Thanks for the response.
Unfortunately, this is not exactly what I am looking for. I would like to be able to use the control in a a formview, along with other controls. Particularly, I would like to have a CListCtrl such that when you click on an element, it adds a corresponding tab to the tab control (if one is not already there).
If you can think of any such controls, please let me know.
Thanks,
-----------------
Genaro
|
|
|
|
|
Thanks
modified 28-Sep-16 7:25am.
|
|
|
|
|
Oliver Shikaloski wrote: I think ShellExecute() can help,but I don't know how to implement it.
Just use the "print" verb.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Hello..
Actually, am working with Serial port interfacing(MFC) in WIN32. Iam using some library which i found while browsing, actually i need to have the output data in Hex but it is in BYTES, so my problem is, how to convert the data which is in BYTES to Hex.
srija
|
|
|
|
|
by converting, you mean printing or storing ?
hexadecimal is only a representation issue. bytes are stored as bits and can be see as 2 hex characters, but this doesn't affect the handling...
what do you want exactly ?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.24][3.0 soon...]
|
|
|
|
|
Thank you for your kind reply!
Actually i need to store data as 02 00 01 00 31 15 12..., but how to write the data in Bytes?
Hope you got my problem.
|
|
|
|
|
|
Ya, i need it in a string!!!!
|
|
|
|
|
|
In C(++) use the standard formatting:
char szTarget[128]; // (or any size you need)
sprintf (szTarget,"%.2x %.2x %.2x.......", Byte1, Byte2, Byte3, ......);
or
CString strTarget;
strTarget.Format ("%.2x %.2x %.2x.......", Byte1, Byte2, Byte3, ......);
Success,
William
|
|
|
|
|
|
I am a little confused on what you are trying to do. I assume the data is binary and you want to send strings of hex codes instead? Like this
<br />
0A 2F 3C 2B FC
If so loop through the bytes and output them with string.Format("%02X",onebyte);
John
-- modified at 10:17 Monday 20th February, 2006
|
|
|
|
|
I'm trying to update the VCF calls to draw various themes elements to using the XP theme API's. In doing so I am having problems with two of the API's that *supposedly* return some sort of size information for a particular element. Namely GetThemeMetric and GetThemePartSize.
What I'd like to do is determine the height (or width for a vertial trackbar) of a horizontal trackbar for the little "inset" or "groove" that the thumb part slides over. And apparently this juct can't be done using GetThemeMetric/GetThemePartSize/GetThemeInt etc, as it consistenly returns an hresult error of "Element not found".
I need to determine this because there doesn't *appear* to be a way to draw this correctly without knowing the part size ahead of time, because if you just call DrawThemeBackground and pass in the rect for the control, it fills the whole rect for the slider track - it doesn't draw it the right size for you.
Has anyone else tried this? Is there some other way, other than just hardcodng a value of 2 to 3 pixels (since that's about what it is).
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
How can a service tell if the system is rebooting or shutting down and powering down? there appears to be only one control code for both occurances.
Are there any entries in the registry?
Or any other way?
|
|
|
|
|
It's been a long time since I did any real work with Windows Services but after a quick check with MSDN your services event handler *should* receive a SERVICE_CONTROL_SHUTDOWN event when the system is being shutdown / rebooted.
For more information check out the HandlerEx[^] documentation.
Gavin Taylor
w: http://www.gavspace.com
-- modified at 12:04 Monday 20th February, 2006
|
|
|
|
|
Sorry, just re-read your question, if your looking for a way to differentiate between shutdown events your out of luck - it's 'by design'
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
are they not the same thing ?
a shut down is a reboot with a long delay before start up.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Not if you are deciding whether to shut down the UPS or not !!!
|
|
|
|
|
<sarcasm>
I think you need to trap the WM_POWER_BUTTON_PUSHED message and handle that instead.
</sarcasm>
This sounds a bit like a chicken/egg thing. On startup, does the service actually try to start-up the UPS? Can the service distinguish whether the PC is running off the main or battery?
Chris Meech
I am Canadian. [heard in a local bar]
When I want privacy, I'll close the bathroom door. [Stan Shannon]
BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
-- modified at 15:26 Monday 20th February, 2006
|
|
|
|
|
The senario we have is that at the end of the day the power for our labs are turned off. This is for safety reasons. However the PC are protected by UPSs. If someone shuts down their PC, but forgets to switch off the UPS then the alarm goes off!!! Yours truly then spends the next few minutes trying to find which UPS is still switched on.
The solution is to write a service that schedules the UPS to power down as it is told that Windows is shutting down. The UPS doesn't power down immediately. Instead you instruct the UPS firmware to shut down after a timeout.
The problem is that the service will get the same notification if the user asks the PC to reboot. The result is that midway through the boot up sequence the power disappears. Unfortunately the UPS shutdown can not be aborted.
Chris Meech wrote: On startup, does the service actually try to start-up the UPS?
Starting up the PC is not too much of a problem because the UPS auto starts when the AC is applied and the PC has its BIOS set to auto boot the PC.
Chris Meech wrote: Can the service distinguish whether the PC is running off the main or battery?
<smugness>
Yes it can. It interrogates it though its HID interface.
Chris Meech wrote: I think you need to trap the WM_POWER_BUTTON_PUSHED message and handle that instead.
It's called WM_ENDSESSION, but services don't receive Windows messages. Instead they receive control codes. Both the control code and the Windows message give no indication as to whether the PC is about to reboot.
What I was hoping was that there was some way that Windows could tell you that the PC was going to reboot and would therefore need some power. Be it a system call or a registry entry.
|
|
|
|
|
Is each PC on it's own UPS?
Chris Meech
I am Canadian. [heard in a local bar]
When I want privacy, I'll close the bathroom door. [Stan Shannon]
BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Chris Meech wrote: Is each PC on it's own UPS?
Yes, otherwise one PC shutting down would kill the power of any other PC connected to the UPS.
|
|
|
|
|
My ex-colleague and friend ask me for a implementation of itoa. He's preparing for an interview. I don't how it seems to you, but the company here tend to ask questions like that a lot. Well, I'm not prepare for it too, so I ask for google as usual. Although Its a little function, but I'm not gonna let the chance of study slip away!
char* itoa(long n, int base)
{
register char *p;
register int minus;
static char buf[36];
p = &buf[36];
*--p = '\0';
if (n < 0)
{
minus = 1;
n = -n;
}
else
minus = 0;
if (n == 0)
*--p = '0';
else
while (n > 0)
{
*--p = "0123456789abcdef"[n % base];
n /= base;
}
if (minus)
*--p = '-';
return p;
}
After a little study, I figured I know how it was implemented. But there's some thing I'm not sure I right about or why it was implementated the way it is.
First the statement
*--p = "0123456789abcdef"[n % base]; seems strange enough to me at the first glance, but I learned from the book that
"0123456789abcdef" is called "Character array literals", and "...the result of the quoted character array is its starting address in memory....". So add a array element reference operation behind it is same as reference that element at certain index.Is my interpretation right?
Second, why
static char buf[36]; , why not
static char buf[46] or
[56]; ?
|
|
|
|
|
LiYS wrote: static char buf[36];
its static because it is returning the pointer to that array, so it should be not be a local variable allocated on the stack.
Why 36? i feel its a safe enough buffer to store number of digits that the long could have.
-Prakash
|
|
|
|