Click here to Skip to main content
15,914,225 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Registry Pin
Alexander M.,28-Aug-03 3:49
Alexander M.,28-Aug-03 3:49 
GeneralRe: Registry Pin
pranavamhari28-Aug-03 6:27
pranavamhari28-Aug-03 6:27 
QuestionIsBadReadPtr? Pin
Dominik Reichl27-Aug-03 23:55
Dominik Reichl27-Aug-03 23:55 
AnswerRe: IsBadReadPtr? Pin
Anders Molin27-Aug-03 23:56
professionalAnders Molin27-Aug-03 23:56 
GeneralRe: IsBadReadPtr? Pin
Dominik Reichl28-Aug-03 0:33
Dominik Reichl28-Aug-03 0:33 
GeneralRe: IsBadReadPtr? Pin
Anders Molin28-Aug-03 1:04
professionalAnders Molin28-Aug-03 1:04 
GeneralRe: IsBadReadPtr? Pin
Dominik Reichl28-Aug-03 1:08
Dominik Reichl28-Aug-03 1:08 
QuestionHow to set focus on ActiveX control in CMDIChildWnd ? Pin
vipsy27-Aug-03 23:46
vipsy27-Aug-03 23:46 
It looks like a very simple question, but I stuck with it !

I have the selfwritten ATL ActiveX. Then I wanted to place it inside the MFC window such as CMDIChildWnd to fill the entire client area. The only thing I want is that my ActiveX can get focus when the hosting window is activated. So I put the following code:

void CMyFrame::OnSetFocus(CWnd* pOldWnd) {
if (m_pView!=NULL)
m_pView->SetFocus();
else
CMDIChildWnd::OnSetFocus(pOldWnd);
}
where the CMyFrame is frame derived from CMDIChildWnd,
m_pView - my ActiveX pointer. It has a type of pointer to the ActiveX CWnd_wrapper created by the VC7 wizard "MFC Class from ActiveX control".

The problem is that my control gets focus only once - the first time the hosting window is activated.

I've tested my ActiveX in the simple dialog window - all is ok...

The ActiveX is created as:
int CMyFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
m_pView = new CMyControl;
if (m_pView!=NULL) {
CRect rect(0,0,0,0);
m_pView->Create(NULL,WS_CHILD | WS_VISIBLE | WS_TABSTOP,rect,this,1); // "this" - is a parent CMDIChildWnd
...

Does anybody has an idea ?
Thank you very much

P.S.

Actually I know the reason of that Smile | :)
I separated my message in two parts:
If I do something completly wrong, then you will see it from the first part - please tell me if its so Smile | :)

Now the details:
m_pView->SetFocus() actually does the DoVerb(OLEIVERB_UIACTIVATE) i.e. activates my ActiveX UI.
This is done internally by the COleControlSite::SetFocus.
The problem is that default implementation of COleControlSite ignores OnFocus(FALSE) event that comes from my ActiveX when it loses the focus. COleControlSite does not call UIDeactivate upon this event.

Since my control was once OLEIVERB_UIACTIVATEed and was not UIDeactivated it ignored the next DoVerb(OLEIVERB_UIACTIVATE) though it losts the focus (the ATL implementation).

I cannot modify this code since its in the ATL & MFC...
GeneralBrowse Dlg Box Help !!!!!!!!!!!!!!!! Pin
27-Aug-03 23:44
suss27-Aug-03 23:44 
QuestionHow to chanhe clipping position of WindowLess ActiveX ? Pin
vgrigor27-Aug-03 22:47
vgrigor27-Aug-03 22:47 
GeneralEasy question Pin
Scozturk27-Aug-03 22:35
professionalScozturk27-Aug-03 22:35 
GeneralRe: Easy question Pin
Steve S27-Aug-03 22:38
Steve S27-Aug-03 22:38 
GeneralRe: Easy question Pin
Scozturk27-Aug-03 22:44
professionalScozturk27-Aug-03 22:44 
GeneralRe: Easy question Pin
Bob Stanneveld29-Aug-03 4:43
Bob Stanneveld29-Aug-03 4:43 
GeneralFiles Pin
Scozturk27-Aug-03 22:29
professionalScozturk27-Aug-03 22:29 
GeneralRe: Files Pin
David Crow28-Aug-03 2:49
David Crow28-Aug-03 2:49 
GeneralInterrupt a long time operation Pin
CodeBrain27-Aug-03 22:17
CodeBrain27-Aug-03 22:17 
GeneralRe: Interrupt a long time operation Pin
d_lite27-Aug-03 22:33
d_lite27-Aug-03 22:33 
GeneralRe: Interrupt a long time operation Pin
CodeBrain28-Aug-03 0:44
CodeBrain28-Aug-03 0:44 
GeneralRe: Interrupt a long time operation Pin
David Crow28-Aug-03 2:54
David Crow28-Aug-03 2:54 
GeneralRe: Interrupt a long time operation Pin
CodeBrain28-Aug-03 4:03
CodeBrain28-Aug-03 4:03 
GeneralCRichEditCtrl Pin
hph27-Aug-03 22:02
hph27-Aug-03 22:02 
GeneralRe: CRichEditCtrl Pin
CodeBrain27-Aug-03 22:23
CodeBrain27-Aug-03 22:23 
Generali need something look like TimeLine Window in Flash Pin
HeartFriend27-Aug-03 20:40
HeartFriend27-Aug-03 20:40 
GeneralUnicode sscanf from a CString Pin
Ravi Bhavnani27-Aug-03 19:38
professionalRavi Bhavnani27-Aug-03 19:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.