|
Create a variable for the check box.
And call GetWindowRect
Mythili
|
|
|
|
|
No. The problem is the width can be much more than
the text in it actually needs. If I want to center
the checkbox I need the width of what the user sees,
not the width of the window rect.
Best regards, Sebastian
-------------------------------------------
My website: http://www.hartwork.org
|
|
|
|
|
What is modal loop?
Thanks in advance.
|
|
|
|
|
Running a message pump means a loop something like the following:
MSG m;
while ( GetMessage(&m, NULL, 0, 0) )
{
DispatchMessage(&m);
}
There are many variations but the code above captures the essence of every message pump.
A modal window is window that has to be dismissed before any other windows in the app can be used. This is normally done by creating a top level owned window, disabling the owner and then running a message loop. This is what people mean when they talk about a modal loop. Note the message pump need not be explicit. For example the DialogBox family of functions run a message pump. It is important to remember that, taking the DialogBox as an example, while the modal dialog is displayed we're inside the DialogBox function and when it returns the modal box has been destroyed.
Steve
|
|
|
|
|
You must be an expert on computer science. I very appreciate your help, thanks a lot.
I'm a beginner
|
|
|
|
|
I'm studying MSDN.net 2003 and see some words below.
"Subclassing the window does not work for messages set between processes."
These words occurred at the section "About Hooks" whereas I can't understand it.
Does it mean if we subclass a window and do something in the associated wndproc with many messages which would also be processed in the hook procedure will make the subclassing work un-regular?
Can you explain it for me?Thanks in advance.
////////////////////////////////////////
hello guys!
|
|
|
|
|
It means you can't subclass a windows from another process (a guess).
Steve
|
|
|
|
|
When you subclass a window, it means you are replacing that window's window procedure (the function that Windows calls when it has a message for the window) with a function of your own. Subclassing is used to modify the normal behavior of a message.
Hook procedures can be used to do the same kind of thing. In the hook procedure you can alter the message to change the behavior. Unfortunately, if a Windows message involves a pointer of any kind (for example, to a string), the pointer (an address in memory) only has meaning inside the process from which it originates.
Software Zen: delete this;
|
|
|
|
|
Hey,
So I'm throwing together a little program that will append another file with just one line of text. Everything seems to run smoothly, except that the program which I want to access the file (Firefox), doesn't recognize the changes.
If I open up notepad, the line has been added, and only once I save the file from inside notepad does Firefox regognize the change.
To write to the file, I'm just using a simple fopen, fwrite combonation. My code is as follows:
FILE *host;<br />
host = fopen("file", "a");<br />
fwrite(ipAdd, ipAdd.GetLength(), 1, host);<br />
fclose(host);
Like I said, everything executes properly, and I can that the line has been appended to the file, it's just that Firefox doesn't regognize it. (Even after restarting Firefox.)
Any suggestions would be greatly appreciated.
Nicky
|
|
|
|
|
|
Still doesn't regognize the change. I may be wrong, but I'm pretty confident Firefox isn't the problem.
Any other suggestions?
Thanks,
Nicky
|
|
|
|
|
I know nothing about Firefox, but if it is accessing the same file then the problem is with Firefox. Normaly I would shut down the program and restart it, to see if it reloads the new version, if that does not work, then I shut down my computer and see what happens when I try again. If it still does not recognise the chages, then you are acessing to different files.
INTP
Every thing is relative...
|
|
|
|
|
Like I said in my first post, even after restarting Firefox (closing and reopening), the file still isn't recognized. I haven't tried restarting the my computer, but that really wouldn't be practical, even if it worked.
I think the most important thing is that if I open the file in notepad, and simply save it again (not making any changes), the changes are regognized. Any thoughts on why this would be?
Nicky
|
|
|
|
|
hey,
i have a ulong and i need to convert it to uint. how can i do this? i'm guessing this is pretty simple. i've searched google but i just get a ton pages showing how to do conversions in c# and vb.
thanks in advance,
sam kline
-- modified at 19:21 Saturday 4th March, 2006
|
|
|
|
|
unsigend long x = 100;
unsigned int y = (unsigned int)x;
this will do. But why do you want to convert long to int. long is 64bits and int is 32 so it will get truncated.
|
|
|
|
|
Acutaly it depends on the compiler, in VC6 they are both 32bits. An int is supposed to be the size of a register word, but in reality it is up to the creators of the compiler.
INTP
Every thing is relative...
|
|
|
|
|
yea long is 32-bit in vc. I must have been sleeping when replying
|
|
|
|
|
I'd do it like this:
static_cast<uint>(your_ulong)
C style casts (a type in brackets) are a major haste and should be avoided - This is the reason C++ added the const_cast , dynamic_cast , static_cast and reinterpret_cast keywords.
I'm sure there will be people who disagree but I would wager they haven't had to spend weeks hunting down some obscure bug caused by a bad cast which is almost invisible in the source code.
Steve
|
|
|
|
|
That depends on the type of cast. Doing such things as uint casts, no I have never had problems with them.
However, when converting pointers, yeah, static_cast will save you MUCH pain.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I agree that with numeric types there is no difference - however it's a policy thing. If all the casts are one of the function style casts you can "grep" for every cast in the project. Casts generally represent a design problem (but not in all cases) and as such should be highly visible.
Steve
|
|
|
|
|
I have never worked for a big company, but after years of reading (and fixing) other peaples code I understand why a policy is needed. I am not talking about visability (good point though), I am talking about simple things like comparing floating point numbers.
I recieved a varification a few years ago (that I was not a geek) when a guy (which I was warned about) told a joke about comparing floating point values and I said that I had no problem doing so (he stopped laughing). It took me a couple of minutes to realise what he was talking about, I did not find it funny becuase I take such things for granted.
INTP
Every thing is relative...
|
|
|
|
|
Hi!
I have a question regarding file input and output.
If I use a getchar or a getline, how can I tell
my program to go get a certain character or line
like for instance the character or line
after the phrase "Get this line:" or line # 43?
How can I do such things and which other things
are possible?
I haven't found anything usefull on the net so you
guys are my last resort.
Thanks!
Peter
|
|
|
|
|
If you know all the lines in the file are the same length then it is simply a matter of using one of the seek functions (fseek, lseek, basic_filebuf::seekpos, etc) to set the file pointer to the proper position. If that is not possible then you have to start at the beginning of the file and start reading one line at a time until you get to the desired line.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Yes, that might work.
Can you give me an example of the latter?
I am quite new to file input and output and I have never written any code that seeks
a certain line or a certain character.
Thanks!
|
|
|
|
|
You already mentioned the method "getline", it reads one whole line at a time. You just need to count the number of lines you read.
The other part of finding a substring (part of the line), you just do on a line by line bases. Unless there is a newline in the substring, in which case you have to search the whole file piece by piece or a character at at time, your choice.
You could just load the whole file (if not to larg) into an STL string type and call find to search for a substring.
The is a ridiculously large number of ways to do what you want, just look at what your library offers (string and file i/o), and your imagination.
You can even use regular expressions.
INTP
Every thing is relative...
|
|
|
|