A service runs in the background, so where are these WM_COMMAND's coming from? You won;t have a menu, or a dialog box...
I think you need to go back to your basics - a service communicates with other programs using various interprocess communcations.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[^]
No, you are writing all your strings into one string, so you will keep only the last one. The problem you have is that you don't know upfront how many directories you will get, so you don't know how large you have to make your array. You could choose the brute force and use an array which is large enough (e.g. char array: max 1024 directories of max 1024 characters). And then in your while loop you keep an index of where to store the current directory name (simply increment it each time).
Is it a C or C++ project ? Because if it is C++, I strongly suggest you to use stl containers (std::list for instance) and std::string, this will avoid to create an array with a fixed size upfront.
unsigned long i; //4-bytes, int: 4-bytesshort s; //2-bytes
signed char c; //1-byte
i = (s<<15) + (c <<9);
How will type conversion take place in this case?
Is it that:
1. s will remain short(2 bytes) thus shifting the LSB into the MSB and remaining bits turn 0; c is promoted to short then left-shift 9 performed. The final R-value is promoted to unsigned long and saved into i.
2. s and c both get converted to unsigned long before performing the shift operation (thus we do not lose any of the left-shifted bits)
or something else happens.
I tried it in VS6.0 and the result seem to indicate that in both s and c I did not lose any bit upon left-shifting as if s and c acted as if they were a 4-byte data type (long or int)
All shifts take place in a register.
The registers are 32-bit in a 32-bit OS.
So even though the shift overflows the variable, it will still remain in the register.
That's the reason you don't loose any bits.
«_Superman_» I love work. It gives me something to do between weekends.
I understand that the shifts take place in registers but then the evaluated values have to be stored back into their respective variables, which are of type short and char, which cannot hold 4-byte values.
In the book C-The Complete Reference by Herbert Schildt theree is an example
Here it does not talk about the data type of the variable "result". In any case, the conversion here is as follows: First ch is converted to int since i is int, then ch/i is performed. The result of ch/i is then converted to double as f*d is double. The final value is a double.
Now if "result" is type float then the final value will be truncated to float and stored in "result", isnt it?
types promotion occurs because of (in the original expressio) the assignment was done to an integer.
As we see in the above example the variable to which the final value is assigned, its type matters only when we have solved the expression on the right side.
Please correct me if wrong anywhere.
The mentioned book also says:
"First, all char and short int values are automatically elevated to int"
This seems to be the reason why I don't lose the shifted out bits and also because I store the value back in an unsigned long
modified on Thursday, October 22, 2009 4:51 AM
Last Visit: 31-Dec-99 19:00 Last Update: 11-Dec-23 6:49