|
|
Below code is incomplete, I will update it once i am free.
HOOKPROC hNewHook;
if ( (void*&)hNewHook ) == FALSE )
{
hNewHook = (HOOKPROC)SetWindowsHookEx( WH_CALLWNDPROC, (HOOKPROC)CallWndProc, NULL, GetCurrentThreadId() );
}
UnhookWindowsHookEx( (HHOOK)hHookProc );
static LRESULT CALLBACK CallWndProc( int nCode, WPARAM wParam, LPARAM lParam )
{
HOOKPROC hHookProc;
return CallNextHookEx( (HHOOK)hHookProc, nCode, wParam, lParam );
}
modified 13-Jul-12 3:26am.
|
|
|
|
|
call this function as shown below,
HBITMAP hNew;
hbmp = (HBITMAP) ::LoadImage(::AfxFindResourceHandle(MAKEINTRESOURCE(nMenuResId), RT_BITMAP), MAKEINTRESOURCE(nMenuResId), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_CREATEDIBSECTION);
hNew = SetTransparentBitmap(hNew, RGB(191, 191, 191));
Here Parameter RGB(191, 191, 191) is gray color which i was transparent Color in my case. it should be replaced with yours.
HBITMAP SetTransparentBitmap( HBITMAP hbm, COLORREF clrTransparent)
{
HDC hdcSrc = CreateCompatibleDC(NULL);
HDC hdcDst = CreateCompatibleDC(NULL);
HBITMAP hbmOld, hbmOld2, hbmNew;
BITMAP bm;
GetObject(hbm, sizeof(bm), &bm);
hbmOld = (HBITMAP)SelectObject(hdcSrc, hbm);
hbmNew = CreateBitmap( bm.bmWidth, bm.bmHeight, bm.bmPlanes, bm.bmBitsPixel, NULL);
hbmOld2 = (HBITMAP)SelectObject(hdcDst, hbmNew);
RECT rt;
rt.top = rt.left = 0;
rt.right = bm.bmWidth;
rt.bottom = bm.bmHeight;
HBRUSH hBrush = CreateSolidBrush(RGB(255, 255, 255));
Parameter RGB(255, 255, 255) passed in above function is white color which was background color in my case, it should be replaced with yours.
FillRect(hdcDst, &rt, hBrush);
DeleteObject(hBrush);
TransparentBlt(hdcDst, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, bm.bmWidth, bm.bmHeight,
clrTransparent);
SelectObject(hdcSrc, hbmOld);
DeleteDC(hdcSrc);
DeleteDC(hdcDst);
return hbmNew;
}
Got this helped by below link:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/88c7d2fc-32fe-44ce-b367-48d4fd114c09#88c7d2fc-32fe-44ce-b367-48d4fd114c09[^]
|
|
|
|
|
http://www.flounder.com/nomultiples.htm
|
|
|
|
|
BACKUP LOG %DB_NAME% WITH TRUNCATE_ONLY
DBCC SHRINKFILE (%LOG_NAME%, %LOG_SIZE%)
|
|
|
|
|
BOOL CMViewApp::SwitchView(CRuntimeClass *pNewView, int nRowView, int nColView)
{
CFrameWnd* pMainWnd = (CFrameWnd*)AfxGetMainWnd();
// CView* pOldActiveView = pMainWnd->GetActiveView();
CView* pOldActiveView = (CView *)((CMainFrame *)pMainWnd)->m_wndSplitter.GetPane(nRowView, nColView);
CDocument* pCurrentDoc = ((CFrameWnd*)m_pMainWnd)->GetActiveDocument();
CSplitterWnd* pSplitter = (CSplitterWnd *)pOldActiveView->GetParent();
//int row, col;
ASSERT(pSplitter->IsChildPane(pOldActiveView, nRowView, nColView));
CRect viewrect;
pOldActiveView->GetWindowRect(&viewrect);
// set flag so that document will not be deleted when view is destroyed
m_bAutoDelete = FALSE;
// Delete existing view
pOldActiveView->DestroyWindow();
// Create new view
CCreateContext context;
context.m_pNewViewClass = pNewView;
context.m_pCurrentDoc = pCurrentDoc;
context.m_pNewDocTemplate = NULL;
context.m_pLastView = NULL;
context.m_pCurrentFrame = NULL;
if (!pSplitter->CreateView(nRowView, nColView, pNewView, viewrect.Size(),
&context))
{
return FALSE; //error occured,
}
pMainWnd->InitialUpdateFrame(pCurrentDoc, TRUE);
// Set active
CView* pNewViewClass = (CView *)pSplitter->GetPane(nRowView, nColView);
pSplitter->GetParentFrame()->SetActiveView(pNewViewClass);
pSplitter->RecalcLayout();
pNewViewClass->SendMessage(WM_PAINT);
return TRUE;
}
|
|
|
|
|