|
|
Sorry. This is not what I am looking for.
- NS -
|
|
|
|
|
The client area of a window is kind of an abstract concept.
The WM_NCHITTEST message is used by the system to determine points
in or outside of the client area.
You can handle this message and adjust the return value appropriately.
For drawing, you'll need to use clipping regions if necessary.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
But what about the clipping of child controls by the client area?
- NS -
|
|
|
|
|
See here.
"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
|
|
|
|
|
Thank you. But I could not found the solution for my doubt. I am not talking about the NcHitTest. But the actual client area, by which the child's visibility is clipped. AFAIK client are cannot be non-rectangular.
- NS -
|
|
|
|
|
Yes, I just did it.   The concept is fairly easy to implement if you are managing your own custom container control ( which I'm fairly certain is what you are doing based on the thread ).
To implement this; however, you need to use only custom child controls or child controls that have OnPaint() overridden so that you can interject a clipping region prior to the child control being rendered.
1. In your custom container control, in the OnPaint() event, calculate the desired client area GraphicsPath.   Save that path as a public member for later use by chlid controls, let's name it 'ClientAreaPath' for fun.
2. For any control that can be added to your custom container, define the control as a custom control, or at least inherit and override the OnPaint() event.
3. In your child controls, in the OnPaint() override, determine if the control is a child of your custom container and, if so, then transform and apply the ClientAreaPath that was calculated and saved in step #1 above.   Viola - non-rectangular clipping
Here's a rough c# outline of the child control OnPaint() operations.
public override void OnPaint( PaintEventArgs e )
{
// determine if this control is parented and if the parent can supply a ClientAreaPath
try
{
// attempt to cast, will cause exception if nothing else
MyCustomContainer parentContainer = ( MyCustomContainer )Parent;
// get a copy of the custom client path
GraphicsPath p = new GraphicsPath(parentContainer.ChildPath.PathPoints, parentContainer.ChildPath.PathTypes);
// transfrom the path to be relative to the client (critical step here)
// all paths are "zero-relative" so the client needs to see this path expressed
// not as zero-relative, but client-location relative instead
Matrix translateMatrix = new Matrix();
translateMatrix.Translate(-(Location.X), -(Location.Y));
p.Transform(translateMatrix);
// now apply a nice clipping region to the control's graphics object so that
// all subsequent render related operations will clip appropritely
e.Graphics.SetClip( p );
}
catch( <bleh> )
{
}
// ******* now render your control using whatever means you want, just make sure that
// you do not reset the clipping path - if you need to clip additional client-relative
// areas, use a clipping combine mode of compliment ( or whatever that option is )
}
Hope this helps Of course, based on the date of the post ( 3 years ago ), probably not LOL.
modified on Monday, February 1, 2010 12:32 PM
|
|
|
|
|
rnendel wrote: Hope this helps Of course, based on the date of the post ( 3 years ago ), probably not LOL.
This solution was not applicable (at that time) I think...
- ns ami -
|
|
|
|
|
Hello all,
I have written a code for getting html code of any given link using api's .
Now what i want is when a particular page is taking more then 10 sec to get its html code a message box stating time out should be displayed. How can i do this?
Thanks in advance
|
|
|
|
|
You can use SetTimer (...) when the function to get the code starts, and KillTimer (...) when the function ends succesfully with the download of the code.
If the timer reachs the end of the interval, then you can code you dialogbox with the error in the message WM_TIMER.
hope it helps
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
|
|
|
|
|
SetTimer is a function in CWnd class and i am doing all my processing in a worker thread. How to apply this functionality in a thread
|
|
|
|
|
can sleep maybe help?
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
|
|
|
|
|
Hi,
I have a third party dll and a lib file. Now i want to check whether the lib file and the dll have been built using the same .obj files or not?
Is there any tool or utility which can give me the names of the .obj files used in building the correspinding dll.
For .lib files we can use the lib.exe utility which comes with visual studio.
Any help will be great.
|
|
|
|
|
Hello All,
I want to know that my desktop is changed or not ??
I want the message handler that will inform my application that my desktop is changed.
I want to continuesly check that my desktop changing information.
I want that specific changed rectangle from the desktop.
Thanks in Advance,
Ashish
|
|
|
|
|
ashishbhatt wrote: I want to know that my desktop is changed or not ??
See if WM_SETTINGCHANGE is of any help?
ashishbhatt wrote: I want that specific changed rectangle from the desktop.
"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
|
|
|
|
|
Hi all:
I'm wondering why the following code need type conversion from PVOID to PBYTE, is it because of the type of "Size"? and why PBYTE, will any other type will do the same thing?
PVOID pvAddressBlk;
SIZE_T RegionSize;
pvAddressBlk = (PVOID) ((PBYTE) pvAddressBlk + Size);
Thanks,
|
|
|
|
|
Because you are doing pointers arithmetics here. A PVOID pointer is a pointer to an unknown type (so, which size is not known). In that case, you cannot increment the pointer because the size to which it points to is unknown (so, impossible to go to the next element). A pointer to a byte (PBYTE) knows the size to which it points to (1 byte), so incrementing the pointer will move to the next byte.
Similarly, if you casted your pointer to int* for example, then incrementing (++) the pointer would make it points 4 bytes after its current position (because the size of an int is 4 bytes, so, the next integer is 4 bytes after the current position).
Hope it is clear.
|
|
|
|
|
Thanks for the reply, the code makes sense to me now: it's trying to increment the address by (type size * n) bytes.
|
|
|
|
|
LiYS wrote: is it because of the type of "Size"?
No. Let me explain with an example. Suppose you have two pointer variables say
int *pInt and <br />
char *pchar
And you increament both this varibales by one
pInt++;<br />
pChar++;
In the above case the pInt will increament by four. But pChar will be advanced by only one.( i. e when a pointer is increamented or added for n times, compiler actually adds n times the size of datatype the pointer pointing to )
In your case it is a void* pointer. So it cannot decide how much to increment. thats why compiler gives the error.
|
|
|
|
|
Thanks for the reply, the code makes sense to me now!
|
|
|
|
|
I want all the filenames in perticular folder of web server
with http call.
InternetFindNextFile function falis
some sample of code.
.
.
CString sUserAgentName = "Microsoft Internet Explorer";
DWORD dwAccessType = INTERNET_OPEN_TYPE_PRECONFIG ;
DWORD dwFlags =INTERNET_FLAG_DONT_CACHE|INTERNET_FLAG_RELOAD ;
//pInternetSession = new CInternetSession(sUserAgentName,dwContext,dwAccessType,NULL,NULL,dwFlags);
CString sUrl="http://www.test.com/1";
WIN32_FIND_DATA wfd;
HINTERNET hInternetFind,hInternetOpen = InternetOpen(sUserAgentName,dwAccessType,NULL,NULL,0);
CStringArray saFileName, saDirectoryName;
CString sName;
CString sServerName , sServerObjectName ;
DWORD dwServiceType = 0 ;
INTERNET_PORT nServerPort = 0;
CString strHeaders ;
CString sUserName = "";
CString sPassword ;
DWORD dwContext = 0;
if(AfxParseURL(sUrl,dwServiceType,sServerName,sServerObjectName,nServerPort)==FALSE)
{
AfxMessageBox("AfxParseURL() Fails");
return false;
}
int err;
//pConnection = pInternetSession->GetHttpConnection(sServerName,nServerPort,sUserName,sPassword);
//HINTERNET hInternetConnect =
::InternetConnect(hInternetOpen,sServerName,nServerPort,sUserName,sPassword,INTERNET_SERVICE_HTTP,dwFlags,dwContext);
//err = GetLastError();
//hInternetFind = FtpFindFirstFile(hInternetConnect,"*.*",&wfd,0,0);
/*if i try function FtpFindFirstFile than it returns null and errorcode is
ERROR_INTERNET_INCORRECT_HANDLE_TYPE(12018)
*/
//err = GetLastError();
hInternetFind = InternetOpenUrl(hInternetOpen,sUrl,NULL,0,INTERNET_FLAG_RAW_DATA| INTERNET_FLAG_RELOAD|
INTERNET_FLAG_DONT_CACHE,0);
/* if i try InternetOpenUrl than it retrn not null but when InternetFindNextFile is called than it returns FALSE
ERROR_INTERNET_INVALID_OPERATION(12016)*/
err = GetLastError();
if (hInternetFind ==NULL)
{
AfxMessageBox("(hInternetFind == NULL)");
}
if (InternetFindNextFile(hInternetFind, &wfd) == FALSE)
{
err = GetLastError();
AfxMessageBox("(InternetFindNextFile = fails)");
}
do
{
if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
sName = (const char*) &wfd.cFileName;
if(!sName.IsEmpty())
{
if (sName.GetAt(0) == '.')
continue;
saDirectoryName.Add(sName);
}
}
else
saFileName.Add(sName);
}
while (InternetFindNextFile (hInternetFind, &wfd));
InternetCloseHandle(hInternetFind);
.
.
.
thanx
|
|
|
|
|
jay_p_patel wrote: InternetFindNextFile function falis
So what does GetLastError() return?
"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
|
|
|
|
|
i wrote in that code
ERROR_INTERNET_INVALID_OPERATION(12016)
|
|
|
|
|
Your code snippet is next to impossible to read. I can't tell what you've got commented out and what's actual code. Please reformat it AND make use of the <pre> tags.
You need something similar to:
HINTERNET hOpen = InternetOpen(...);
if (hOpen != NULL)
{
HINTERNET hConnect = InternetConnect(hOpen, ...);
if (hConnect != NULL)
{
WIN32_FIND_DATA findData;
HINTERNET hFind = FtpFindFirstFile(hConnect, NULL, &findData, ...);
if (hFind != NULL)
{
do
{
...
} while (InternetFindNextFile(hFind, &findData))
}
}
}
"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
|
|
|
|
|
Hello Sir,
The code you send me that i already tried.
when i use
HINTERNET hFind = FtpFindFirstFile(hConnect, NULL, &findData, ...);
it returns hFind = NULL
and in GetLastError it returns
Error No.12018 ERROR_INTERNET_INCORRECT_HANDLE_TYPE
i read in msdn that we can use InternetOpenUrl in place of FtpFindFirstFile
HINTERNET hFind = InternetOpenUrlhInternetOpen,sUrl,NULL,0,INTERNET_FLAG_RAW_DATA| INTERNET_FLAG_RELOAD|
INTERNET_FLAG_DONT_CACHE,0);
now hFind is not Null but when i use this hFind in
InternetFindNextFile API than it return false.
So this is the problem.
Anyway thanx for helping me.
sorry for ur inconvinience.
|
|
|
|
|