分类:
2006-06-27 16:48:29
#include case MSG_CLOSE: return DefaultMainWinProc(hWnd, message, wParam, lParam); int MiniGUIMain (int args, const char* arg[]) ShowWindow(hMainWnd, SW_SHOWNORMAL);
while (GetMessage(&Msg, hMainWnd)) { MainWindowThreadCleanup (hMainWnd);
return 0; #ifndef _LITE_VERSION
#include
#include
#include
int x,y;
static int WinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case MSG_KEYDOWN:
switch (LOWORD(wParam)){
case 105:
x-=5;
SetCursorPos(x,y);
break;
case 106:
x+=5;
SetCursorPos(x,y);
break;
case 103:
y-=5;
SetCursorPos(x,y);
break;
case 108:
y+=5;
SetCursorPos(x,y);
break;
}
break;
DestroyAllControls (hWnd);
DestroyMainWindow (hWnd);
PostQuitMessage (hWnd);
return 0;
}
}
{
MSG Msg;
HWND hMainWnd;
MAINWINCREATE CreateInfo;
x=100;y=100;
SetCursorPos(x,y);
#ifdef _LITE_VERSION
SetDesktopRect(0, 0, 1024, 768);
#endif
CreateInfo.dwstyle = WS_VISIBLE | WS_BORDER | WS_CAPTION;
CreateInfo.dwExstyle = WS_EX_NONE;
CreateInfo.spCaption = "demo of key control mouse";
CreateInfo.hMenu = 0;
CreateInfo.hCursor = GetSystemCursor(0);
CreateInfo.hIcon = 0;
CreateInfo.MainWindowProc = WinProc;
CreateInfo.lx = 0;
CreateInfo.ty = 0;
CreateInfo.rx = 320;
CreateInfo.by = 240;
CreateInfo.iBkColor = COLOR_lightwhite;
CreateInfo.dwAddData = 0;
CreateInfo.hHosting = HWND_DESKTOP;
hMainWnd = CreateMainWindow (&CreateInfo);
if (hMainWnd == HWND_INVALID)
return -1;
//TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
#include
#endif
用SendMessage行吗?我做过实验,
SendMessage(hWnd, MSG_MOUSEMOVE , 0 ,0);这样做肯定是不行的,
你的问题我想大概是这个原因,因为qvfb跑在X Windows上,而X Windows有自己的光标位置,而MiniGUI是跑在qvfb上,所以MiniGUI不能改变X Window的光标位置了。