HWND bm_Create(HINSTANCE hInstance, HWND hwndParent) { static BOOL is_init=FALSE; WNDCLASS wc; if (!is_init) { // Fill in the window class structure that describes the "tool tip" wc.style = CS_GLOBALCLASS; wc.lpfnWndProc = BalloonProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = NULL; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = 0; wc.lpszMenuName = NULL; wc.lpszClassName = CLASSNAME_TOOLTIP; if (!RegisterClass(&wc)) return FALSE; // register atoms for window properties atomAlignStyle=GlobalAddAtom("ttip:AlignStyle"); atomTailSize=GlobalAddAtom("ttip:TailSize"); atomTimeout=GlobalAddAtom("ttip:atomTimeout"); atomFont=GlobalAddAtom("ttip:Font"); } /* if */ is_init=TRUE; return CreateWindow(CLASSNAME_TOOLTIP, "", WS_POPUP, 0, 0, 0, 0, hwndParent, NULL, hInstance, NULL); }
DWORD WINAPI YAMNHotKeyThread(LPVOID Param) { MSG WinMessage; WORD HotKey = LOWORD(Param); int HotKeyID; // register hotkey for main YAMN thread first if(!(HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtom(YAMN_HKCHECKMAIL),HIBYTE(HotKey),LOBYTE(HotKey)))) return 0; while(1) { GetMessage(&WinMessage,NULL,WM_HOTKEY,WM_YAMN_CHANGEHOTKEY); // if we want to close miranda, we get event and do not run pop3 checking anymore if(WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0)) break; switch(WinMessage.message) { // user pressed hotkey case WM_HOTKEY: ForceCheckSvc((WPARAM)0,(LPARAM)0); break; // hotkey changed case WM_YAMN_CHANGEHOTKEY: UnregisterHotKey(NULL,HotKeyID); HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtom(YAMN_HKCHECKMAIL),WinMessage.wParam,WinMessage.lParam); break; } } return 1; }
LRESULT OnDDEInitiate(HWND hwnd, WPARAM wparam, LPARAM lparam) { ATOM aServer = GlobalAddAtom(PDFSYNC_DDE_SERVICE); ATOM aTopic = GlobalAddAtom(PDFSYNC_DDE_TOPIC); if (LOWORD(lparam) == aServer && HIWORD(lparam) == aTopic) { SendMessage((HWND)wparam, WM_DDE_ACK, (WPARAM)hwnd, MAKELPARAM(aServer, 0)); } else { GlobalDeleteAtom(aServer); GlobalDeleteAtom(aTopic); } return 0; }
static void DDE_StartConversation(HWND hwndClientDDE, LPCSTR szApplication, LPCSTR szTopic) { //static BOOL fInInitiate = FALSE; ATOM atomApplication = *szApplication ? GlobalAddAtom(szApplication) : 0; ATOM atomTopic = *szTopic ? GlobalAddAtom(szTopic ) : 0; //fInInitiate = TRUE; SendMessage(HWND(-1), WM_DDE_INITIATE, WPARAM(hwndClientDDE), MAKELONG(atomApplication, atomTopic)); //fInInitiate = FALSE; if (atomApplication) GlobalDeleteAtom(atomApplication); if (atomTopic ) GlobalDeleteAtom(atomTopic ); }
StWinHandles::StWinHandles() #ifdef _WIN32 : ThreadWnd(0), EventMsgThread(true), hWindow(NULL), hWindowGl(NULL), hWinTmp(NULL), myMKeyStop(GlobalAddAtom(MAKEINTATOM(VK_MEDIA_STOP))), myMKeyPlay(GlobalAddAtom(MAKEINTATOM(VK_MEDIA_PLAY_PAUSE))), myMKeyPrev(GlobalAddAtom(MAKEINTATOM(VK_MEDIA_PREV_TRACK))), myMKeyNext(GlobalAddAtom(MAKEINTATOM(VK_MEDIA_NEXT_TRACK))), ThreadGL(0), hDC(NULL) #elif defined(__ANDROID__) : hWindowGl(NULL)
/* DllMain is invoked by every process in the entire system that is hooked * by our window hooks, notably the tty processes' context, and by the user * who wants tty messages (the app). Keep it light and simple. */ BOOL __declspec(dllexport) APIENTRY DllMain(HINSTANCE hModule, ULONG ulReason, LPVOID pctx) { if (ulReason == DLL_PROCESS_ATTACH) { //hmodThis = hModule; if (!hookwndmsg) { origwndprop = MAKEINTATOM(GlobalAddAtom("Win9xConHookOrigProc")); hookwndprop = MAKEINTATOM(GlobalAddAtom("Win9xConHookThunkWnd")); hookwndmsg = RegisterWindowMessage("Win9xConHookMsg"); } #ifdef DBG // DbgPrintf("H ProcessAttach:%8.8x\r\n", // GetCurrentProcessId()); #endif } else if ( ulReason == DLL_PROCESS_DETACH ) { #ifdef DBG // DbgPrintf("H ProcessDetach:%8.8x\r\n", GetCurrentProcessId()); #endif if (monitor_hwnd) SendMessage(monitor_hwnd, WM_DESTROY, 0, 0); if (is_subclassed) SendMessage(hwtty, hookwndmsg, 0, (LPARAM)hwtty); if (hmodHook) { if (hhkGetMessage) { UnhookWindowsHookEx(hhkGetMessage); hhkGetMessage = NULL; } //if (hhkCallWndProc) { // UnhookWindowsHookEx(hhkCallWndProc); // hhkCallWndProc = NULL; //} FreeLibrary(hmodHook); hmodHook = NULL; } if (is_service) RegisterWindows9xService(FALSE); if (hookwndmsg) { GlobalDeleteAtom((ATOM)origwndprop); GlobalDeleteAtom((ATOM)hookwndprop); hookwndmsg = 0; } } return TRUE; }
HRESULT BaseWindow::Init() { if (s_atomThisProperty == NULL) s_atomThisProperty = GlobalAddAtom(L"BaseWindowThisProperty"); HWND hWndITC = FindWindow(L"iTunesControl", L"iTunesControl"); HINSTANCE g_hinst = (HINSTANCE)GetWindowLongPtr(hWndITC, GWLP_HINSTANCE); if (s_atomClass == NULL) { WNDCLASS wc = { 0 }; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpszClassName = TEXT("BaseWindow"); wc.lpfnWndProc = s_WndProc; wc.hInstance = g_hinst; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1); s_atomClass = RegisterClass(&wc); } if (s_atomClass && s_atomThisProperty) return S_OK; return HRESULT_FROM_WIN32(GetLastError()); }
int Mint::RegisterHotKey(unsigned long int nModifier, unsigned long int nVirtKey) { #ifdef WIN32 _ASSERT(m_hWnd!=NULL); // Should call SetHWND() before this function char szAtomName[64] = {0,}; if(nModifier==MMODIFIER_ALT) strcat(szAtomName, "Alt"); if(nModifier==MMODIFIER_CTRL) strcat(szAtomName, "Ctrl"); if(nModifier==MMODIFIER_SHIFT) strcat(szAtomName, "Shift"); char szKey[16] = {0, }; sprintf(szKey, "%d", nVirtKey); strcat(szAtomName, szKey); int nID = GlobalAddAtom(szAtomName); if(nID==0) return 0; if(::RegisterHotKey(m_hWnd, nID, nModifier, nVirtKey)==TRUE) return nID; return 0; #else // Not Implemented _ASSERT(FALSE); return 0; #endif }
QTServer::QTServer(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); // GlobalAddAtom("shitnow"); //设置表头及大小 QStringList header; header << QStringLiteral("账号") << QStringLiteral("大区") << QStringLiteral("服务器") << QStringLiteral("脚本") << QStringLiteral("角色") << QStringLiteral("金币") << QStringLiteral("地图") << QStringLiteral("状态"); ui.tableWidget->setColumnCount(header.count()); ui.tableWidget->setHorizontalHeaderLabels(header); //ui.tableWidget->setRowCount(20); // 设置行数 ui.tableWidget->horizontalHeader()->setDefaultSectionSize(150); //ui.tableWidget->setColumnWidth(0, 150); //设置第一列宽度 //ui.tableWidget->setColumnWidth(1, 150); //设置第二列宽度 //ui.tableWidget->setColumnWidth(2, 150); //设置第三列宽度 //ui.tableWidget->setColumnWidth(3, 150); //ui.tableWidget->setColumnWidth(4, 150); //ui.tableWidget->setColumnWidth(5, 150); //ui.tableWidget->setColumnWidth(6, 150); //ui.tableWidget->horizontalHeader()->setStretchLastSection(true); //将最后一列延伸到整个列表全满 ui.tableWidget->horizontalHeader()->setSectionsClickable(false); //设置表头不可点击(默认点击后进行排序) ui.tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); // 所有列自适应窗口宽度 //设置隔一行变一颜色,即:一灰一白 ui.tableWidget->setAlternatingRowColors(true); //控件刚开始的时候左边默认自带序列号,如果想去掉左边的行号,加上下面的代码 QHeaderView* headerView = ui.tableWidget->verticalHeader(); headerView->setHidden(true); //设置默认行高 //headerView->setDefaultSectionSize(30); //整行选中的方式 ui.tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); //不能对表格内容进行修改 ui.tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); m_tcpServer = new QTcpServer(this); m_tcpServer->listen(QHostAddress::Any, 12589); //监听任何连上12589端口的ip connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(SlotNewConnect())); //菜单栏关联 connect(ui.actionAddAccount, SIGNAL(triggered()), this, SLOT(SlotAddAccount())); connect(ui.actionOption, SIGNAL(triggered()), this, SLOT(SlotOptionSet())); connect(ui.actionExportAcc, SIGNAL(triggered()), this, SLOT(SlotExportAcc())); connect(ui.actionImportAcc, SIGNAL(triggered()), this, SLOT(SlotImportAcc())); connect(ui.tableWidget, &CMyTableWidget::SignalSendAddAcc, this, &QTServer::SlotAddAcc); // 以下为设置游戏路径 SlotInitGamePath(); // 列表框關聯 QObject::connect(ui.tableWidget, &CMyTableWidget::SignalStartNewGame, this, &QTServer::SlotStartNewGame); QObject::connect(ui.tableWidget, &CMyTableWidget::SignalStopScript, this, &QTServer::SlotStopScript); QObject::connect(ui.tableWidget, &CMyTableWidget::SignalStartScript, this, &QTServer::SlotStartScript); }
BOOL BaseBar_RegisterControl(HINSTANCE hInstance) { WNDCLASSEX wcex; WNDCLASS wc; ZeroMemory(&wc, sizeof(WNDCLASS)); wcex.cbSize = sizeof(WNDCLASSEX); if (GetClassInfoEx(hInstance, WC_BASEBAR, &wcex) != 0) return (TRUE); wc.style = CS_SAVEBITS; wc.lpfnWndProc = (WNDPROC) BaseBar_WindowProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); wc.lpszClassName = WC_BASEBAR; if (!RegisterClass(&wc)) return (FALSE); s_hBaseBarAtom = GlobalAddAtom(s_pszBaseBarProp); return (TRUE); }
BOOL InitInstance() { // Create the global atoms VNC_POPUPSELN_ATOM = GlobalAddAtom(VNC_POPUPSELN_ATOMNAME); if (VNC_POPUPSELN_ATOM == NULL) return FALSE; SetSettings(); return TRUE; }
static void FixWindowForGesture(HWND hwnd) { UnregisterTouchWindow(hwnd); // reenable right-click on touch and hold // The atom identifier and Tablet PC atom ATOM atomID = 0; LPCWSTR tabletAtom = L"MicrosoftTabletPenServiceProperty"; // Get the Tablet PC atom ID atomID = GlobalAddAtom(tabletAtom); if (atomID != 0) { // Try to disable press and hold gesture by // setting the window property RemoveProp(hwnd, tabletAtom); } /* GESTURECONFIG gc1[3]; UINT uiGcs1 = 3; ZeroMemory(&gc1, sizeof(gc1)); gc1[0].dwID = GID_ZOOM; gc1[1].dwID = GID_ROTATE; gc1[2].dwID = GID_PAN; BOOL bResult1 = GetGestureConfig(hwnd, 0, 0, &uiGcs1, gc1, sizeof(GESTURECONFIG)); if (!bResult1){ DWORD err = GetLastError(); tracei("zoom get config err ", bResult1); } tracei("zoom want config ", gc1[0].dwWant); tracei("zoom block config ", gc1[0].dwBlock); */ /* DWORD dwPanWant = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; DWORD dwPanBlock = GC_PAN_WITH_GUTTER | GC_PAN_WITH_INERTIA; // set the settings in the gesture configuration GESTURECONFIG gc[] = {{ GID_ZOOM, 0, GC_ZOOM }, { GID_ROTATE, GC_ROTATE, 0}, { GID_PAN, dwPanWant , dwPanBlock} }; UINT uiGcs = 3; BOOL bResult = SetGestureConfig(hwnd, 0, uiGcs, gc, sizeof(GESTURECONFIG)); if (!bResult) { DWORD err = GetLastError(); tracei("error: ", err); } */ }
UINT WINAPI RegisterWindowMessage(LPCSTR lpszMessage) { UINT rc; APISTR((LF_APICALL,"RegisterWindowMessage(LPCSTR=%s)\n", lpszMessage)); rc = GlobalAddAtom(lpszMessage); APISTR((LF_APIRET,"RegisterWindowMessage: returns UINT %x\n",rc)); return rc; }
void MainWindow::registerGlobalKey() { hotkeyShotBgId =GlobalAddAtom(L"SsotGlobalHotKey") - 0xC000; if(RegisterHotKey((HWND(this->winId())), hotkeyShotBgId,MOD_SHIFT|MOD_ALT,0x5A)) { qDebug("SHIFT+ALT+Z"); } }
static int FindMirandaForProfile(TCHAR * szProfile) { ENUMMIRANDAWINDOW x={0}; x.profile=szProfile; x.msg=RegisterWindowMessage( _T( "Miranda::ProcessProfile" )); x.aPath=GlobalAddAtom(szProfile); EnumWindows(EnumMirandaWindows, (LPARAM)&x); GlobalDeleteAtom(x.aPath); return x.found; }
BOOL CheckIfFirstRun(LPCTSTR szGlobalName) { ATOM at = GlobalFindAtom(szGlobalName); if(at!=0) { return FALSE; } GlobalAddAtom(szGlobalName); return TRUE; }
static ATOM make_hotkey_atom(HotkeyEntry* key) { gchar *atom_name; ATOM atom; atom_name = make_hotkey_atom_name(key); atom = GlobalAddAtom(atom_name); g_free(atom_name); return atom; }
BOOL vncService::PostAddConnectClient( const char* pszId ) { ATOM aId = INVALID_ATOM; if ( pszId ) { aId = GlobalAddAtom( pszId ); // delete pszId; } return ( PostToWinVNC(MENU_REPEATER_ID_MSG, 0, (LPARAM)aId) ); }
/***************************************************************************\ * IncGlobalAtomCount * * Description: * Duplicates an atom. * * * History: * 1-22-91 sanfords Created. \***************************************************************************/ GATOM IncGlobalAtomCount( GATOM ga) { WCHAR sz[256]; if (ga == 0) { return (0); } if (GlobalGetAtomName(ga, sz, 256) == 0) { RIPMSG0(RIP_WARNING, "IncGlobalAtomCount out of memory"); return (0); } return ((GATOM)GlobalAddAtom(sz)); }
/***************************************************************************\ * LocalToGlobalAtom * * Description: * Converts a Local Atom to a Global Atom * * History: * 12-1-91 sanfords Created. \***************************************************************************/ GATOM LocalToGlobalAtom( LATOM la) { WCHAR sz[256]; if (la == 0) { return (0); } if (GetAtomName((ATOM)la, sz, 256) == 0) { RIPMSG0(RIP_WARNING, "LocalToGlobalAtom out of memory"); return (0); } return ((GATOM)GlobalAddAtom(sz)); }
int dc_update_driver() { wchar_t buff[MAX_PATH]; dc_conf_data conf; int resl; do { if ( (resl = dc_save_drv_file(drv_dc)) != ST_OK ) { break; } if ( (resl = dc_load_conf(&conf)) != ST_OK ) { break; } if (conf.build < 692) { /* remove old file system filter driver */ if (dc_remove_service(drv_fsf) == ST_OK) { dc_get_driver_path(buff, drv_fsf); DeleteFile(buff); } /* add Altitude */ if ( (resl = dc_add_altitude()) != ST_OK ) { break; } } if (conf.build < 366) { /* add CDROM class filter */ dc_add_filter(cdr_key, drv_dc, 1); /* set new default flags */ conf.conf_flags |= CONF_HW_CRYPTO | CONF_AUTOMOUNT_BOOT; } if (conf.build < 642) { conf.conf_flags |= CONF_ENABLE_SSD_OPT; } resl = dc_save_conf(&conf); } while (0); if (resl == ST_OK) { _snwprintf( buff, sizeof_w(buff), L"DC_UPD_%d", dc_get_version()); GlobalAddAtom(buff); } return resl; }
void Menu_Install(ToolbarFunc ProcessToolbarFunc, ToolbarFunc ProcessSysMenuFunc, ToolbarFunc ProcessOtherFunc) { hImageListHot = ImageList_Create(CX_IMAGE, CY_IMAGE, ILC_MASK | ILC_COLOR16, 0, 100); hImageListCold = ImageList_Create(CX_IMAGE, CY_IMAGE, ILC_MASK | ILC_COLOR16, 0, 100); Menu_GetIconFromProcess = ProcessToolbarFunc; Menu_GetSysMenuIconFromProcess = ProcessSysMenuFunc; Menu_GetOtherIconFromProcess = ProcessOtherFunc; g_hMenuAtom = GlobalAddAtom(g_pszMenuSubclassProp); /* Set up the whole menu hook (i.e. all should be ownerdrawn) */ g_hMenuHook = SetWindowsHookEx(WH_CALLWNDPROC, Menu_CallWndProc, NULL, GetCurrentThreadId()); }
bool MessageCenter::registerHotkey(UINT a,UINT b) { QByteArray t = windowTitle().toLatin1(); WCHAR wszClassName[1256]; memset(wszClassName,0,sizeof(wszClassName)); MultiByteToWideChar(CP_ACP,0,t.data() ,strlen(t.data())+1,wszClassName, sizeof(wszClassName)/sizeof(wszClassName[0])); ATOM id = GlobalAddAtom(wszClassName); hotKeyId.push_back(id); bool ok = RegisterHotKey(self, id, a , b); qDebug()<<"register hotkey "<<ok<<' '<<id<<' '<<a<<' '<<b; return ok; }
BOOL WINAPI SetProp(HWND hWnd, LPCSTR lpString, HANDLE hData) { MWPROP *pProp; if (!(pProp = GdItemNew(MWPROP))) return FALSE; if (HIWORD(lpString)) pProp->Atom = GlobalAddAtom(lpString); else pProp->Atom = LOWORD((DWORD)lpString); pProp->hData = hData; GdListAdd (&hWnd->props, &pProp->link); return TRUE; }
BOOL CWordPadApp::IsDocOpen(LPCTSTR lpszFileName) { if (lpszFileName[0] == NULL) return FALSE; TCHAR szPath[_MAX_PATH]; AfxFullPath(szPath, lpszFileName); ATOM atom = GlobalAddAtom(szPath); ASSERT(atom != NULL); if (atom == NULL) return FALSE; EnumWindows(StaticEnumProc, (LPARAM)&atom); if (atom == NULL) return TRUE; DeleteAtom(atom); return FALSE; }
// from http://msdn.microsoft.com/en-us/library/ms812373.aspx // disable the press and hold gesture for the given window void TouchInputHandler::disablePressAndHold(HWND hWnd) { // The atom identifier and Tablet PC atom ATOM atomID = 0; LPCTSTR tabletAtom = _T("MicrosoftTabletPenServiceProperty"); // Get the Tablet PC atom ID atomID = GlobalAddAtom(tabletAtom); // If getting the ID failed, return false if (atomID == 0) { return; } // Try to disable press and hold gesture by // setting the window property, return the result SetProp(hWnd, tabletAtom, (HANDLE)1); }
//读配置文件 void CTaoFlowDlg::LoadConfigureFile() { CString strPath = _T(".//conf.ini"); //读取快捷键 g_wVirtualKeyCode = GetPrivateProfileInt(_T("快捷键"), _T("VirtualKeyCode"), 0, strPath); g_wModifiers = GetPrivateProfileInt(_T("快捷键"), _T("Modifiers"), 0, strPath); //设置快捷键 g_nHotKeyId = GlobalAddAtom(_T("MyHotKey")) - 0xC000; //默认设为Alt+F6 if ((0 == g_wVirtualKeyCode) || (0 == g_wModifiers)) { //shift和alt相反 g_wModifiers = MOD_SHIFT; g_wVirtualKeyCode = VK_F6; } RegisterHotKey(AfxGetMainWnd()->m_hWnd, g_nHotKeyId, g_wModifiers, g_wVirtualKeyCode); //读取开机启动 g_BStartWithWindows = GetPrivateProfileInt(_T("开机启动"), _T("Value"), 0, strPath); }
BOOL InitInstance() { // Create the global atoms VNC_POPUPSELN_ATOM = GlobalAddAtom(VNC_POPUPSELN_ATOMNAME); if (VNC_POPUPSELN_ATOM == NULL) return FALSE; // Get the module name char proc_name[_MAX_PATH]; DWORD size; // Attempt to get the program/module name if ((size = GetModuleFileName( GetModuleHandle(NULL), (char *) &proc_name, _MAX_PATH )) == 0) return FALSE; // Get the default system key for the module hModuleKey = GetModuleKey(HKEY_LOCAL_MACHINE, proc_name, false, false); if (hModuleKey != NULL) { #ifdef _MSC_VER _RPT0(_CRT_WARN, "vncHooks : loading machine prefs\n"); #endif ReadSettings(); RegCloseKey(hModuleKey); hModuleKey = NULL; } // Get the key for the module hModuleKey = GetModuleKey(HKEY_CURRENT_USER, proc_name, false, false); if (hModuleKey != NULL) { #ifdef _MSC_VER _RPT0(_CRT_WARN, "vncHooks : loading user prefs\n"); #endif ReadSettings(); RegCloseKey(hModuleKey); hModuleKey = NULL; } return TRUE; }
HotkeyCombo::HotkeyCombo(std::wstring keyCombo, std::wstring action, bool backup) { wcscpy(this->keyCombo, keyCombo.c_str()); wcscpy(this->action, action.c_str()); modifiers = 0; ParseKeyCombo(); ID = 0; // The backup list is only used to write the original hotkey combinations to // the XML file in the event the user cancels, so don't generate an ID if (!backup) { ID = GlobalAddAtom(keyCombo.c_str()); } valid = true; }
static void FixWindowForTouch(HWND hwnd) { RegisterTouchWindow(hwnd, TOUCH_FLAGS); // disable right-click on touch and hold // using the method documented here: http://msdn.microsoft.com/en-us/library/ms812373.aspx // The atom identifier and Tablet PC atom ATOM atomID = 0; LPCWSTR tabletAtom = L"MicrosoftTabletPenServiceProperty"; // Get the Tablet PC atom ID atomID = GlobalAddAtom(tabletAtom); if (atomID != 0) { // Try to disable press and hold gesture by // setting the window property SetProp(hwnd, tabletAtom, (HANDLE)1); } }