|
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
|
|
|
|
|
The maximum number of characters to display a long is 34,
so they have a safe side of 2 bytes
since a long is 4 byte the maximum characters that can be use is 34 to
display it in a textual form
4 bytes x 8 bits (base 2) is 32 chars
1 char for the ending '\0'
1 char for the minus
gives 34 chars
BTW: The code isn't error prone
codito ergo sum
|
|
|
|
|
Hi
I am using ExpandEnvironmentStrings() to find the path of pst files of MS Outlook, and passing the string "%USERPROFILE%\\Local Settings\\Application Data\\Microsoft\\Outlook\\*" to ExpandEnvironmentStrings().
Now I want toknow that this path \\Local Settings\\Application Data\\Microsoft\\Outlook\\ is same for all the languages of windows
Please suggest me.
Thanks
|
|
|
|
|
|
Hi,
Can anybody tell me, "Is Reg.dll functions are not supporting Unicode data?". I have got some keys that is in written in Pseudo language. I am able to see the key correctly in windows registry but when i try to read it gives me key with question marks and some un-readable output. What is the reason? Also do let me know in case anybody has solution meanwhile i am searching for some equivalent DLL on net.
Thank you for your time.
Nishith
|
|
|
|
|
i want to make an OCR application & extract text from an image.
i am trying the following approach.
1) i can convert an image to PDF.
2) i can extract text from PDF.
So, theoretically, perhaps OCR is possible this way- to convert image to PDF & then convert the PDF into text & do whatever search operations you have to.
http://www.altimate.ca/flash/ocrdsktp.htmshows the above approach.
However, i can extract text from any normal pdf, it is not happening with a pdf that has been generated from an image.What things may i be missing?
Kindly Guide.
Ankush Mehta
|
|
|
|
|
Simply because your image will be recognized as an image within the pdf file. So you cannot extract text from an image.
From the link you gave us, they probably do character recognition inside their program.
|
|
|
|
|
Hi,
I want to add ATL support to an MFC extension DLL in VC++.
You know that VC++ can add ATL support to regular DLLs but does not add this support to MFC extension DLLs.
Is there any way to add ATL support to MFC extension DLLs.
Should I convert the MFC extension DLL to a regular DLL first?
|
|
|
|
|
I am wondering about what's the best and easiest way to strip trailing whitespace from every single file in a folder, recursively.
I want to write a program/script so that you pass in a folder name and it'll recursively go through all sub-folders and strips trailing whitespace from every single file.
Trailing whitespace includes:
1. whitespaces at end of text lines, strip whitespace but retain text
2. whitespaces on empty lines, strip whitespace but leave the empty line
|
|
|
|