LVectorWindow::MsgProcCallBack
#include "ltwrappr.h"
LRESULT LVectorWindow::MsgProcCallBack(hWnd, uMsg, wParam, lParam)
HWND hWnd; |
/* handle to the vector window */ |
UINT uMsg; |
/* the window message */ |
WPARAM wParam; |
/* the first parameter of the window message */ |
LPARAM lParam; |
/* the second parameter of the window message */ |
This function is called for each message the vector window control receives.
Parameter |
Description |
hWnd |
Handle to the vector window. |
uMsg |
The window message. |
wParam |
The first parameter of the window message. |
lParam |
The second parameter of the window message. |
Returns
The result of processing a specific message.
Comments
Override this function to do your own processing of window events and messages. If you override this function you must call the base class implementation (LVectorWindow::MsgProcCallBack) for default processing. Some of the messages that you may want procces include:
Mouse messages (WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_LBUTTONUP, WM_RBUTTONUP, WM_MOUSEMOVE)
Key messages (WM_KEYDOWN, WM_KEYUP, WM_CHAR). For a list of messages, see Bitmap and Vector Change Notifications and Notification Categories.
Scrolling Messages (WM_HSCROLL,WM_VSCROLL).
Other messages (WM_SETFOCUS, WM_KILLFOCUS, WM_SIZE).
Required DLLs and Libraries
LVKRN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
Example
The following example derives a class from LVectorWindow, and overrides MsgProcCallBack, OnFileDropped, OnDraw, OnZoom, OnScale, StartChanging, EndChanging member functions. The result is class that displays all vector window messages in the vector window title bar. To use this example, derive a class from LMyVectorWindow, and use the class object as you would a LVectorWindow object.
All mouse messages, scrolling messages, key messages, drag drop messages, as well as any vector specific messages will be displayed in the window title bar.
/***********************************************************************/
//MyVecWnd.h
#ifndef _MY_VECTOR_WINDOW_H_
#define _MY_VECTOR_WINDOW_H_
#include "d:\lead14\dll\include\classlib\ltwrappr.h"
class LMyVectorWindow: public LVectorWindow
{
public:
LMyVectorWindow();
virtual ~LMyVectorWindow() ;
protected:
virtual LRESULT MsgProcCallBack(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
virtual L_BOOL OnFileDropped(L_TCHAR L_FAR* pszFile,L_UINT uFileNumber,L_UINT uFilesCount);
virtual L_VOID OnDraw(HDC hdc,RECT& Rect);
virtual L_VOID OnZoom(L_INT ZoomPercent);
virtual L_VOID OnScale(VECTORPOINT ScalePercent);
virtual L_INT StartChanging(L_UINT nChangeType,L_UINT nChangeCategory);
virtual L_VOID EndChanging(L_UINT nChangeType,L_UINT nChangeCategory,L_INT nRetCode);
L_VOID DisplayMessage(L_TCHAR L_FAR *lpszMsg);
};
#endif _MY_VECTOR_WINDOW_H_
/***********************************************************************/
//MyVecWnd.cpp
#include "MyVecWnd.h"
#include <stdio.h>
LMyVectorWindow::LMyVectorWindow()
{
}
LMyVectorWindow::~LMyVectorWindow()
{
}
LRESULT LMyVectorWindow::MsgProcCallBack(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
L_TCHAR L_FAR *lpszMsg;
static iCount = 0;
iCount = (iCount + 1)% 1000;
switch (uMsg)
{
case WM_LBUTTONDOWN:
lpszMsg = TEXT("WM_LBUTTONDOWN");
break;
case WM_RBUTTONDOWN:
lpszMsg = TEXT("WM_RBUTTONDOWN");
break;
case WM_LBUTTONUP:
lpszMsg = TEXT("WM_LBUTTONUP");
break;
case WM_RBUTTONUP:
lpszMsg = TEXT("WM_RBUTTONUP");
break;
case WM_MOUSEMOVE:
lpszMsg = TEXT("WM_MOUSEMOVE");
break;
case WM_SETFOCUS:
lpszMsg = TEXT("WM_SETFOCUS");
break;
case WM_KILLFOCUS:
lpszMsg = TEXT("WM_KILLFOCUS");
break;
case WM_KEYDOWN:
lpszMsg = TEXT("WM_KEYDOWN");
break;
case WM_KEYUP:
lpszMsg = TEXT("WM_KEYUP");
break;
case WM_CHAR:
lpszMsg = TEXT("WM_CHAR");
break;
case WM_HSCROLL:
lpszMsg = TEXT("WM_HSCROLL");
break;
case WM_VSCROLL:
lpszMsg = TEXT("WM_VSCROLL");
break;
case WM_SIZE:
lpszMsg = TEXT("WM_SIZE");
break;
default:
lpszMsg = NULL;
}
DisplayMessage(lpszMsg);
return LVectorWindow::MsgProcCallBack( hWnd, uMsg, wParam, lParam);
}
L_BOOL LMyVectorWindow::OnFileDropped(L_TCHAR L_FAR* pszFile,L_UINT uFileNumber,L_UINT uFilesCount)
{
L_TCHAR szMsg[256];
wsprintf(szMsg, TEXT("OnFileDropped(%s, %d, %d)"), pszFile, uFileNumber, uFilesCount);
DisplayMessage(szMsg);
return LVectorWindow::OnFileDropped( pszFile, uFileNumber, uFilesCount);
}
L_VOID LMyVectorWindow::OnDraw(HDC hdc,RECT& Rect)
{
L_TCHAR szMsg[256];
wsprintf(szMsg, TEXT("OnDraw(%d, %d, %d, %d)"), Rect.left, Rect.top, Rect.right, Rect.bottom);
DisplayMessage( szMsg);
}
L_VOID LMyVectorWindow::OnZoom(L_INT ZoomPercent)
{
L_TCHAR szMsg[256];
wsprintf(szMsg, TEXT("OnZoom[%d]"), ZoomPercent);
DisplayMessage(szMsg);
}
L_VOID LMyVectorWindow::OnScale(VECTORPOINT ScalePercent)
{
L_TCHAR szMsg[256];
wsprintf(szMsg, TEXT("OnScale[%lf, %lf, %lf]"), ScalePercent.x, ScalePercent.y, ScalePercent.z);
DisplayMessage(szMsg);
}
L_INT LMyVectorWindow::StartChanging(L_UINT nChangeType,L_UINT nChangeCategory)
{
L_TCHAR L_FAR *lpszMsg = NULL;
switch(nChangeType)
{
case NC_VECTOR_ROTATE:
lpszMsg = TEXT("StartChanging[NC_VECTOR_ROTATE]");
break;
case NC_VECTOR_TRANSLATE:
lpszMsg = TEXT("StartChanging[NC_VECTOR_TRANSLATE]");
break;
case NC_VECTOR_SCALE:
lpszMsg = TEXT("StartChanging[NC_VECTOR_SCALE]");
break;
case NC_VECTOR_DIALOG_3DOPTIONS:
lpszMsg = TEXT("StartChanging[NC_VECTOR_DIALOG_3DOPTIONS]");
break;
case NC_VECTOR_CAMERA:
lpszMsg = TEXT("StartChanging[NC_VECTOR_CAMERA]");
break;
case NC_VECTOR_FREE:
lpszMsg = TEXT("StartChanging[NC_VECTOR_FREE]");
break;
case NC_VECTOR_BACKCOLOR:
lpszMsg = TEXT("StartChanging[NC_VECTOR_BACKCOLOR]");
break;
case NC_VECTOR_VIEW_MODE:
lpszMsg = TEXT("StartChanging[NC_VECTOR_VIEW_MODE]");
break;
case NC_VECTOR_PAN:
lpszMsg = TEXT("StartChanging[NC_VECTOR_PAN]");
break;
case NC_VECTOR_BIND_VERTICES:
lpszMsg = TEXT("StartChanging[NC_VECTOR_BIND_VERTICES]");
break;
case NC_VECTOR_DELETE_OBJECT:
lpszMsg = TEXT("StartChanging[NC_VECTOR_DELETE_OBJECT]");
break;
case NC_VECTOR_SELECT_OBJECT:
lpszMsg = TEXT("StartChanging[NC_VECTOR_SELECT_OBJECT]");
break;
case NC_VECTOR_POLYGON_MODE:
lpszMsg = TEXT("StartChanging[NC_VECTOR_POLYGON_MODE]");
break;
case NC_VECTOR_USE_LIGHTS:
lpszMsg = TEXT("StartChanging[NC_VECTOR_USE_LIGHTS]");
break;
case NC_VECTOR_AMBIENT_COLOR:
lpszMsg = TEXT("StartChanging[NC_VECTOR_AMBIENT_ COLOR]");
break;
}
if (lpszMsg != NULL)
{
DisplayMessage(lpszMsg);
}
return LVectorWindow::StartChanging(nChangeType,nChangeCategory);
}
L_VOID LMyVectorWindow::EndChanging(L_UINT nChangeType,L_UINT nChangeCategory,L_INT nRetCode)
{
L_TCHAR L_FAR *lpszMsg;
lpszMsg = NULL;
switch(nChangeType)
{
case NC_VECTOR_ROTATE:
lpszMsg = TEXT("EndChanging[NC_VECTOR_ROTATE]");
break;
case NC_VECTOR_TRANSLATE:
lpszMsg = TEXT("EndChanging[NC_VECTOR_TRANSLATE]");
break;
case NC_VECTOR_SCALE:
lpszMsg = TEXT("EndChanging[NC_VECTOR_SCALE]");
break;
case NC_VECTOR_DIALOG_3DOPTIONS:
lpszMsg = TEXT("EndChanging[NC_VECTOR_DIALOG_3DOPTIONS]");
break;
case NC_VECTOR_CAMERA:
lpszMsg = TEXT("EndChanging[NC_VECTOR_CAMERA]");
break;
case NC_VECTOR_FREE:
lpszMsg = TEXT("EndChanging[NC_VECTOR_FREE]");
break;
case NC_VECTOR_BACKCOLOR:
lpszMsg = TEXT("EndChanging[NC_VECTOR_BACKCOLOR]");
break;
case NC_VECTOR_VIEW_MODE:
lpszMsg = TEXT("EndChanging[NC_VECTOR_VIEW_MODE]");
break;
case NC_VECTOR_PAN:
lpszMsg = TEXT("EndChanging[NC_VECTOR_PAN]");
break;
case NC_VECTOR_BIND_VERTICES:
lpszMsg = TEXT("EndChanging[NC_VECTOR_BIND_VERTICES]");
break;
case NC_VECTOR_DELETE_OBJECT:
lpszMsg = TEXT("EndChanging[NC_VECTOR_DELETE_OBJECT]");
break;
case NC_VECTOR_SELECT_OBJECT:
lpszMsg = TEXT("EndChanging[NC_VECTOR_SELECT_OBJECT]");
break;
case NC_VECTOR_POLYGON_MODE:
lpszMsg = TEXT("EndChanging[NC_VECTOR_POLYGON_MODE]");
break;
case NC_VECTOR_USE_LIGHTS:
lpszMsg = TEXT("EndChanging[NC_VECTOR_USE_LIGHTS]");
break;
case NC_VECTOR_AMBIENT_COLOR:
lpszMsg = TEXT("EndChanging[NC_VECTOR_AMBIENT_COLOR]");
break;
}
if (lpszMsg != NULL)
{
DisplayMessage(lpszMsg);
}
LVectorWindow::EndChanging( nChangeType, nChangeCategory, nRetCode);
}
L_VOID LMyVectorWindow::DisplayMessage(L_TCHAR L_FAR *lpszMsg)
{
if (lpszMsg != NULL)
{
HWND hWnd;
if (IsControl())
hWnd = ::GetParent(GetVectorWnd());
else
hWnd = GetVectorWnd();
SetWindowText(hWnd, lpszMsg);
}
}
/***********************************************************************/