|
I assume that by 60 and 25, you mean the hex values 0x3c and 0x19.
If the byte stream arriving is ordered as 0x3c, 0x19, ..., and you want to interpret that as 0x3c19, then you have a big endian stream:
typedef unsigned char byte;
typedef unsigned short word;
const byte low = 0x19;
const byte high = 0x3c;
const word merged = (word(high) << 8) | low; However, since you want to store it as 6025 in Excel, I assume that you by that mean the string "6025". Otherwise you need to state your need better. To get "6025", you can do this:
const char buffer[33];
const std::string left(_itoa_s(high, buffer, 33, 10));
const std::string right(_itoa_s(low, buffer, 33, 10));
const std::string merged(left + right); Note: this of course come without warranties, it's the concept that's important here.
--
The Blog: Bits and Pieces
|
|
|
|
|
Hello
Can i hide all my desktop icons, wallpapers, taskbar etc using c++. Actually i want to clear my desktop.
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
static HWND hprg = ::FindWindow(_T("Progman"), NULL);
static BOOL doShow = FALSE;
if(hprg!=NULL)
::ShowWindow(hprg, (doShow==TRUE?SW_SHOWNORMAL:SW_HIDE));
static HWND hshell = ::FindWindow(_T("Shell_TrayWnd"), NULL);
if(hshell != NULL)
::ShowWindow(hshell, (doShow==TRUE?SW_SHOWNORMAL:SW_HIDE));
doShow = !doShow;
But the problem with this is if you press window key + D (Shortcut for show desktop), then it displays all the desktop icons(Provided your application is not in focus.) but it works fine with taskbar.
Do remember to set these settings back to normal once the application exits.
Nibu thomas
Software Developer
|
|
|
|
|
Thank you Nibu! it works perfectly.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: Can i hide all my desktop icons, wallpapers, taskbar etc using c++. Actually i want to clear my desktop.
i am little confused your want to hide all item from your desktop or delete all icon from desktop!..
if you want to hide all item from the desktop you can try Nibu's method.. or create a your desktop using CreateDesktop api
|
|
|
|
|
No i just wanted to hide them. So Nibu's method works perfectly.
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Hello
i am working with c++.I want to ask if i can calculate time to execute some intructions. Actually i want to check how much time a piece of code is taking to execute.
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
use profile in the VC++.
Simply if u want to know the time taken for some statements put OutputDebugString()in the before and end afetr the stement. Now using Debug viewer u can see the time taken
nave
|
|
|
|
|
Aqueel wrote: Actually i want to check how much time a piece of code is taking to execute.
try profiler or GetTickCount api!
|
|
|
|
|
Dear friends,
I am working on vnc based application. I am encountering a problem regarding unable to establish connection via http port. If you know how these thing happen, kindly give me a reply.
regards
kedar
Girish
Software Developer
|
|
|
|
|
I wonder how to write the app with non-rectangular window( like winamp ...). Can someone tell me about that.
Thanks!
|
|
|
|
|
|
Hello all,
I am working in VC++ 2005. In this i want to make one dll. But for that i use one already exist ".c" file. Now when i include a header file for that & call one of function it will get me the error of ollowing type.
error C3861: 'function_name' : identifier not found
Is it possible that i use ".c" in ".cpp" file? When i edit in file the editor give me the complate definetion of that function. So why it will gove me the complie time error.
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
Divyang Mithaiwala wrote: Divyang Mithaiwala
System Engineer & Software Developer
Hmm...
=A-L-J-E-C-H-I-N=
|
|
|
|
|
|
Hi Divyang,
You can't just call C functions from C++ functions. It has something to do with the calling conventions. All you have to do is tell the C++ compiler that the functions are C functions not C++ functions. There are a few ways of doing this but the way I normally do it is:
extern "C"
{
#include "myCPrototypes.h"
}
This way the compiler knows that the functions in the header are all C functions and will generate the calling code appropreately.
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
try extern 'c' { /*put your C code in this */ } syntax
|
|
|
|
|
Hi
i want to know how can i convert a "double value" to "unsigned int" without possible loss of data.
unsigned int numr;
double num1;
numr= fread (buff,sizeof(char),num1,pFile);
alok singh chauhan
|
|
|
|
|
|
It's impossible. For example, 1.5 can't be converted an integer without loss of data. 1 or 2 are the two closest but we lose .5 either way. I'm not sure what the code you quoted is trying to do?.....
Steve
|
|
|
|
|
Are you serious?
1. A double might contain more bits than an unsigned integer. Hence conversion loss.
2. A double can have decimal places, which an unsigned integer lacks. Hence conversion loss.
--
The Blog: Bits and Pieces
|
|
|
|
|
Hi,
your double num1 contains the number of chars you want to read from pFile.
Since you always want to read a whole number of chars, change double num1 to int num1, and your problem is over.
Ronald.
|
|
|
|
|
The answer, quite simply, is that you can not in general convert from double (or float) to unsigned int with no data loss!
Because double is a floating point format, it might contain a fractional part, which will be discarded in any conversion.
And a double might be very large or very small (because it allows powers of 10.)
If the double represents an integer in the range supported by an unsigned int, then no conversion is necessary - it can be stored.
Lastly, if the double represents something like degrees, with resolution of 0.01 degree and range of 0 to 359.99 degree, you could scale the value - multiply the double by 100.0, add 0.1, then store it in the unsigned int with no data loss.
|
|
|
|
|
Well, a 'double' is 8 bytes length and a 'int' is 4 bytes length.
So, i think, it's impossible to do that. What's with your example?
|
|
|
|
|
Hello:
I have an application which has a problem today, the print out was in the format of horizontal flip, i.e each line would be viewed correctly if a mirror is placed on the top of the line.
This kind of problem has never happened before. The printer is Brother HL-1230 Laser Printer. I have tried to work around the Printer Preference Settings in
Duplex Setting - Flip modes and
Page Setting - Mirror/Reverse print
without success as my print out was flipped horrizontally line by line. And the above two settings would flip or mirrow the whole page, and make the print out upside down, i.e. the first line was at the bottom and the last line was at the top.
The printout image could be found here
www.electrajet.com.au/downloads/flip.jpg
The program was written in MFC and c++. In the program, the document was printed line by line with help of CDC::TextOut(...), mapmode is MM_LOMETRIC.
Any advice or suggestions are appreciated.
Thanks in advance.
Ke
|
|
|
|