|
|
i saved lparam and wparam values when a key
(say U)pressed on a perticuler edit box.
i want to use these values of lparam and wparam again on different edit box.in order to see that key
(say U) .
is that code is correct or not for that purpose?
is there any change in logic if yes then plz tell?
LPEVENTMSG lpEvent= (LPEVENTMSG)lParam;
PostMessage(different_hWnd,
lpEvent->message,wParam,lParam);
second edit box reside on different process.
r00d0034@yahoo.com
|
|
|
|
|
Hello,
I have a program works like windows explorer that contains a treeview and listview control. When I select an item a blue border will be marked to the selected item. If I select an item in the menu the blue border goes away because the control is losing focus. I noticed that Windows Explorer can keep the blue border in the folder pane and the file pane even a menu item is being selected so you know what item and control you're going to send command to like rename and delete. Do you know how to do it?
Thanks,
Hiu Sing Ngai
|
|
|
|
|
Try the Show Selection Always style...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Even with the LVS_SHOWSELALWAYS style, the selection mark goes gray in color when you select a menu item.
|
|
|
|
|
Custom or ownerdraw my friend...
Have fun
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
What the heck happens to scrollbars when you override this friggen function...?
They're obviosuly painted over or something cuz they disappear, but when I click anywhere near they were before...they magically start re-appearing only to get lost again when window is minimized or goes off screen...???
What the heck...? Do I have to draw my own scrollbars when I override OnNcPaint()
I also have overriden the following:
void CCustomList::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp)
{
lpncsp->rgrc->left += 100;
CListBox::OnNcCalcSize(bCalcValidRects, lpncsp);
}
What is going on...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
The scrollbars are in the non-client area, so OnNcPaint() is where they normally get drawn. You can either draw them yourselves, or call the default code.
Hockey wrote:
I also have overriden the following:
Yeah, that's prolly ok; you're gonna be drawing something in the left margin, yes?
Shog9
------
So they took me down to the gallows
And this boy, he said to me:
"Why do you smile, when the rope's around your neck?"
I said, "I tell you boy, when i get back..."
|
|
|
|
|
Shog9 wrote:
The scrollbars are in the non-client area, so OnNcPaint() is where they normally get drawn. You can either draw them yourselves, or call the default code.
I'd much rather just do my custom drawing and let windows handle the rest...
How are you suppose to do this thou...?
AppWizard leaves a comment saying DO NOT call CListBox::OnNcPaint()
I want to draw only on the left NON client side...ignoring anything client or right side non-client...
CRect rect;
GetClientRect(rect);
CDC* pDC = GetDC();
rect.left -= 100;
rect.right = 0;
pDC->FillSolidRect(rect, RGB(128,0,0));
How would I allow default drawing code to update those scrollbars for me...?
Thanx man!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
AppWizard leaves a comment saying DO NOT call CListBox::OnNcPaint()
Yeah... i don't know why though. Give it a try, if it breaks then you'll know.
Shog9
------
So they took me down to the gallows
And this boy, he said to me:
"Why do you smile, when the rope's around your neck?"
I said, "I tell you boy, when i get back..."
|
|
|
|
|
I'll try it...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Well it didn't choke...
Thanx bro...I wouldn't have even tried it cuz that stupid comment...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Please, help me ...
Do you know where is the Windows 2000 registry key for time divison? how can it be modified?
|
|
|
|
|
Hi,
Im trying to scale a DC of a CWnd derivade (NOT CVIEW) and im not getting any success.
Ive tried
CDC::ScaleWindowExt(...)
and
CDC::ScaleViewportExt(...),
among others. Also im using scroll bars in that window... does that affect it?
Thanks in advanced
|
|
|
|
|
What mapping mode are you using...?
MM_ISOTROPIC ...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Ive already tried with MM_ISOTROPIC and MM_ANISOTROPIC and MM_TEXT, but no success so far. Right now, i dont have a limitation in using any of type of mapping mode. Maybe im using it wrong. U have a good example?
|
|
|
|
|
One of my books shows exactly how this is accomplished...if I have some spare time in the next few i'll look into for you if someone hasn't answered it already...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I managed to get this doing something like what you want (i think) but i'm gonna count on you to figure out how it works...
OnPaint() : // make sure you call invalidate inside OnSize()
CPaintDC dc(this);
CRect rect;
GetClientRect(rect);
dc.SetMapMode(MM_ISOTROPIC);
dc.SetWindowExt(rect.Width(), rect.Height());
dc.SetViewportOrg(0, 0);
dc.LineTo(CPoint(200, 200));
dc.LineTo(CPoint(0, 200));
dc.LineTo(CPoint(200, 0));
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
k, i found how it can work, but it needs some changes:
U have to call CDC::SetViewportExt(...)
It works something like this:
1st SetMapMode(MM_ISOTROPIC)
2nd SetWindowExt(200,300) - carefull here, cause it sets the portion of the window to be considered
3rd SetViewportExt(rect.Width(), rect.Height()), to set the corresponding size of the "view"
thanks for the guidance
|
|
|
|
|
Hey again!
I haver found something in the MSDN:
CRITICAL_SECTION GlobalCriticalSection;
InitializeCriticalSection(&GlobalCriticalSection);
__try
{
EnterCriticalSection(&GlobalCriticalSection);
}
__finally
{
LeaveCriticalSection(&GlobalCriticalSection);
}
Inside the try clause I access all my global data I want to access in my thread and other running threads that try access the same data has to wait untill the critical section is over (in the finally clause)... RIGHT?
Did I understand this code right or wrong?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard Andersson wrote:
Inside the try clause I access all my global data I want to access in my thread and other running threads that try access the same data has to wait untill the critical section is over (in the finally clause)... RIGHT?
Err... Half-wrong...
Only between the EnterCriticalSection and LeaveCriticalSection.
The __try/__finally is there only to assure that even when there's an exception or a SEH (aka GPF) you call LeaveCriticalSection, because this could lead to the locks being held forever if not done this way.
Q261186 - Computer Randomly Plays Classical Music
|
|
|
|
|
Daniel Turini wrote:
Only between the EnterCriticalSection and LeaveCriticalSection
Yeah but it was something like that I mant!
But when __try has finished __finally will be next jump in the code, isn't it?
and did you mean that EnterCriticalSection will lock for ever if I don't have an __try/__finally statement?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard Andersson wrote:
and did you mean that EnterCriticalSection will lock for ever if I don't have an __try/__finally statement?
MAY lock forever, not WILL lock forever.
If you have a bug in the code between the Enter/Leave pair, your code may not execute the Leave part, leaving the CS locked forever.
So, take care with the code you put between this.
That's why the __try/__finally is there: as an assurance that the Leave will execute always, even on crash or error situations.
Q261186 - Computer Randomly Plays Classical Music
|
|
|
|
|
I personally don't like the __try/__finally. If an error happens that leaves the global data in an unstable state, simply releasing the critical section, absent anything else, isn't going to make the code any more stable and arguably less.
|
|
|
|
|
Basically yes. Be aware, however, that the critical section should be as short as possible to prevent thread stalling. I would examine your global data carefully to make sure you aren't guarding things that don't need guarding.
In other words, if the global data in question is a series of unrelated items, you don't want to guard all of them with a single critical section; a common mistake.
Also be aware that if you need to share a single value, check out the Interlocked...() series of calls.
|
|
|
|