// Create Console View as child of Main Window void CreateConsoleView(HWND hwndParent, int x, int y, int width, int height) { ASSERT(hwndParent != NULL); g_hwndConsole = CreateWindow( CLASSNAME_TOOLWINDOW, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, x, y, width, height, hwndParent, NULL, g_hInst, NULL); SetWindowText(g_hwndConsole, _T("Debug Console")); // ToolWindow subclassing m_wndprocConsoleToolWindow = (WNDPROC) LongToPtr( SetWindowLongPtr( g_hwndConsole, GWLP_WNDPROC, PtrToLong(ConsoleViewWndProc)) ); RECT rcConsole; GetClientRect(g_hwndConsole, &rcConsole); m_hwndConsoleEdit = CreateWindowEx( WS_EX_CLIENTEDGE, _T("EDIT"), NULL, WS_CHILD | WS_VISIBLE, 90, rcConsole.bottom - 20, rcConsole.right - 90, 20, g_hwndConsole, NULL, g_hInst, NULL); m_hwndConsoleLog = CreateWindowEx( WS_EX_CLIENTEDGE, _T("EDIT"), NULL, WS_CHILD | WS_VSCROLL | WS_VISIBLE | ES_READONLY | ES_MULTILINE, 0, 0, rcConsole.right, rcConsole.bottom - 20, g_hwndConsole, NULL, g_hInst, NULL); m_hwndConsolePrompt = CreateWindowEx( 0, _T("STATIC"), NULL, WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE | SS_CENTER | SS_NOPREFIX, 0, rcConsole.bottom - 20, 90, 20, g_hwndConsole, NULL, g_hInst, NULL); m_hfontConsole = CreateMonospacedFont(); SendMessage(m_hwndConsolePrompt, WM_SETFONT, (WPARAM) m_hfontConsole, 0); SendMessage(m_hwndConsoleEdit, WM_SETFONT, (WPARAM) m_hfontConsole, 0); SendMessage(m_hwndConsoleLog, WM_SETFONT, (WPARAM) m_hfontConsole, 0); // Edit box subclassing m_wndprocConsoleEdit = (WNDPROC) LongToPtr( SetWindowLongPtr( m_hwndConsoleEdit, GWLP_WNDPROC, PtrToLong(ConsoleEditWndProc)) ); ShowWindow(g_hwndConsole, SW_SHOW); UpdateWindow(g_hwndConsole); ConsoleView_Print(_T("Use 'h' command to show help.\r\n\r\n")); PrintConsolePrompt(); SetFocus(m_hwndConsoleEdit); }
BOOL HookWindowProcedure(PFNWINDOWPROC pfnWindowProc) { DWORD dwWindowPId, dwMyPId = GetCurrentProcessId(); HWND hwndCurrent = NULL; if(g_wpOrigWndProc == NULL) { do { hwndCurrent = FindWindowEx(NULL, hwndCurrent, "GxWindowClassD3d", NULL); GetWindowThreadProcessId(hwndCurrent, &dwWindowPId); if(dwWindowPId == dwMyPId) { g_wpOrigWndProc = (WNDPROC)LongToPtr(SetWindowLong(hwndCurrent, GWL_WNDPROC, PtrToLong(HookedWindowProcedure))); g_pfnWindowProc = pfnWindowProc; g_hwndHook = hwndCurrent; if(g_wpOrigWndProc) return TRUE; else return FALSE; } } while(hwndCurrent); } return FALSE; }
void CreateMemoryView(HWND hwndParent, int x, int y, int width, int height) { ASSERT(hwndParent != NULL); g_hwndMemory = CreateWindow( CLASSNAME_TOOLWINDOW, NULL, WS_CHILD | WS_VISIBLE, x, y, width, height, hwndParent, NULL, g_hInst, NULL); MemoryView_UpdateWindowText(); // ToolWindow subclassing m_wndprocMemoryToolWindow = (WNDPROC) LongToPtr( SetWindowLongPtr( g_hwndMemory, GWLP_WNDPROC, PtrToLong(MemoryViewWndProc)) ); RECT rcClient; GetClientRect(g_hwndMemory, &rcClient); m_hwndMemoryViewer = CreateWindowEx( WS_EX_STATICEDGE, CLASSNAME_MEMORYVIEW, NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 0, 0, rcClient.right, rcClient.bottom, g_hwndMemory, NULL, g_hInst, NULL); MemoryView_ScrollTo(0); }
void CreateMemoryMapView(int x, int y) { int cxBorder = ::GetSystemMetrics(SM_CXDLGFRAME); int cyBorder = ::GetSystemMetrics(SM_CYDLGFRAME); int cxScroll = ::GetSystemMetrics(SM_CXVSCROLL); int cyScroll = ::GetSystemMetrics(SM_CYHSCROLL); int cyCaption = ::GetSystemMetrics(SM_CYSMCAPTION); int width = 256 * 2 + cxScroll + cxBorder * 2; int height = 256 * 2 + cyScroll + cyBorder * 2 + cyCaption; g_hwndMemoryMap = CreateWindowEx( WS_EX_TOOLWINDOW | WS_EX_TOPMOST, CLASSNAME_OVERLAPPEDWINDOW, _T("BK Memory Map"), WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE, x, y, width, height, NULL, NULL, g_hInst, NULL); // ToolWindow subclassing m_wndprocMemoryMapToolWindow = (WNDPROC) LongToPtr( SetWindowLongPtr( g_hwndMemoryMap, GWLP_WNDPROC, PtrToLong(MemoryMapViewWndProc)) ); RECT rcClient; GetClientRect(g_hwndMemoryMap, &rcClient); m_hwndMemoryMapViewer = CreateWindow( CLASSNAME_MEMORYMAPVIEW, NULL, WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP, 0, 0, rcClient.right, rcClient.bottom, g_hwndMemoryMap, NULL, g_hInst, NULL); MemoryMapView_InitBitmap(); MemoryMapView_UpdateScrollPos(); ::SetFocus(m_hwndMemoryMapViewer); }
void MemoryMapView_Create(HWND hwndParent, int x, int y) { int cxScroll = ::GetSystemMetrics(SM_CXVSCROLL); int cyCaption = TOOLWINDOW_CAPTION_HEIGHT; int width = m_nMemoryMap_ViewCX + cxScroll; int height = m_nMemoryMap_ViewCY + cyCaption; g_hwndMemoryMap = CreateWindow( CLASSNAME_TOOLWINDOW, _T("Memory Map"), WS_CHILD | WS_VISIBLE, x, y, width, height, hwndParent, NULL, g_hInst, NULL); // ToolWindow subclassing m_wndprocMemoryMapToolWindow = (WNDPROC) LongToPtr( SetWindowLongPtr( g_hwndMemoryMap, GWLP_WNDPROC, PtrToLong(MemoryMapViewWndProc)) ); RECT rcClient; GetClientRect(g_hwndMemoryMap, &rcClient); m_hwndMemoryMapViewer = CreateWindow( CLASSNAME_MEMORYMAPVIEW, NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 0, 0, rcClient.right, rcClient.bottom, g_hwndMemoryMap, NULL, g_hInst, NULL); MemoryMapView_InitBitmap(); MemoryMapView_UpdateScrollPos(); }
__inline PNBQUEUE_NODE UnpackNBQPointer ( IN PNBQUEUE_POINTER Entry ) { return LongToPtr(Entry->Node); }
BOOLEAN RtlIsValidHandler ( IN PEXCEPTION_ROUTINE Handler ) { PULONG FunctionTable; ULONG FunctionTableLength; PVOID Base; FunctionTable = RtlLookupFunctionTable(Handler, &Base, &FunctionTableLength); if (FunctionTable && FunctionTableLength) { PEXCEPTION_ROUTINE FunctionEntry; LONG High, Middle, Low; if ((FunctionTable == LongToPtr(-1)) && (FunctionTableLength == (ULONG)-1)) { // Address is in an image that shouldn't have any handlers (like a resource only dll). RtlInvalidHandlerDetected((PVOID)((ULONG)Handler+(ULONG)Base), LongToPtr(-1), -1); return FALSE; } // Bias the handler value down by the image base and see if the result // is in the table (ULONG)Handler -= (ULONG)Base; Low = 0; High = FunctionTableLength; while (High >= Low) { Middle = (Low + High) >> 1; FunctionEntry = (PEXCEPTION_ROUTINE)FunctionTable[Middle]; if (Handler < FunctionEntry) { High = Middle - 1; } else if (Handler > FunctionEntry) { Low = Middle + 1; } else { // found it return TRUE; } } // Didn't find it RtlInvalidHandlerDetected((PVOID)((ULONG)Handler+(ULONG)Base), FunctionTable, FunctionTableLength); return FALSE; }
void CreateDebugView(HWND hwndParent, int x, int y, int width, int height) { ASSERT(hwndParent != NULL); g_hwndDebug = CreateWindow( CLASSNAME_TOOLWINDOW, NULL, WS_CHILD | WS_VISIBLE, x, y, width, height, hwndParent, NULL, g_hInst, NULL); DebugView_UpdateWindowText(); // ToolWindow subclassing m_wndprocDebugToolWindow = (WNDPROC) LongToPtr( SetWindowLongPtr( g_hwndDebug, GWLP_WNDPROC, PtrToLong(DebugViewWndProc)) ); RECT rcClient; GetClientRect(g_hwndDebug, &rcClient); m_hwndDebugViewer = CreateWindowEx( WS_EX_STATICEDGE, CLASSNAME_DEBUGVIEW, NULL, WS_CHILD | WS_VISIBLE, 0, 0, rcClient.right, rcClient.bottom, g_hwndDebug, NULL, g_hInst, NULL); m_hwndDebugToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_VERT, 4, 4, 32, rcClient.bottom, m_hwndDebugViewer, (HMENU) 102, g_hInst, NULL); TBADDBITMAP addbitmap; addbitmap.hInst = g_hInst; addbitmap.nID = IDB_TOOLBAR; SendMessage(m_hwndDebugToolbar, TB_ADDBITMAP, 2, (LPARAM) &addbitmap); SendMessage(m_hwndDebugToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0); SendMessage(m_hwndDebugToolbar, TB_SETBUTTONSIZE, 0, (LPARAM) MAKELONG (26, 26)); TBBUTTON buttons[3]; ZeroMemory(buttons, sizeof(buttons)); for (int i = 0; i < sizeof(buttons) / sizeof(TBBUTTON); i++) { buttons[i].fsState = TBSTATE_ENABLED | TBSTATE_WRAP; buttons[i].fsStyle = BTNS_BUTTON; buttons[i].iString = -1; } buttons[0].idCommand = ID_DEBUG_CPUPPU; buttons[0].iBitmap = 17; buttons[1].idCommand = ID_DEBUG_STEPINTO; buttons[1].iBitmap = 15; buttons[2].idCommand = ID_DEBUG_STEPOVER; buttons[2].iBitmap = 16; SendMessage(m_hwndDebugToolbar, TB_ADDBUTTONS, (WPARAM) sizeof(buttons) / sizeof(TBBUTTON), (LPARAM) &buttons); }
static INT_PTR CALLBACK _MsgWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { MyWinMsg *winmsg = (MyWinMsg*)LongToPtr(GetWindowLongPtr(hwnd, GWLP_USERDATA)); if(winmsg) { switch(msg) { case WM_COPYDATA: { COPYDATASTRUCT *data = (COPYDATASTRUCT*) lparam; if(data && data->lpData) { const char *msg = (const char *)data->lpData; if ( strncmp(msg,"WinMsg",6) == 0 ) { msg+=6; if ( strncmp(msg,"Blob",4) == 0 ) { msg+=5; const char *blobType = msg; while ( *msg ) { msg++; } msg++; const NxU32 *dlen = (const NxU32 *)msg; msg+=sizeof(NxU32); winmsg->queueMessageBlob(blobType,msg,dlen[0]); } else { msg++; while ( *msg ) { msg++; } msg++; const NxU32 *dlen = (const NxU32 *)msg; msg+=sizeof(NxU32); winmsg->queueMessage(msg); } } } return 0; break; } } } return DefWindowProc(hwnd, msg, wparam, lparam); }
INT_PTR CALLBACK AssignProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: g_bCtrlDown = FALSE; g_bAltDown = FALSE; g_OrigButtonProc = (WNDPROC)LongToPtr(SetWindowLong(GetDlgItem(hwndDlg, IDC_DUMMY), GWL_WNDPROC, PtrToLong(SubclassedButtonProc))); break; default: return FALSE; break; } return TRUE; }
static INT_PTR CALLBACK windowProc(HWND hwnd, uint32 msg, WPARAM wParam, LPARAM lParam) { DiWin32EGLWindow* window = (DiWin32EGLWindow*)LongToPtr(GetWindowLongPtr(hwnd, GWLP_USERDATA)); DiRenderWindow* renderWnd = DiBase::Driver->FindRenderWindow(DiWndHandle(hwnd)); if (window && window->DestroyingWindow()) return 0; switch (msg) { case WM_CREATE: ::UpdateWindow(hwnd); break; case WM_CLOSE: DiBase::CommandMgr->ExecuteCommand("quit"); break; case WM_ACTIVATE: { bool active = (LOWORD(wParam) != WA_INACTIVE); if (active) { if (renderWnd) renderWnd->GetRenderBuffer()->SetActive(true); } else { if (renderWnd) renderWnd->GetRenderBuffer()->SetActive(false); } break; } case WM_COPYDATA: { const char* str = (const char*)(((COPYDATASTRUCT*)lParam)->lpData); DiString s(str, ((COPYDATASTRUCT*)lParam)->cbData); DiBase::CommandMgr->ExecuteCommand(s.c_str()); break; } default: return ::DefWindowProc(hwnd, msg, wParam, lParam); } return 0; }
//! Entrypoint used to make another window become subclassed. bool BlueWindow::SubclassNewWindow(HWND hwnd) { DWORD windowpid; if (hwnd != NULL && IsWindow(hwnd) && GetWindowThreadProcessId(hwnd, &windowpid) && windowpid == GetCurrentProcessId() && OldWindowProcs.find(hwnd) == OldWindowProcs.end()) { // Found the window that is from our process. Subclass it. WNDPROC lpfnOldWindowProc = (WNDPROC) LongToPtr(GetWindowLongPtr(hwnd, GWL_WNDPROC)); OldWindowProcs.insert(std::make_pair<HWND, WNDPROC>(hwnd, lpfnOldWindowProc)); SetWindowLongPtr(hwnd, GWL_WNDPROC, PtrToLong(BlueWindow::SubclassProc)); ForceNonclientRepaint(hwnd); return true; } return false; // could not successfully subclass specified window. }
void CreateDisasmView(HWND hwndParent, int x, int y, int width, int height) { ASSERT(hwndParent != NULL); g_hwndDisasm = CreateWindow( CLASSNAME_TOOLWINDOW, NULL, WS_CHILD | WS_VISIBLE, x, y, width, height, hwndParent, NULL, g_hInst, NULL); DisasmView_UpdateWindowText(); // ToolWindow subclassing m_wndprocDisasmToolWindow = (WNDPROC) LongToPtr( SetWindowLongPtr( g_hwndDisasm, GWLP_WNDPROC, PtrToLong(DisasmViewWndProc)) ); RECT rcClient; GetClientRect(g_hwndDisasm, &rcClient); m_hwndDisasmViewer = CreateWindowEx( WS_EX_STATICEDGE, CLASSNAME_DISASMVIEW, NULL, WS_CHILD | WS_VISIBLE, 0, 0, rcClient.right, rcClient.bottom, g_hwndDisasm, NULL, g_hInst, NULL); }
/* * BUGBUG RESTORE * This is a new implementation of the function that doesn't thrash memory * or depend on the srbLookasideList. * HOWEVER, it seems to cause pagefile initialization to fail during boot * for some reason. Need to resolve this before switching to this function. */ NTSTATUS NTAPI ClasspEjectionControl( IN PDEVICE_OBJECT Fdo, IN PIRP Irp, IN MEDIA_LOCK_TYPE LockType, IN BOOLEAN Lock ) { PFUNCTIONAL_DEVICE_EXTENSION fdoExt = Fdo->DeviceExtension; PFILE_OBJECT_EXTENSION fsContext; BOOLEAN fileHandleOk = TRUE; BOOLEAN countChanged = FALSE; NTSTATUS status; PAGED_CODE(); status = KeWaitForSingleObject( &fdoExt->EjectSynchronizationEvent, UserRequest, UserMode, FALSE, NULL); ASSERT(status == STATUS_SUCCESS); /* * If this is a "secured" request, we have to make sure * that the file handle is valid. */ if (LockType == SecureMediaLock){ PIO_STACK_LOCATION thisSp = IoGetCurrentIrpStackLocation(Irp); /* * Make sure that the file object we are supplied has a * proper FsContext before we try doing a secured lock. */ if (thisSp->FileObject){ PCOMMON_DEVICE_EXTENSION commonExt = (PCOMMON_DEVICE_EXTENSION)fdoExt; fsContext = ClasspGetFsContext(commonExt, thisSp->FileObject); } else { fsContext = NULL; } if (!fsContext){ ASSERT(fsContext); fileHandleOk = FALSE; } } if (fileHandleOk){ /* * Adjust the lock counts and make sure they make sense. */ status = STATUS_SUCCESS; if (Lock){ switch(LockType) { case SimpleMediaLock: fdoExt->LockCount++; countChanged = TRUE; break; case SecureMediaLock: fsContext->LockCount++; fdoExt->ProtectedLockCount++; countChanged = TRUE; break; case InternalMediaLock: fdoExt->InternalLockCount++; countChanged = TRUE; break; } } else { /* * This is an unlock command. If it's a secured one then make sure * the caller has a lock outstanding or return an error. */ switch (LockType){ case SimpleMediaLock: if (fdoExt->LockCount > 0){ fdoExt->LockCount--; countChanged = TRUE; } else { ASSERT(fdoExt->LockCount > 0); status = STATUS_INTERNAL_ERROR; } break; case SecureMediaLock: if (fsContext->LockCount > 0){ ASSERT(fdoExt->ProtectedLockCount > 0); fsContext->LockCount--; fdoExt->ProtectedLockCount--; countChanged = TRUE; } else { ASSERT(fsContext->LockCount > 0); status = STATUS_INVALID_DEVICE_STATE; } break; case InternalMediaLock: ASSERT(fdoExt->InternalLockCount > 0); fdoExt->InternalLockCount--; countChanged = TRUE; break; } } if (NT_SUCCESS(status)){ /* * We only send an unlock command to the drive if * all the lock counts have dropped to zero. */ if (!Lock && (fdoExt->ProtectedLockCount || fdoExt->InternalLockCount || fdoExt->LockCount)){ /* * The lock count is still positive, so don't unlock yet. */ status = STATUS_SUCCESS; } else if (!TEST_FLAG(Fdo->Characteristics, FILE_REMOVABLE_MEDIA)) { /* * The device isn't removable media. don't send a cmd. */ status = STATUS_SUCCESS; } else { TRANSFER_PACKET *pkt; pkt = DequeueFreeTransferPacket(Fdo, TRUE); if (pkt){ KEVENT event; /* * Store the number of packets servicing the irp (one) * inside the original IRP. It will be used to counted down * to zero when the packet completes. * Initialize the original IRP's status to success. * If the packet fails, we will set it to the error status. */ Irp->Tail.Overlay.DriverContext[0] = LongToPtr(1); Irp->IoStatus.Status = STATUS_SUCCESS; /* * Set this up as a SYNCHRONOUS transfer, submit it, * and wait for the packet to complete. The result * status will be written to the original irp. */ KeInitializeEvent(&event, SynchronizationEvent, FALSE); SetupEjectionTransferPacket(pkt, Lock, &event, Irp); SubmitTransferPacket(pkt); KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL); status = Irp->IoStatus.Status; } else { status = STATUS_INSUFFICIENT_RESOURCES; } } } } else { status = STATUS_INVALID_PARAMETER; } if (!NT_SUCCESS(status) && countChanged) { // // have to revert to previous counts if the // lock/unlock operation actually failed. // if(Lock) { switch(LockType) { case SimpleMediaLock: { FdoExtension->LockCount--; break; } case SecureMediaLock: { fsContext->LockCount--; FdoExtension->ProtectedLockCount--; break; } case InternalMediaLock: { FdoExtension->InternalLockCount--; break; } } } else { switch(LockType) { case SimpleMediaLock: { FdoExtension->LockCount++; break; } case SecureMediaLock: { fsContext->LockCount++; FdoExtension->ProtectedLockCount++; break; } case InternalMediaLock: { FdoExtension->InternalLockCount++; break; } } } } KeSetEvent(&fdoExt->EjectSynchronizationEvent, IO_NO_INCREMENT, FALSE); return status; }
static LRESULT CALLBACK mstsc_WndProc(HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam) { // BUGBUG: LongToPtr & PtrToLong will break on Win64 RDPCLIENT * This = reinterpret_cast<RDPCLIENT *>(LongToPtr(GetWindowLongPtr(hwnd, GWLP_USERDATA))); switch(uMsg) { case WM_CLOSE: DestroyWindow(hwnd); break; // FIXME: temporary case WM_DESTROY: PostQuitMessage(0); break; /* Initialization */ case WM_CREATE: This = static_cast<RDPCLIENT *>(reinterpret_cast<LPCREATESTRUCT>(lparam)->lpCreateParams); SetWindowLongPtr(hwnd, GWLP_USERDATA, PtrToLong(This)); break; /* Painting */ case WM_PRINTCLIENT: if(wparam == 0) break; case WM_PAINT: { HDC hdc = (HDC)wparam; // A DC was provided: print the whole client area into it if(hdc) { RECT rc; GetClientRect(hwnd, &rc); BitBlt(hdc, 0, 0, rc.right, rc.bottom, hdcBuffer, 0, 0, SRCCOPY); } // Otherwise, we're refreshing to screen else { PAINTSTRUCT ps; hdc = BeginPaint(hwnd, &ps); BitBlt ( hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top, hdcBuffer, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY ); EndPaint(hwnd, &ps); } } break; /* Keyboard stuff */ case WM_SYSKEYDOWN: case WM_KEYDOWN: rdp_send_input(This, GetMessageTime(), RDP_INPUT_SCANCODE, RDP_KEYPRESS | (lparam & 0x1000000 ? KBD_FLAG_EXT : 0), LOBYTE(HIWORD(lparam)), 0); break; case WM_SYSKEYUP: case WM_KEYUP: rdp_send_input(This, GetMessageTime(), RDP_INPUT_SCANCODE, RDP_KEYRELEASE | (lparam & 0x1000000 ? KBD_FLAG_EXT : 0), LOBYTE(HIWORD(lparam)), 0); break; /* Mouse stuff */ // Cursor shape case WM_SETCURSOR: if(LOWORD(lparam) == HTCLIENT) { //SetCursor(hcursor); return TRUE; } break; // Movement case WM_MOUSEMOVE: //if(This->sendmotion || wparam & (MK_LBUTTON | MK_RBUTTON | MK_MBUTTON | MK_XBUTTON1 | MK_XBUTTON2)) rdp_send_input(This, GetMessageTime(), RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, LOWORD(lparam), HIWORD(lparam)); break; // Buttons // TODO: X buttons case WM_LBUTTONDOWN: rdp_send_input(This, GetMessageTime(), RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1 | MOUSE_FLAG_DOWN, LOWORD(lparam), HIWORD(lparam)); break; case WM_RBUTTONDOWN: rdp_send_input(This, GetMessageTime(), RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2 | MOUSE_FLAG_DOWN, LOWORD(lparam), HIWORD(lparam)); break; case WM_MBUTTONDOWN: rdp_send_input(This, GetMessageTime(), RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON3 | MOUSE_FLAG_DOWN, LOWORD(lparam), HIWORD(lparam)); break; case WM_LBUTTONUP: rdp_send_input(This, GetMessageTime(), RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, LOWORD(lparam), HIWORD(lparam)); break; case WM_RBUTTONUP: rdp_send_input(This, GetMessageTime(), RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, LOWORD(lparam), HIWORD(lparam)); break; case WM_MBUTTONUP: rdp_send_input(This, GetMessageTime(), RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON3, LOWORD(lparam), HIWORD(lparam)); break; // Wheel case WM_MOUSEWHEEL: mstsc_mousewheel(This, (SHORT)HIWORD(wparam), lparam); break; default: /* Registered messages */ // Z-Mouse wheel support - you know, just in case if(uMsg == wmZMouseWheel) { mstsc_mousewheel(This, (int)wparam, lparam); break; } /* Unhandled messages */ return DefWindowProc(hwnd, uMsg, wparam, lparam); } return 0; }
void CreateTapeView(HWND hwndParent, int x, int y, int width, int height) { ASSERT(hwndParent != NULL); g_hwndTape = CreateWindow( CLASSNAME_TOOLWINDOW, NULL, WS_CHILD | WS_VISIBLE, x, y, width, height, hwndParent, NULL, g_hInst, NULL); SetWindowText(g_hwndTape, _T("Tape")); // ToolWindow subclassing m_wndprocTapeToolWindow = (WNDPROC) LongToPtr( SetWindowLongPtr( g_hwndTape, GWLP_WNDPROC, PtrToLong(TapeViewWndProc)) ); RECT rcClient; GetClientRect(g_hwndTape, &rcClient); m_hwndTapeFile = CreateWindow( _T("STATIC"), NULL, WS_CHILD | WS_VISIBLE | SS_PATHELLIPSIS, 8, 4, 500, 18, g_hwndTape, NULL, g_hInst, NULL); m_hwndTapeCurrent = CreateWindow( _T("STATIC"), NULL, WS_CHILD | WS_VISIBLE, 8, 62, 100, 18, g_hwndTape, NULL, g_hInst, NULL); m_hwndTapeTotal = CreateWindow( _T("STATIC"), NULL, WS_CHILD | WS_VISIBLE | SS_RIGHT, 500 + 8 + 4, 4, rcClient.right - 8 * 2 - 500 - 4, 18, g_hwndTape, NULL, g_hInst, NULL); m_hwndTapeGraph = CreateWindow( _T("STATIC"), NULL, WS_CHILD | WS_VISIBLE | SS_OWNERDRAW, 8, 22, TAPE_BUFFER_SIZE, 32, g_hwndTape, NULL, g_hInst, NULL); m_hwndTapePlay = CreateWindow( _T("BUTTON"), _T("Play"), WS_CHILD | WS_VISIBLE | WS_DISABLED, 8 + 100 + 16, 60, 96, 22, g_hwndTape, NULL, g_hInst, NULL); m_hwndTapeRewind = CreateWindow( _T("BUTTON"), _T("<< Rewind"), WS_CHILD | WS_VISIBLE | WS_DISABLED, 8 + 100 + 16 + 4 + 96, 60, 96, 22, g_hwndTape, NULL, g_hInst, NULL); m_hwndTapeOpen = CreateWindow( _T("BUTTON"), _T("Open WAV"), WS_CHILD | WS_VISIBLE, rcClient.right - 96 - 4 - 96 - 8, 60, 96, 22, g_hwndTape, NULL, g_hInst, NULL); m_hwndTapeSave = CreateWindow( _T("BUTTON"), _T("Save WAV"), WS_CHILD | WS_VISIBLE, rcClient.right - 96 - 8, 60, 96, 22, g_hwndTape, NULL, g_hInst, NULL); m_hfontTape = CreateDialogFont(); SendMessage(m_hwndTapeCurrent, WM_SETFONT, (WPARAM) m_hfontTape, 0); SendMessage(m_hwndTapeTotal, WM_SETFONT, (WPARAM) m_hfontTape, 0); SendMessage(m_hwndTapeFile, WM_SETFONT, (WPARAM) m_hfontTape, 0); SendMessage(m_hwndTapePlay, WM_SETFONT, (WPARAM) m_hfontTape, 0); SendMessage(m_hwndTapeRewind, WM_SETFONT, (WPARAM) m_hfontTape, 0); SendMessage(m_hwndTapeOpen, WM_SETFONT, (WPARAM) m_hfontTape, 0); SendMessage(m_hwndTapeSave, WM_SETFONT, (WPARAM) m_hfontTape, 0); TapeView_ClearGraph(); }