|
I found the solution, which was in some other part of my code, I need to call Default() to force the drawing of the "inside" before drawing the border.
I'm trying to draw a border around a CEdit derived control.
The CEdit has the "Vertical Scroll"
void CMyEdit::OnNcPaint()
{
Default();
CDC* pDC = GetParent()->GetDC();
CRect screenRect;
GetWindowRect( screenRect );
ScreenToClient( screenRect );
CRect newRect;
newRect = screenRect;
ClientToScreen( newRect );
GetParent()->ScreenToClient( newRect );
pDC->FrameRect( newRect, &m_BorderBrushFocus );
newRect.DeflateRect( 1, 1, 1, 1 );
pDC->FrameRect( newRect,&m_BorderBrushFocus );
}
When doing this, it draws the frame around the CEdit, but it hides the vertical scrollbar; when I start typing in the edit box, the "shape" of the scrollbar is visible, and if I add enough text to enable the scrollbar, it appears; but only if no repaint is necessary, then it will be erased.
Am I allowed to draw in such fashion ?
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
-- modified at 16:00 Monday 8th May, 2006
|
|
|
|
|
yes it hides the vertical scrollbar when type,but
can you tell please why use OnNcPaint instead WM_PAINT ?
|
|
|
|
|
I'm trying to put up a waitcursor before a possible lenghty operation (CSocket connect, if timeout occurs),but i'm unable to put it up. The waitcursor flashes real fast and returns to the standard
pointer, and after some debugging, it looks like the CSocket.connect function disengages
the wait cursor (as a test I removed csocket connect, and put a sleep in there and wait cursor stayed up for the duration).
I have tried different variations of putting up the wait cursor (CWaitCursor, beginwaitcursor, loadCursor) and at different parts of the code, to no avail.
Any help would be greatly appericated.
Thanks
|
|
|
|
|
Some other window has responded to the WM_SETCURSOR message. If you are doing this socket communication in a separate thread, a "wait" cursor is not required.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
If I set a breakpoint before I do my socket connect, and then continue my waitcursor shows up, if I run it w/o any breakpoints, no waitcursor!
Another weird thing is, the same function is called from another dialog, and the waitcursor shows up like it is supposed to.
|
|
|
|
|
All CWaitCursor does is call SetCursor() once. If your code ends up pumping messages and receives a WM_SETCURSOR which it does not handle, DefWindowProc() will set the cursor back to the cursor specified in the window class. It sounds like this is what's happening in your app. You'll need to handle WM_SETCURSOR and keep a flag saying whether you want the hourglass cursor, and set the cursor appropriately in your WM_SETCURSOR handler.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Have you tried BeginWaitCursor and EndWaitCursor .
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Yup, I have tried BeginWaitCursor(), EndWaitCursor(), I put in a message handler for WM_SETCURSOR, but again, the wait cursor shows up when I call my function from one class, but not when I call it from another, and they are both going to the same place. And yes if I put a breakpoint before my lengthy operation and then it shows up.
Thanks
|
|
|
|
|
Hi All,
I have wireless application which has socket connection for the data transfer. In windows XP SP2, i add the application into firewall exception list. But in windows 2000 i have problem to add it into that list. Please help me ....
Thanks and regards
Mahesh Patil
|
|
|
|
|
Dear all,
I have implemented an IE in an mfc application (using the microsoft webBrowser).
I need to detect the position where a user clicks (x and y coordinates).
How do i do that ?
thanx
llp00na
|
|
|
|
|
You need to use the COM interface to the Document Object Model and susbscribe to events. The event notification data will contain the x,y coordinates
Start Here[^]
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
thanx for your reply,
I have been looking at that article before. But i thought that this way will only allow me to identify which html element the user clicked, it does not specify the exact (x,y) of user clicks.
m I wrong ???
llp00na
|
|
|
|
|
When you receive an event you can use the IHTMLEventObj family of interfaces to get all kinds of information on the event.
Steve
|
|
|
|
|
llp00na wrote: I need to detect the position where a user clicks (x and y coordinates).
How do i do that ?
By responding to the WM_LBUTTONDOWN and/or WM_MOUSEMOVE message(s).
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
can you please point out any articles ?
thanx
llp00na
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
thanx,
sorry for my novice questions. How can i add the message WM_LBUTTONDOWN to my application so that every time the users clicks the left menu i retrieve the message ???
llp00na
|
|
|
|
|
llp00na wrote: How can i add the message WM_LBUTTONDOWN to my application...
ClassWizard (Ctrl+W).
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Nothing happens when i press ctrl+w on the class view. I am using visual studio 2003.
llp00na
|
|
|
|
|
llp00na wrote: I am using visual studio 2003.
It helps to mention this sort of thing up front. See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
I am sorry david. it wont happen again.
I have done what you advised. I have got a new message event handler for the click down button. However it does seem to work at all. I have tried printing out some statements there but none is shown up !!!
llp00na
|
|
|
|
|
Hello,
I am writing Win32 DLL that exports functions to Excel. I use the Floating Point
Array Structure in C to pass Excel ranges :
typedef struct _FP
{
unsigned short int rows;
unsigned short int columns;
double array[1];
} FP;
I want to call the exported function from the dll directly in the Excel cells as an array formula via a declaration of the function in a VBA module as opposed to using an .XLL:
extern __declspec(dllexport) void __stdcall SimpleExample(FP *arr){
for(int j=1;j<=5;j++){
arr->array[j]=arr->array[j]*2;
}
}
(the range of cells is 5 long)
Public Declare Function DLLFunction Lib "Mydll.dll" Alias
"?SimpleExample@@YGXPAU_FP@@@Z"(ByRef outarr As double) As Double
However Excel needs to know that the argument passed in is to be "modified in
place" and returned to the calling cells using the Return Type, in this case "1K" - the first and only argument is a FP struct and is to be used as the return parameter.
If the function is registered in VBA -where does this return type code information code go? - in the ".def"
file?
Many thanks in advance for any assistance.
|
|
|
|
|
I think you really need to be using Automation data types to pass data in/out of Excel to VBA. You could pass in a SAFEARRAY* to contain the contents of your range. I would suggest reading up on auotmation data types.
I hope this helps.
Deus caritas est
|
|
|
|
|
Thanks,.. the SAFEARRAY can be used when passing variant arrays from VBA to C++. The Floating Point Array Struct is used when passing parameters that refer to Excel cell ranges directly from function calls in the cells, to and from the C/C++ dll.
A return type is needed to tell Excel of the parameter data types and return type though...
|
|
|
|
|
Hi all,
I want to enumerate all users in my active directory.
I found a class, but the file sddl.h is missing and there was no answer to questions regarding this file. I search the internet and all I found was, that I should use the Microsoft platform SDK. Well, I don't have it.
So, how can I get all the usernames in my active directory?
Juergen
|
|
|
|