|
Read this article to get a better understanding of how to use worker threads: clickety[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanx Roger, the link has very useful information.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Hi all
Can you pls help in Using Power management to Monitor UPS
Thanks & Reagrds
abhi
|
|
|
|
|
abhiramsss wrote: Can you pls help in Using Power management to Monitor UPS
Read the power management [^]section in MSDN. This section lists all the power management functions, messages, along with overview.
|
|
|
|
|
Hi
i am not understanding exactly how the bit fields implemented
if i create the following structure
struct word
{
unsigned int bit1 : 1;
unsigned int bit2 : 1;
unsigned int word3 : 16;
}
internaly how many bytes will be saved and is the 1 means 1 bit ?
|
|
|
|
|
Ayman Mashal wrote: is the 1 means 1 bit ?
yes.
so totally, your struct uses 1+1+16=18 bits, but as the lower piece of memory you can address is the byte, you will use 3 bytes (as 2 bytes - 16 bits - are too few).
so, from usins 3 unsigned ints (which are commonly, on 32 bits machines, 32 bits wide), you're saving 12-3 = 9 bytes !
|
|
|
|
|
Acutally, since the OP has declared his bitfields as int xxx : 1, it will use 4 bytes (only three will contain valid values).
If you save to a file, or even in memory, it will still consume 4 bytes.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
krmed wrote: int xxx : 1, it will use 4 bytes
the :1 notation means 1 bit, no byte
|
|
|
|
|
Obviously it means one bit. But by declaring it as
int mybitvar : 1
it will still consume 4 bytes when stored.
Maybe I don't understand why you think my reply was in error?
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
This[^] MSDN article will probably help you.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi,
I'm trying to create simple MDI program with splitter with two panes, the first should be TreeView (or any other ctrlview for that matter) the second one I'd like to be the FrameWnd client window, where the child windows will be present. How do I do that? (I saw the examples but all of them use all panes for views).
I guess the same result can be achieved using resizeable docked dialogbar,
but it's more complicated to implement.
thanks,
Guy.
|
|
|
|
|
hi,
How to select a item in a tree control if i know path of that particular item.
|
|
|
|
|
yuvachandra wrote: i know path of that particular item
Whats does this mean ? Is it text displayed ?
You need to traverse tree control items inorder to go to particlular node and select it.
|
|
|
|
|
i have a path D:\New\NewFolder.Now i have to select the item which contains the text NewFolder.How can i do it.
|
|
|
|
|
yuvachandra wrote: i have a path D:\New\NewFolder.Now i have to select the item which contains the text NewFolder.How can i do it.
I am assuming D: is root Node and you first have to find New Under it using GetChildItem and GetNextItem and comparing the text with New, after you find Text New, GetChildItem and GetNextItem to Find NewFolder, using TreeHandle you got from search use SelectItem select that item
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello all,
As per my previous post i m trying to pass two parameters to my thread one is CString n one is integer.
For that i have made a structure
which constitute of two variable CString and int resp..
in a function i m making structure object like this
test *obj;
obj = new test;
n giving its variable values like this
obj->item = 10;
obj->str = "nItem";
n after that starting thread like this
Ping = AfxBeginThread(PingThread,obj);
my thread LPVOID paramter recieves its value
inside my thread i m able to retrieve only first value either its a CString or an integer
cstrHost = *(static_cast<cstring*>(pParam));
int_val = *(static_cast<int*>(pParam));
trying to retrieve 2nd int value is giving a garbage value
can anybody guide me in this....
|
|
|
|
|
you will recive whole struct as parameter
void MyThred(LPVOID lpStruct)
{
MyStruct *pStruct = static_cast<MyStruct*>(lpStruct);
}
|
|
|
|
|
thanku prasad
my problem got solved....
|
|
|
|
|
Ok, so there is this word that I am trying to remember. Problem is, that I can't remember what it was :P and it's not a real word - it is just made-up.
The thing is though, that it follows all the rules of the english language, so I attempted to make a program that would print every single possible combination of letters to console (up to 10 characters per word) that makes up a legal word in the english language. I have actually done rather well so far, however now I've gotten to the tough part. I need to start calculating each letter in the word.
I know that the word starts with the letter G, so the next obvious step is to figure out if it is possible to put an A next to that G to give me 'GA' then this word (which is completely legal in the english language) is printed to the console so that the user can see it. Then the loop starts again, but this time it tries to combine the letters G and B to give me 'GB'. This isn't possible in the english language so it simply skips ahead to the next letter until it has reached the end of the alphabet and has attempted to combine G and Z. Then the loop will try to append the letters A through Z to all of the currently possible words (GA, GE, GI, GO, GU).
So I now know what I have to do, but I have no idea how to turn it into functioning code.
I was wondering if anybody would like to have a go at making this program for me, or would like to offer some insight as to how I would go about doing it. If you guys would like, I can post my code here for you to work off of.
|
|
|
|
|
What are the rules?
Steve
|
|
|
|
|
well, its the English language, so there is alot of them, but I will make a start. I only have 10 minutes so I can't give you many until later on.
1) The letter Q must always be followed by the letter U. eg "QUeen".
2) There can be no more than two of a single letter next to each other. eg "eFFort", "ardvAArk".
3) There can only be one of the same letter at the beginning of a word - you cannot put two of the same letter at the beginning. eg "Grace", "Barrage".
4) ...more to come.
|
|
|
|
|
These rules are really the hard part or the program, the rest is brute force. I'll wait until you post more rules before I make any suggestions.
Steve
|
|
|
|
|
Sauce! wrote: 1) The letter Q must always be followed by the letter U. eg "QUeen".
So much for burqa, qwerty, tranq, suq, sheqel, et al.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
lol, I'm sure that I can discount those words for now, seeings as the word DEFINITELY didn't have a Q in it. :P
|
|
|
|
|
hi,
I have to read a file content and i have to copy that content to buffer(char *buffer),this buffer is one of the parameter of a function(that is i have to pass the content as a parameter to a function).And iam confused how to start it???
Help me with your suggestions
Thanks in advance.
Siddharth
|
|
|
|