I have a moduless dialog which has WS_CHILD property in a dll and used as an child in a view. when the dialog has focus ,it look the accelerator key massage as a dialog message and does not pass to it's parent(the view),while my purpose is that it should route the msg to the view and the dispatch to any it's child.Please tell me how to achieve this. some presetive code goes: In the view class: BOOL CTestAccelView::PreTranslateMessage(MSG* pMsg) { if(TranslateAccelerator(m_hWnd,m_hAccelTest,pMsg)) return TRUE; if(m_pTestDlgWnd && m_pTestDlgWnd->GetSafeHwnd() ) if(m_pTestDlgWnd->PreTranslateMessage(pMsg)) return TRUE; if(m_pTestDlgWnd2 && m_pTestDlgWnd2->GetSafeHwnd()) if(m_pTestDlgWnd2->PreTranslateMessage(pMsg)) return TRUE; return CView::PreTranslateMessage(pMsg); }
In the Dialog class: BOOL CTestDlg::PreTranslateMessage(MSG* pMsg) { if(TranslateAccelerator(m_hWnd,m_hAccelTest,pMsg)) { return TRUE; } if(IsDialogMessage(pMsg)) { return TRUE; } return CWnd::PreTranslateMessage(pMsg); }
Scratch
Lizp
Posts
-
PreTranslateMessage Problem??? -
How to get the caller of a fuction?It's a good idea,but didn't fit my application. Scratch
-
How to get the caller of a fuction?at run time i want to known a fuction's caller ,how can? for example: void a(int i) { CString szCaller = GetTheCaller(); MessageBox(szCaller); } void b(int j) { a(j); } I'd like to get a message :"void b(int j)" How to implement method "GetTheCaller()" Scratch
-
XML DOM in ATLOk,that's it ,thanks. Scratch
-
How to test a thread handle is valid handle?thank you for your help,but my code goes like: In main thread.
if(m_pScanThread && m_pScanThread->m_hThread != NULL) { m_pScanThread->PostThreadMessage(UWM_TIMERON,0,0); } else { m_pScanThread = AfxBeginThread((AFX_THREADPROC)fnScanProc,NULL); if(m_pScanThread && m_pScanThread->m_hThread != NULL) m_pScanThread->PostThreadMessage(UWM_TIMERON,0,0); }
Thread function.CoInitializeEx(NULL,COINIT_MULTITHREADED ); try { //Do some Initialize DWORD dwRet; MSG msg; while(dwRet = GetMessage(&msg,NULL,0,0) != 0) { if(dwRet == -1) { continue; } else { if(msg.message == UWM_TIMERON) Scan(...); else DispatchMessage(&msg); } } } catch(...) { return -1;**///Here! if return then the m_pScanThread's( member of the main ///thread)member m_hThread is 0xfeeefeee ///and at this time i want to re - AfxBeginThread...** ::CoUninitialize(); } ::CoUninitialize(); return 0;
Scratch -
How to test a thread handle is valid handle?I have a thread handle,when the thread exit.the handle is invalid(0xfeeefeee). and i want to clearly when is it valid and when is it invalid. please show me a solution,thanks. Scratch
-
Enlist the Transaction of two transactional com+ objectObject A was configged as "Requer Transaction" property and Object B(Actually is a databass access object to oracle and use ado to access to the datasource) was configged as "Supported Transaction" one.now A will invoke B and B must run in the Transaction context.is that practical and how to write the implement code of enlist the two transaction? thank you. Scratch
-
Problem with Recordset(ADO)When use VB your advice is work very well,while using VC++ this seem does not work. Scratch
-
Problem with Recordset(ADO)Hi. After added a record into a Recordset(offline),how to access the new added record? Scratch
-
How to pass out an array from a com+ object?Thank for your help! And how to avoid registerring the interfaces as automation marshaler? Scratch
-
How to pass out an array from a com+ object?I am developing an application which need to pass an array from a com+ object to the client,the object runs at the server and the client app runs at a workstation.the problem is i can't get the actual array at the client's side. some represetative code follows: //.idl [id(15), helpstring("method GetAllPolicyID")] HRESULT GetAllPolicyID([in,out]long* size,[out,size_is(,*size)] long** PolicyID); //.cpp *size=pRst->RecordCount; *PolicyID=(ULONG*)CoTaskMemAlloc(*size*sizeof(ULONG)); for(long i=0;i<*size;i++) { if(!pRst->adoEOF) { vt=pRst->GetCollect("POLICYID"); (*PolicyID)[i]=vt.lVal; pRst->MoveNext(); } } Scratch
-
What's that?Anybody know? Scratch
-
What's that?Hi. I am developing a dialog based app.a costum header file for common defination has been included in stdafx.h,when i build the app,the compiler say the common definations is redefined in appname.obj.However after I install the latest MS Platform sdk,the problem disappear.Please tell me why?
-
How to register a environment variable ?For Visual Studio . Scratch
-
how can get the CPU info!Try GetSystemInfo(). Scratch
-
Where comes the prerolling filter?When I use ICaptureGraphBuilder2::FindInterface() method to find a specific filter (say IAMVideoCompression).It give two messageboxes that "Please wait until preroll is completed!" and ASSERT Failed ((HRESULT)BreakConnect()) >=0) At line 2005 of ..\DXSDK\Samples\Multimedia\DirectShow\BaseClasses\amfi lter.cpp),but my sourcefilter doesn't need preroll and i had not add any prerolling filter to the graph.The reprentative code like : IAMVideoCompression *pVC=NULL; if(FAILED(m_pCapture->FindInterface (&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video,m_pSF7146,IID_IAMV ideoCompression,(void**)&pVC))) { return S_FALSE; } My work environment is DirectX8.1SDK + VC++6.0 + WinXP. Please help me to release these errors to get my work continue,thank you advaced! Scratch
-
How to get the App(.EXE)'s full path in MFC application?It's seem that the App's m_pszAppName and m_pszExeName member only contain the module name,is there a way to get the App's full path? Scratch
-
Why cannot I get a DC of a window in sometime after a longtime runningIt's get work, thank you ! Scratch
-
Why cannot I get a DC of a window in sometime after a longtime runningThank you,I will try it. Scratch
-
Why cannot I get a DC of a window in sometime after a longtime runningHi All,I have some trouble: The symptom is I have a child window(CStatic)to display status information,it must be updated every second,after a longtime running(maybe 20 minute),then i only got a NULL DC pointer,and then system give me a notification that the resource requred can't acquire.at the same time get into mass. Any help will be appreciated. some representive code(in a method of a CStatic derived class): CDC* pDC=NULL; pDC=GetDC(); if(pDC==NULL) { TRACE("Draw Label Failed!\n"); return FALSE; } CRect rc; if(::GetClientRect(m_hWnd,&rc)) { PaintBk(pDC,rc); int iDC=pDC->SaveDC(); pDC->SetBkColor(0); pDC->SetTextColor(m_FontColor); pDC->SelectObject(&m_Font); pDC->DrawText(m_szLabel,&rc,DT_VCENTER|DT_SINGLELINE); pDC->RestoreDC(iDC); return TRUE; } Scratch