|
Hi, i have SDI app with dialog based on CDialog class. I need to get pointer to client area to set some properties.
|
|
|
|
|
zarraza wrote: Hi, i have SDI app with dialog based on CDialog class
Do you have a dialog based app, or a SDI app, with the view based from CFormView? These are different things.
As for your second question, can't you not use
CWnd::GetDC / ReleaseDC?
What sort of properties are you talking about?
|
|
|
|
|
For simplify this lets say it is a SDI app with the view based on CFormView (if needet can be CDialog based).
In this view i want to set size of client area, because on client area i have to put dynamicaly variable number of buttons, and client area size have to be enought big, sometimes even bigger then screen size.
I don't know if GetDC/ReleaseDC can help resolve my problem.
|
|
|
|
|
oninitdialog / getclientrect
|
|
|
|
|
I don't know if i understand MSDN corectly, but there is said that GetClientRect() just return coordinates of client area respectively to window area, not handler of client area.
|
|
|
|
|
That is true - but the only thing you'll care about is the rectangle's width
or you can use MapWindowRect....
Iain.
|
|
|
|
|
If i add a button dynamicaly which is outside client area, the scroll bars doesn't appear and i have to resize window manually(by clicking mouse in corner at runtime) to see this button. It has to be a way to make those scrollbars visible and scrolling very big client area (eg if i want 1000 buttons on dialog or very big image).
|
|
|
|
|
CFormView is based on CScrollView. Normally you would call ResizeParentToFit at some point (or MFC will do it for you), what you want to do is provided by a call to SetScrollSizes after you add this "button which is outside the client area".
|
|
|
|
|
Thank you Roger i search for this solution for few days and couldn't find nothing usefull. I love You man.
|
|
|
|
|
Design a calculator, which should have the following:
sin x, cos x, tan x, Sq Root
Along with standard features and memory facility(M+,M-,MR,MC)
avishekbanerjee
|
|
|
|
|
This is a good assignment. Report back when you are done and tell us how it went.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
and you expect us to do your homework ?
bad pupil
|
|
|
|
|
|
Done.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It enters to stack you must wait for it(FIFO).
|
|
|
|
|
|
Hamid. wrote: but next time ask for specific question and also use of a simple search
yes, but next time, don't give help to lazy people like that guy who didn't even make the effort of searching the web and the codeproject by itself
|
|
|
|
|
I'm agree with you if I could search so he/she could search himself/herself but I guess maybe he/she needs to this help.;)
|
|
|
|
|
Hi,
When using a buffer to intermediary help to make use of some functions…
If I want to have in the buffer the content of an Array, then I make:
pBuffer = &Array[0];
file->Write (pBuffer , sizeof (Array));
And there is no problem because the array allocates contiguous memory to hold the members and the pointer says where the Array starts, and with the “size of (Array)” I say how many elements have to be written.
But doing the opposite…
::RegQueryValueEx (hWkKey, "SubKey", 0, &dwType, pBuffer, &lnLength);
if (dwType == REG_SZ)
szValue = pBuffer;
else if (dwType == REG_BINARY)
for (int i = 0; i < lnLength; i++)
Array[i] = *(pBuffer + i);
delete [] pBuffer;
pBuffer = NULL;
The usual assignation works with the string because internally is like a char* and then both uses the start direction to allocate the data in their place till a '\0' is founded, but it should be made using a for when writing the data into the array because there is no way to say how long the array is (like '\0' by the char*) (isn't it?)
Array = *pBuffer;
;
&Array = pBuffer;
Array = pBuffer;
&Array[0] = pBuffer;
;
The meaning of the errors (but C2109) and the reason to have them is clear, but...
Is there any other possibility to do it, or the “for” must be used?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I am not sure what your question is but have a look at memcpy(...)
|
|
|
|
|
I have taken look to the documentation and it seems to be what I asked for. But...
Quote:
"The memcpy function copies count bytes of src to dest. If the source and destination overlap, this function does not ensure that the original source bytes in the overlapping region are copied before being overwritten. Use memmove to handle overlapping regions."
but in the example both makes exactly the same,
Function: memmove with overlap
Source: quick brown fox jumps over the lazy dog
Destination: brown fox jumps over the lazy dog
Result: The quick quick brown fox jumps over the lazy dog
Length: 49 characters
Function: memcpy with overlap
Source: quick brown dog jumps over the lazy fox
Destination: brown dog jumps over the lazy fox
Result: The quick quick brown dog jumps over the lazy fox
Length: 49 characters
then... why is it said?
Can you tell me an example where the quote of MSDN is true?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek wrote: then... why is it said?
what is "what" said? The part about overlapping source and destination? ????
|
|
|
|
|
Yes, what I write in quote.
It is supposed to give problems while overlapping, but the code that they put in the example (I paste some parts)
char string1[60] = "The quick brown dog jumps over the lazy fox";
char string2[60] = "The quick brown fox jumps over the lazy dog";
printf( "Function:\tmemmove with overlap\n" );
printf( "Source:\t\t%s\n", string2 + 4 );
printf( "Destination:\t%s\n", string2 + 10 );
memmove( string2 + 10, string2 + 4, 40 );
printf( "Result:\t\t%s\n", string2 );
printf( "Length:\t\t%d characters\n\n", strlen( string2 ) );
printf( "Function:\tmemcpy with overlap\n" );
printf( "Source:\t\t%s\n", string1 + 4 );
printf( "Destination:\t%s\n", string1 + 10 );
memcpy( string1 + 10, string1 + 4, 40 );
printf( "Result:\t\t%s\n", string1 );
printf( "Length:\t\t%d characters\n\n", strlen( string1 ) );
gives the results that I worte in the message above, and both are making exactly the same and working good. So I don't understand where the problem is. If I could see an example where the quote is true, then I would understand it better.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek wrote: If I could see an example where the quote is true, then I would understand it better.
If the source and destination overlap, this function does not ensure that the original source bytes in the overlapping region are copied before being overwritten.
memmov "does" ensure that the original source bytes are copied before being overwritten.
There is no certain way to give an example where it memcpy fails because the results are not guaranteed. You would have to try experimenting to find a condition where it might fail repeatedly.
Also your documentation appears dated check this out[^]
|
|
|
|
|
Yes,
the only problem is that I am usually using VC++ 6.0 and it would be not the first time I check the MSDN page to look for something, try to use it, and lots of errors because it is for newer versions.
Because of that I use my program's help and my quotes sometimes are old.
But thank you for your time and explications. You have helped me to understand it better
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|