当前位置: 首页>>代码示例>>C++>>正文


C++ TrackPopupMenu函数代码示例

本文整理汇总了C++中TrackPopupMenu函数的典型用法代码示例。如果您正苦于以下问题:C++ TrackPopupMenu函数的具体用法?C++ TrackPopupMenu怎么用?C++ TrackPopupMenu使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TrackPopupMenu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetCursorPos

void MainDialog::showMenu()
{
   POINT pt;
   GetCursorPos(&pt);
   HMENU hMenu = CreatePopupMenu();
   if(hMenu)
   {
      InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_MAIN, "打开");
      InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_SETTING, "设置");

      InsertMenu(hMenu, -1, MF_BYPOSITION|MF_SEPARATOR, 0, "");

      InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_ABOUT, "关于");
      InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_EXIT, "退出");

      // note:	must set window to the foreground or the
      //			menu won't disappear when it should
      SetForegroundWindow(_hWnd);

      TrackPopupMenu(hMenu, TPM_BOTTOMALIGN,
                     pt.x, pt.y, 0, _hWnd, NULL );
      DestroyMenu(hMenu);
   }
}
开发者ID:wuyao721,项目名称:gopuls,代码行数:24,代码来源:MainDialog.cpp

示例2: OnContextMenu

LRESULT OnContextMenu(HWND hWnd,WPARAM wParam,LPARAM lParam)
{
    HMENU hMenu, hPopup;
    int TempSel;
    POINT pt;

    pt.x=LOWORD(lParam);
    pt.y=HIWORD(lParam);
    ScreenToClient(hWnd,&pt);
    TempSel=FindObject(pt.x,pt.y);
    if (NowSel != TempSel) {
        NowSel=TempSel;
        InvalidateRect(hWnd,NULL,TRUE);
        UpdateWindow(hWnd);
    }

    hMenu=LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_POPUP));
    hPopup=GetSubMenu(hMenu, 0);
    if (NowSel == -1) {
        EnableMenuItem(hPopup, IDM_POPUP_DELETE, MF_BYCOMMAND | MF_GRAYED);
        EnableMenuItem(hPopup, IDM_POPUP_PROPERTY, MF_BYCOMMAND | MF_GRAYED);
    }

    if (NowSel == -1 || NowSel >= arNum-1) {
        EnableMenuItem(hPopup, IDM_POPUP_FRONT, MF_BYCOMMAND | MF_GRAYED);
        EnableMenuItem(hPopup, IDM_POPUP_MOSTFRONT, MF_BYCOMMAND | MF_GRAYED);
    }
    if (NowSel == -1 || NowSel <= 0) {
        EnableMenuItem(hPopup, IDM_POPUP_BACK, MF_BYCOMMAND | MF_GRAYED);
        EnableMenuItem(hPopup, IDM_POPUP_MOSTBACK, MF_BYCOMMAND | MF_GRAYED);
    }
    TrackPopupMenu(hPopup, TPM_LEFTALIGN, LOWORD(lParam), HIWORD(lParam),
                   0, hWnd, NULL);
    DestroyMenu(hMenu);
    return 0;
}
开发者ID:MaybeS,项目名称:when_i_was_a_kid,代码行数:36,代码来源:ApiDraw.cpp

示例3: _OnMenuOpen

    //------------------------------------------------------------------------
    static void _OnMenuOpen( HWND hwnd )
    {
        HMENU   menu = NULL;
        WORD    command;
        POINT   curpos;

        // set focus
        SetForegroundWindow( hwnd );

        // get position for popup menu
        GetCursorPos(&curpos);

        // show popup menu
        command = TrackPopupMenu(
            _menu,
            TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY | TPM_BOTTOMALIGN,
            curpos.x, curpos.y,
            0,
            hwnd,
            NULL );

        // forward return command
        SendMessage( hwnd, WM_COMMAND, command, 0 );
    }
开发者ID:menghang,项目名称:YoloMouse,代码行数:25,代码来源:ShellUi.cpp

示例4: SendMessage

wyBool
TabMessage::OnContextMenu(LPARAM lparam)
{
    HMENU   hmenu, htrackmenu;
	POINT   pnt;
	wyInt32 pos;
    RECT    rect;

	if(lparam == -1)
	{		
		pos = SendMessage(m_hwnd, SCI_GETCURRENTPOS, 0, 0);
		pnt.x = SendMessage(m_hwnd, SCI_POINTXFROMPOSITION, 0, pos) ; 
		pnt.y = SendMessage(m_hwnd, SCI_POINTYFROMPOSITION, 0, pos); 
		ClientToScreen(m_hwnd, &pnt);
	}
	else
	{
		pnt.x = (LONG)LOWORD(lparam);
		pnt.y = (LONG)HIWORD(lparam);
	}

    GetClientRect(m_hwnd, &rect);
    MapWindowPoints(m_hwnd, NULL, (LPPOINT)&rect, 2);

    if(!PtInRect(&rect, pnt))
    {
        return wyFalse;
    }

    hmenu = LoadMenu(pGlobals->m_hinstance, MAKEINTRESOURCE(IDR_MESSAGETAB_MENU));
    LocalizeMenu(hmenu);
    htrackmenu = GetSubMenu(hmenu, 0);
	TrackPopupMenu(htrackmenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pnt.x, pnt.y, 0, m_hwnd, NULL);
    DestroyMenu(hmenu);
    return wyTrue;
}
开发者ID:ArsalanYaqoob,项目名称:sqlyog-community,代码行数:36,代码来源:TabMessage.cpp

示例5: switch

INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
{
	if (!m_HandleCommands)
	{
		// Values are being changed/reset, no need to apply changes
		return FALSE;
	}

	switch (LOWORD(wParam))
	{
	case IDC_MANAGESKINS_ACTIVESKINS_BUTTON:
		{
			HMENU menu = CreatePopupMenu();

			// Add active skins to menu
			std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
			int index = 0;
			for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
			{
				std::wstring name = ((*iter).second)->GetFolderPath() + L'\\';
				name += ((*iter).second)->GetFileName();
				InsertMenu(menu, index, MF_BYPOSITION, ID_CONFIG_FIRST + index, name.c_str());
				++index;
			}

			if (index > 0)
			{
				RECT r;
				GetWindowRect((HWND)lParam, &r);

				// Show context menu
				TrackPopupMenu(
					menu,
					TPM_RIGHTBUTTON | TPM_LEFTALIGN,
					(*GetString(ID_STR_ISRTL) == L'1') ? r.right : r.left,
					--r.bottom,
					0,
					m_Window,
					NULL
				);
			}

			DestroyMenu(menu);
		}
		break;

	case IDC_MANAGESKINS_CREATEPACKAGE_BUTTON:
		{
			std::wstring file = Rainmeter->GetPath() + L"SkinInstaller.exe";
			RunFile(file.c_str(), L"/Packager");
		}
		break;

	case IDC_MANAGESKINS_LOAD_BUTTON:
		{
			if (!m_SkinWindow)
			{
				// Skin not active, load
				std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(m_SkinFolderPath, m_SkinFileName);
				if (indexes.first != -1 && indexes.second != -1)
				{
					Rainmeter->ActivateSkin(indexes.first, indexes.second);

					// Fake selection change to update controls
					NMHDR nm;
					nm.code = TVN_SELCHANGED;
					nm.idFrom = IDC_MANAGESKINS_SKINS_TREEVIEW;
					nm.hwndFrom = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
					OnNotify(0, (LPARAM)&nm);
				}
			}
			else
			{
				m_HandleCommands = false;
				Rainmeter->DeactivateSkin(m_SkinWindow, -1);
			}
		}
		break;

	case IDC_MANAGESKINS_REFRESH_BUTTON:
		if (m_SkinWindow)
		{
			m_SkinWindow->Refresh(false);
		}
		break;

	case IDC_MANAGESKINS_EDIT_BUTTON:
		Rainmeter->EditSkinFile(m_SkinFolderPath, m_SkinFileName);
		break;

	case IDC_MANAGESKINS_X_TEXT:
		if (HIWORD(wParam) == EN_CHANGE)
		{
			WCHAR buffer[32];
			m_IgnoreUpdate = true;
			int x = (GetWindowText((HWND)lParam, buffer, 32) > 0) ? _wtoi(buffer) : 0;
			m_SkinWindow->MoveWindow(x, m_SkinWindow->GetY());

			if (x > m_SkinWindow->GetX())
			{
//.........这里部分代码省略.........
开发者ID:JamesAC,项目名称:rainmeter,代码行数:101,代码来源:DialogManage.cpp

示例6: WndProc

BOOL CALLBACK
WndProc (HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
    static HBRUSH hBrush = NULL;

    switch (umsg)
    {
    case WM_CREATE:
	if (!render_init (hwnd, g_gui_prefs.default_skin)) {
	    MessageBox(hwnd, "Failed to find the skin bitmap", "Error", 0);
	    break;
	}
	stop_button_disable();
	if (OPT_FLAG_ISSET(g_rmo.flags, OPT_MAKE_RELAY)) {
	    render_relay_button_enable ();
	} else {
	    render_relay_button_disable ();
	}

	SetTimer (hwnd, 1, 500, (TIMERPROC)UpdateDisplay);
	dock_init (hwnd);

	return 0;

    case WM_PAINT:
	{
	    PAINTSTRUCT pt;
	    HDC hdc = BeginPaint(hwnd, &pt);
	    render_do_paint(hdc);
	    EndPaint(hwnd, &pt);
	}
	return 0;
		
    case WM_MOUSEMOVE:
	render_do_mousemove (hwnd, wParam, lParam);
	dock_do_mousemove (hwnd, wParam, lParam);
	break;

    case WM_COMMAND:
	switch(wParam)
	{
	case ID_MENU_STARTRIPPING:
	    start_button_pressed();
	    break;
	case ID_MENU_STOPRIPPING:
	    stop_button_pressed();
	    break;
	case ID_MENU_OPTIONS:
	    options_button_pressed();
	    break;
	case ID_MENU_OPEN:
	    PostMessage(hwnd, WM_MY_TRAY_NOTIFICATION, (WPARAM)NULL, WM_LBUTTONDBLCLK);
	    break;
	case ID_MENU_RESET_URL:
	    strcpy(g_rmo.url, "");
	    set_ripping_url (0);
	    break;
	case ID_MENU_LOAD_URL:
	    debug_printf ("Load URL dialog box\n");
	    open_load_url_dialog ();
	    break;
	case ID_MENU_EXIT:
	    debug_printf ("User requested exit\n");
	    quit ();
	    PostQuitMessage( 0 );
	    break;
	default:
	    if (wParam >= ID_MENU_HISTORY_LIST && wParam < ID_MENU_HISTORY_LIST + RIPLIST_LEN) {
		int i = wParam - ID_MENU_HISTORY_LIST;
		char* url = g_gui_prefs.riplist[i];
		debug_printf ("Setting URL through history list\n");
		strcpy(g_rmo.url, url);
		set_ripping_url (url);
	    }
	    break;
	}
	break;

    case WM_MY_TRAY_NOTIFICATION:
	switch(lParam)
	{
	case WM_LBUTTONDBLCLK:
	    dock_show_window(m_hwnd, SW_NORMAL);
	    SetForegroundWindow(hwnd);
	    g_gui_prefs.m_start_minimized = FALSE;
	    break;

	case WM_RBUTTONDOWN:
	    {
		int item;
		POINT pt;
		GetCursorPos(&pt);
		SetForegroundWindow(hwnd);
		item = TrackPopupMenu(m_hmenu_systray_sub, 
				      0,
				      pt.x,
				      pt.y,
				      (int)NULL,
				      hwnd,
				      NULL);
//.........这里部分代码省略.........
开发者ID:dre-hh,项目名称:streamripper,代码行数:101,代码来源:plugin_main.c

示例7: IH_DlgMain


//.........这里部分代码省略.........
        }
        return TRUE;

        case IDC_BTN_COPY:
        {
            NoFocus();
            if(g_codeText[0])
            {
                IH_GenerateAsmCode(g_codeText, g_TargetData);
                CopyToClipboard(g_codeText);
                MessageBoxA(hwndDlg, "Code copied to clipboard!", "Yay!", MB_ICONINFORMATION);
            }
            else
                MessageBoxA(hwndDlg, "There is no code to copy, please load a file first...", "Error!", MB_ICONERROR);
        }
        return TRUE;

        case IDC_BTN_PLUGINS:
        {
            NoFocus();
            PLUGFUNC PluginFunction;
            HINSTANCE PLUGIN_INST;
            char total_found_s[5]="";
            char plugin_name[100]="";
            char plugin_dll[100]="";
            char dll_to_load[256]="";
            char temp_str[5]="";
            int total_found=0;
            GetPrivateProfileStringA("Plugins", "total_found", "", total_found_s, 4, sg_szPluginIniFilePath);
            sscanf(total_found_s, "%d", &total_found);
            if(total_found)
            {
                HMENU myMenu=0;
                myMenu=CreatePopupMenu();
                for(int i=1; i!=(total_found+1); i++)
                {
                    sprintf(temp_str, "%d", i);
                    GetPrivateProfileStringA(temp_str, "plugin_name", "", plugin_name, 100, sg_szPluginIniFilePath);
                    AppendMenuA(myMenu, MF_STRING, i, plugin_name);
                }
                POINT cursorPos;
                GetCursorPos(&cursorPos);
                SetForegroundWindow(hwndDlg);
                UINT MenuItemClicked=TrackPopupMenu(myMenu, TPM_RETURNCMD|TPM_NONOTIFY, cursorPos.x, cursorPos.y, 0, hwndDlg, 0);
                SendMessage(hwndDlg, WM_NULL, 0, 0);
                if(!MenuItemClicked)
                    return TRUE;

                sprintf(temp_str, "%d", (int)MenuItemClicked);
                GetPrivateProfileStringA(temp_str, "plugin_dll", "", plugin_dll, 100, sg_szPluginIniFilePath);
                sprintf(dll_to_load, "plugins\\%s", plugin_dll);

                PLUGIN_INST=LoadLibraryA(dll_to_load);
                if(!PLUGIN_INST)
                    MessageBoxA(hwndDlg, "There was an error loading the plugin", plugin_dll, MB_ICONERROR);
                else
                {
                    PluginFunction=(PLUGFUNC)GetProcAddress(PLUGIN_INST, "PluginFunction");
                    if(!PluginFunction)
                        MessageBoxA(hwndDlg, "The export \"PluginFunction\" could not be found, please contact the plugin supplier", plugin_dll, MB_ICONERROR);
                    else
                    {
                        if(!g_TargetData.ImageBase)
                            g_TargetData.ImageBase=0x400000;

                        ShowWindow(GetParent(hwndDlg), 0);
                        PluginFunction(PLUGIN_INST, hwndDlg, g_TargetData.SecurityAddrRegister, sg_szAKTDirectory, g_TargetData.ImageBase);
                        ShowWindow(GetParent(hwndDlg), 1);
                        FreeLibrary(PLUGIN_INST);
                        SetForegroundWindow(hwndDlg);

                    }
                }
            }
            else
            {
                HMENU myMenu=0;
                myMenu=CreatePopupMenu();
                AppendMenuA(myMenu, MF_STRING|MF_GRAYED, 1, "No plugins found :(");
                POINT cursorPos;
                GetCursorPos(&cursorPos);
                SetForegroundWindow(hwndDlg);
                TrackPopupMenu(myMenu, TPM_RETURNCMD|TPM_NONOTIFY, cursorPos.x, cursorPos.y, 0, hwndDlg, 0);
            }
        }
        return TRUE;

        case IDC_EDT_OEP:
        {
            char temp_oep[10]="";
            GetDlgItemTextA(hwndDlg, IDC_EDT_OEP, temp_oep, 10);
            sscanf(temp_oep, "%X", &(g_TargetData.OEP));
        }
        return TRUE;
        }
    }
    return TRUE;
    }
    return FALSE;
}
开发者ID:pepeng,项目名称:akt,代码行数:101,代码来源:InlineHelper_dialog.cpp

示例8: ShowOTRMenu

void ShowOTRMenu(MCONTACT hContact, POINT pt){
	HMENU menu = (HMENU) CallService(MS_MIROTR_MENUBUILDMIROTR, hContact, 0);
	SetWindowLongPtr(hDummyPaintWin, GWLP_USERDATA, (LONG_PTR)hContact);
	TrackPopupMenu(menu, 0, pt.x, pt.y, 0, hDummyPaintWin, 0);
	DestroyMenu(menu);
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:6,代码来源:mirotrmenu.cpp

示例9: HotkeyHandlerDlgProc


//.........这里部分代码省略.........

				if (dis->itemData >= 0) {
					HICON hIcon;
					BOOL fNeedFree = FALSE;

					if (dis->itemData > 0)
						hIcon = dis->itemData & 0x10000000 ? hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent;
					else if (dat != NULL) {
						hIcon = MY_GetContactIcon(dat);
						idle = dat->idle;
					} else
						hIcon = PluginConfig.g_iconContainer;

					DrawMenuItem(dis, hIcon, idle);
					if (fNeedFree)
						DestroyIcon(hIcon);

					return TRUE;
				}
			}
		}
		break;
		case DM_TRAYICONNOTIFY: {
			int iSelection;

			if (wParam == 100 || wParam == 101) {
				switch (lParam) {
					case WM_LBUTTONUP: {
						POINT pt;
						GetCursorPos(&pt);
						if (wParam == 100)
							SetForegroundWindow(hwndDlg);
						if (GetMenuItemCount(PluginConfig.g_hMenuTrayUnread) > 0) {
							iSelection = TrackPopupMenu(PluginConfig.g_hMenuTrayUnread, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
							HandleMenuEntryFromhContact(iSelection);
						} else
							TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 8), TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
						if (wParam == 100)
							PostMessage(hwndDlg, WM_NULL, 0, 0);
						break;
					}
					case WM_MBUTTONDOWN: {
						MENUITEMINFOA mii = {0};
						int i, iCount = GetMenuItemCount(PluginConfig.g_hMenuTrayUnread);

						if (wParam == 100)
							SetForegroundWindow(hwndDlg);

						if (iCount > 0) {
							UINT uid = 0;
							mii.fMask = MIIM_DATA;
							mii.cbSize = sizeof(mii);
							i = iCount - 1;
							do {
								GetMenuItemInfoA(PluginConfig.g_hMenuTrayUnread, i, TRUE, &mii);
								if (mii.dwItemData > 0) {
									uid = GetMenuItemID(PluginConfig.g_hMenuTrayUnread, i);
									HandleMenuEntryFromhContact(uid);
									break;
								}
							} while (--i >= 0);
							if (uid == 0 && pLastActiveContainer != NULL) {                // no session found, restore last active container
								if (IsIconic(pLastActiveContainer->hwnd) || !IsWindowVisible(pLastActiveContainer->hwnd)) {
									SendMessage(pLastActiveContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
									SetForegroundWindow(pLastActiveContainer->hwnd);
								} else {
开发者ID:raoergsls,项目名称:miranda,代码行数:67,代码来源:hotkeyhandler.cpp

示例10: hb_gt_wvw_TBMouseEvent

static void hb_gt_wvw_TBMouseEvent( PWVW_WIN wvw_win, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
   POINT xy, colrow;
   SHORT keyCode  = 0;
   SHORT keyState = 0;

   PWVW_GLO wvw = hb_gt_wvw();

   HB_SYMBOL_UNUSED( hWnd );
   HB_SYMBOL_UNUSED( wParam );

   if( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE )
   {
      if( ! wvw_win->MouseMove )
         return;
   }

   xy.x = LOWORD( lParam );
   xy.y = HIWORD( lParam );

   colrow = hb_gt_wvw_TBGetColRowFromXY( wvw_win, xy.x, xy.y );

   hb_gt_wvw_SetMouseX( wvw_win, colrow.x );
   hb_gt_wvw_SetMouseY( wvw_win, colrow.y );

   switch( message )
   {
      case WM_LBUTTONDBLCLK:
         keyCode = K_LDBLCLK;
         break;

      case WM_RBUTTONDBLCLK:
         keyCode = K_RDBLCLK;
         break;

      case WM_LBUTTONDOWN:
      {
         HWND hWndFocus = GetFocus();

         if( hb_gt_wvw_GetControlClass( wvw_win, hWndFocus ) > 0 )
            SetFocus( hWnd );

         keyCode = K_LBUTTONDOWN;
         break;
      }

      case WM_RBUTTONDOWN:
         keyCode = K_RBUTTONDOWN;
         break;

      case WM_LBUTTONUP:
         keyCode = K_LBUTTONUP;
         break;

      case WM_RBUTTONUP:

         if( wvw_win->hPopup )
         {
            int nPopupRet;
            GetCursorPos( &xy );
            nPopupRet = ( int ) TrackPopupMenu( wvw_win->hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, xy.x, xy.y, 0, hWnd, NULL );
            if( nPopupRet )
               hb_gt_wvw_AddCharToInputQueue( nPopupRet );
            return;
         }
         else
         {
            keyCode = K_RBUTTONUP;
            break;
         }

      case WM_MBUTTONDOWN:
         keyCode = K_MBUTTONDOWN;
         break;

      case WM_MBUTTONUP:
         keyCode = K_MBUTTONUP;
         break;

      case WM_MBUTTONDBLCLK:
         keyCode = K_MDBLCLK;
         break;

      case WM_MOUSEMOVE:
         keyState = ( SHORT ) wParam;

         if( keyState == MK_LBUTTON )
            keyCode = K_MMLEFTDOWN;
         else if( keyState == MK_RBUTTON )
            keyCode = K_MMRIGHTDOWN;
         else if( keyState == MK_MBUTTON )
            keyCode = K_MMMIDDLEDOWN;
         else
            keyCode = K_MOUSEMOVE;
         break;

      case WM_MOUSEWHEEL:
         keyState = HIWORD( wParam );

         if( keyState > 0 )
//.........这里部分代码省略.........
开发者ID:emazv72,项目名称:core,代码行数:101,代码来源:toolbar.c

示例11: wndProc

static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 
{
	MWinDataType *data = (MWinDataType*)GetWindowLongPtr(hwnd, GWLP_USERDATA);

	switch(msg) 
	{
	case WM_CREATE:
		data = (MWinDataType*)mir_calloc(sizeof(MWinDataType));
		SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);

		data->hContact = (HANDLE)((LPCREATESTRUCT)lParam)->lpCreateParams;
		data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD, 
			0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, NULL, hInst, 0);
		if (data->hAvt) SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact);
		break;

	case WM_DESTROY:
		mir_free(data);
		break;

	case WM_CONTEXTMENU:
		{
			POINT pt;
			HMENU hMenu;

			hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)data->hContact, 0);
			GetCursorPos(&pt);
			TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, NULL);
			DestroyMenu(hMenu);
		}
		break;

	case WM_MOUSEMOVE:
		if (f_TrackMouseEvent)
		{
			TRACKMOUSEEVENT tme = {0};
			tme.cbSize = sizeof(TRACKMOUSEEVENT);
			tme.hwndTrack = hwnd;
			tme.dwFlags = TME_QUERY;
			f_TrackMouseEvent(&tme);

			if (tme.dwFlags == 0)
			{
				tme.dwFlags = TME_HOVER | TME_LEAVE;
				tme.hwndTrack = hwnd;
				tme.dwHoverTime = CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0);
				f_TrackMouseEvent(&tme);
			}
		}
		break;

	case WM_MOUSEHOVER:
		{
			POINT pt;
			CLCINFOTIP ti = {0};

			GetCursorPos(&pt);
			GetWindowRect(hwnd, &ti.rcItem);

			ti.cbSize = sizeof(ti);
			ti.hItem = data->hContact;
			ti.ptCursor = pt;
			ti.isTreeFocused = 1;
			CallService(MS_TOOLTIP_SHOWTIP, 0, (LPARAM)&ti);
		}
		break;

	case WM_LBUTTONDBLCLK:
		BriefInfo((WPARAM)data->hContact, 0);
		break;

	case WM_COMMAND:	 //Needed by the contact's context menu
		if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU), (LPARAM)data->hContact))
			break;
		return FALSE;

	case WM_MEASUREITEM:	//Needed by the contact's context menu
		return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);

	case WM_DRAWITEM:	//Needed by the contact's context menu
		return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->code == NM_AVATAR_CHANGED)
		{
			BOOL newava = CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0) != 0;
			if (newava != data->haveAvatar)
			{
				LONG_PTR style = GetWindowLongPtr(data->hAvt, GWL_STYLE);
				data->haveAvatar = newava;
				SetWindowLongPtr(data->hAvt, GWL_STYLE, newava ? (style | WS_VISIBLE) : (style & ~WS_VISIBLE));
				RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
			}
		}
		break;

	case WM_REDRAWWIN:
		if (data->hAvt != NULL) MoveWindow(data->hAvt, 0, 0, opt.AvatarSize, opt.AvatarSize, TRUE);
		RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
		break;
//.........这里部分代码省略.........
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:101,代码来源:weather_mwin.c

示例12: AudioDlgProc


//.........这里部分代码省略.........

      case WM_SHOWWINDOW:
        set_window_title(hDlg);
        break;

      case WM_NOTIFY:
	switch(((LPNMHDR)lParam)->code) {
	    case PSN_KILLACTIVE:
	      SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
	      break;
	    case PSN_APPLY:
	      set_reg_key(config_key, "Drivers", "Audio", curAudioDriver);
              apply();
	      SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
	      break;
	    case PSN_SETACTIVE:
	      break;
            case NM_CLICK:
              if (((LPNMHDR)lParam)->idFrom == IDC_AUDIO_TREE)
              {
                  TVHITTESTINFO ht;
                  DWORD dwPos = GetMessagePos();
                  HWND tree = ((LPNMHDR)lParam)->hwndFrom;
                  ZeroMemory(&ht, sizeof(ht));
                  ht.pt.x = (short)LOWORD(dwPos);
                  ht.pt.y = (short)HIWORD(dwPos);
                  MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1);
                  SendMessageW( tree, TVM_HITTEST, 0, (LPARAM)&ht );
                  if (TVHT_ONITEMSTATEICON & ht.flags)
                  {
                      TVITEM tvItem;
                      int index;
                      ZeroMemory(&tvItem, sizeof(tvItem));
                      tvItem.hItem = ht.hItem;
                      SendMessageW( tree, TVM_GETITEMW, 0, (LPARAM) &tvItem );

                      index = TreeView_GetItemState(tree, ht.hItem, TVIS_STATEIMAGEMASK);
                      if (index == INDEXTOSTATEIMAGEMASK(1))
                      {
                          TreeView_SetItemState(tree, ht.hItem, INDEXTOSTATEIMAGEMASK(2), TVIS_STATEIMAGEMASK);
                          addDriver(loadedAudioDrv[tvItem.lParam & 0xff].szDriver);
                          SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */
                      }
                      else if (index == INDEXTOSTATEIMAGEMASK(2))
                      {
                          TreeView_SetItemState(tree, ht.hItem, INDEXTOSTATEIMAGEMASK(1), TVIS_STATEIMAGEMASK);
                          removeDriver(loadedAudioDrv[tvItem.lParam & 0xff].szDriver);
                          SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */
                      }
                  }
              }
              break;
            case NM_RCLICK:
              if (((LPNMHDR)lParam)->idFrom == IDC_AUDIO_TREE)
              {
                  TVHITTESTINFO ht;
                  DWORD dwPos = GetMessagePos();
                  HWND tree = ((LPNMHDR)lParam)->hwndFrom;
                  POINT pt;
                  ZeroMemory(&ht, sizeof(ht));
                  pt.x = (short)LOWORD(dwPos);
                  pt.y = (short)HIWORD(dwPos);
                  ht.pt = pt;
                  MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1);
                  SendMessageW( tree, TVM_HITTEST, 0, (LPARAM)&ht );
                  if (TVHT_ONITEMLABEL & ht.flags)
                  {
                      TVITEM tvItem;
                      ZeroMemory(&tvItem, sizeof(tvItem));
                      tvItem.hItem = ht.hItem;
                      tvItem.mask = TVIF_PARAM;
                      tvItem.lParam = -1;
                      if (TreeView_GetItem(tree, &tvItem))
                      {
                          if (tvItem.lParam & DRIVER_MASK)
                          {
                              if (hPopupMenus)
                              {
                                  TrackPopupMenu(GetSubMenu(hPopupMenus, 0), TPM_RIGHTBUTTON, pt.x, pt.y, 0, tree, NULL);
                                  toConfigure = tvItem.lParam & ~DRIVER_MASK;
                              }
                          }
                          else if (tvItem.lParam & DEVICE_MASK)
                          {
                              /* FIXME TBD */
                          }

                      }
                  }
              }
	}
	break;

  case WM_INITDIALOG:
    initAudioDlg(hDlg);
    break;
  }

  return FALSE;
}
开发者ID:mikekap,项目名称:wine,代码行数:101,代码来源:audio.c

示例13: ConfigProc

	static BOOL CALLBACK ConfigProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
	{
		switch (msg)
		{
		case WM_INITDIALOG:
		{
			uTCITEM tabs;
			memset(&tabs, 0, sizeof(tabs));

			HWND wnd_tab = GetDlgItem(wnd, IDC_TAB1);

			tabs.mask = TCIF_TEXT;
			tabs.pszText = "Variables";
			uTabCtrl_InsertItem(wnd_tab, 0, &tabs);
			tabs.pszText = "Style";
			uTabCtrl_InsertItem(wnd_tab, 1, &tabs);

			TabCtrl_SetCurSel(wnd_tab, g_cur_tab2);

			uSendDlgItemMessageText(wnd, IDC_CHAR7, WM_SETTEXT, 0, "\x07");
			colour_code_gen(wnd, IDC_COLOUR, false, true);

			uSendDlgItemMessage(wnd, IDC_STRING, EM_LIMITTEXT, 0, 0);

			refresh_me(wnd);
			editproc = (WNDPROC)SetWindowLongPtr(GetDlgItem(wnd, IDC_STRING), GWLP_WNDPROC, (LPARAM)EditHook);

			g_editor_font_notify.set(GetDlgItem(wnd, IDC_STRING));
		}

		break;

		case WM_NOTIFY:
			switch (((LPNMHDR)lp)->idFrom)
			{
			case IDC_TAB1:
				switch (((LPNMHDR)lp)->code)
				{
				case TCN_SELCHANGE:
				{
					save_string(wnd);
					int id = TabCtrl_GetCurSel(GetDlgItem(wnd, IDC_TAB1));
					g_cur_tab2 = id;
					uSendDlgItemMessageText(wnd, IDC_STRING, WM_SETTEXT, 0, (g_cur_tab2 == 0 ? cfg_globalstring : cfg_colour));
				}
				break;
				}
				break;
			}
			break;

		case WM_DESTROY:
		{
			g_editor_font_notify.release();
			save_string(wnd);
			refresh_all_playlist_views();
			pvt::ng_playlist_view_t::g_update_all_items();
		}
		break;

		case WM_COMMAND:
			switch (wp)
			{
			case IDC_GLOBAL:
				cfg_global = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0);
				break;
			case IDC_DATE:
				cfg_playlist_date = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0);
				set_day_timer();
				pvt::ng_playlist_view_t::g_on_use_date_info_change();
				break;
			case IDC_TFHELP:
			{
				RECT rc;
				GetWindowRect(GetDlgItem(wnd, IDC_TFHELP), &rc);
				//		MapWindowPoints(HWND_DESKTOP, wnd, (LPPOINT)(&rc), 2);
				HMENU menu = CreatePopupMenu();


				enum { IDM_TFHELP = 1, IDM_GHELP = 2, IDM_SPEEDTEST, IDM_PREVIEW, IDM_EDITORFONT, IDM_RESETSTYLE };

				uAppendMenu(menu, (MF_STRING), IDM_TFHELP, "Titleformatting &help");
				uAppendMenu(menu, (MF_STRING), IDM_GHELP, "&Global help");
				uAppendMenu(menu, (MF_SEPARATOR), 0, "");
				uAppendMenu(menu, (MF_STRING), IDM_SPEEDTEST, "&Speed test");
				uAppendMenu(menu, (MF_STRING), IDM_PREVIEW, "&Preview to console");
				uAppendMenu(menu, (MF_SEPARATOR), 0, "");
				uAppendMenu(menu, (MF_STRING), IDM_EDITORFONT, "Change editor &font");
				uAppendMenu(menu, (MF_SEPARATOR), 0, "");
				uAppendMenu(menu, (MF_STRING), IDM_RESETSTYLE, "&Reset style string");


				int cmd = TrackPopupMenu(menu, TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, rc.left, rc.bottom, 0, wnd, 0);
				DestroyMenu(menu);
				if (cmd == IDM_TFHELP)
				{
					standard_commands::main_titleformat_help();
				}
				else if (cmd == IDM_GHELP)
				{
//.........这里部分代码省略.........
开发者ID:ttsping,项目名称:columns_ui,代码行数:101,代码来源:tab_global.cpp

示例14: WndProc


//.........这里部分代码省略.........
		/*
	case WM_SETCURSOR:
		if ((HWND)wParam == hwndStatic)
		{
			if (colormsg == 1) return TRUE;
			SendMessage(hwndStatus, SB_SETTEXT, 0, (LONG) "Email : [email protected]");
			SendMessage(hwndStatic, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 1);
			colormsg = 1;
			InvalidateRgn((HWND)hWnd, 0, 1);
			SetCursor(mycur);
			return TRUE;
		}
		//If not on the static, change the font back to normal. You don't have to worry
		//about the cursor, it will change back to the arrow automatically. I use the
		//'colormsg' flag so it doesn't continually set the font when the cursor is moving
		//around, because it causes it to flicker. If you only use the cursor change and
		//don't worry about the font change you don't have to worry.
		if (colormsg == 1)
		{
			colormsg = 0;
			SendMessage(hwndStatus, SB_SETTEXT, 0, 0);
			SendMessage(hwndStatic, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
			InvalidateRgn((HWND)hWnd, 0, 1);
		}
		
		break;
		*/

	/* 마우스 오른쪽 팝업 메뉴 */
	case WM_CONTEXTMENU:
		hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU1));
		hPopup = GetSubMenu(hMenu, 0);

		TrackPopupMenu(hPopup, TPM_LEFTALIGN, (short)LOWORD(lParam), (short)HIWORD(lParam), 0, hWnd, NULL);
		DestroyMenu(hMenu);
		break;
		
	case WM_LBUTTONDOWN:
		//BitBlt(GetDC(hWnd), 0, 0, 1000, 1000, 0, 0, 0, WHITENESS); //그냥 화면을 하얗게만 할 뿐 뒤에 남아있음
		//image_hyperlink_maker(WinProc_sub, "www.daum.net");
		break;

	case WM_SIZE:
		SendMessage(hState, WM_SIZE, wParam, lParam);
		MoveWindow(hList, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);//디렉터리 탐색창
		break;

	case WM_COMMAND:
		if ((HWND)lParam == hwndStatic) {
			//ShellExecute(Main_hWnd, "open", "www.naver.com", 0, 0, 0);
			cases = 2; //케이스 2번으로 하고 해야 계속해서 링크를 통해 이미지를 받아올 수 있음
			clientsocket(textbox_buffer, PORT_NUM); //cases = 2이기 때문에 그냥 바로 요청하면 된다.
			//input_valid_check(textbox_buffer); // 주소체크하고 dns 실행할지말지 결정
			InvalidateRect(Main_hWnd, NULL, WM_ERASEBKGND);
			UpdateWindow(Main_hWnd);
		}

		switch (LOWORD(wParam)) {
		case 50001:	favorite_clicked(50001);break; case 50002: favorite_clicked(50002);break; case 50003: favorite_clicked(50003);break;
		case 50004:	favorite_clicked(50004);break; case 50005: favorite_clicked(50005);break; case 50006: favorite_clicked(50006);break;
		case 50007:	favorite_clicked(50007);break; case 50008: favorite_clicked(50008);break; case 50009: favorite_clicked(50009);break;
		case 50010:	favorite_clicked(50010);break; case 50011: favorite_clicked(50011);break; case 50012: favorite_clicked(50012);break;

		case IDC_MAIN_BUTTON: // when button is clicked, this will happen: 버튼부분
			SendMessage(EdittextBox, WM_GETTEXT, sizeof(textbox_buffer) / sizeof(textbox_buffer[0]), reinterpret_cast<LPARAM>(textbox_buffer));
			image_file_name = NULL;
开发者ID:LeeSangJae,项目名称:18533,代码行数:67,代码来源:test.cpp

示例15: wndProc

static LRESULT CALLBACK wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
    POINT pt;
    NOTIFYICONDATA nid;
    RECT rect;
    char *txt;

#if 0
    if(message!=WM_CTLCOLORSTATIC && message!=WM_TIMER)
        log(LOG_DEBUG, "Window message: %d", message);
#endif
    switch (message) {
    case WM_CREATE:
        if (options.option.taskbar) /* taskbar update enabled? */
            SetTimer(hwnd, 0x29a, 1000, NULL); /* 1-second timer */
        return TRUE;

    case WM_SIZE:
        GetClientRect(hwnd, &rect);
        MoveWindow(EditControl, 0, 0, rect.right, rect.bottom, TRUE);
        UpdateWindow(EditControl);
        return TRUE;

    case WM_SETFOCUS:
        txt=log_txt();
        SetWindowText(EditControl, txt);
        free(txt);
        SetFocus(EditControl);
        return TRUE;

    case WM_TIMER:
        update_taskbar();
        return TRUE;

    case WM_CLOSE:
        set_visible(0);
        return TRUE;

    case WM_DESTROY:
        DestroyMenu(hmainmenu);
        DestroyMenu(htraymenu);
        ZeroMemory(&nid, sizeof(nid));
        nid.cbSize=sizeof(NOTIFYICONDATA);
        nid.hWnd=hwnd;
        nid.uID=1;
        nid.uFlags=NIF_TIP; /* not really sure what to put here, but it works */
        Shell_NotifyIcon(NIM_DELETE, &nid); /* this removes the icon */
        PostQuitMessage(0);
        KillTimer(hwnd, 0x29a);
        return TRUE;

    case WM_COMMAND:
        switch(wParam) {
        case IDM_ABOUT:
            DialogBox(ghInst, "AboutBox", hwnd, (DLGPROC)about_proc);
            break;
        case IDM_LOG:
            set_visible(!visible);
            break;
        case IDM_CLOSE:
            set_visible(0);
            break;
        case IDM_EXIT:
            DestroyWindow(hwnd);
            break;
        case IDM_SAVEAS:
            save_file(hwnd);
            break;
        case IDM_SETUP:
            MessageBox(hwnd, "Function not implemented",
                options.win32_name, MB_ICONERROR);
            break;
        };
        return TRUE;

    case UWM_SYSTRAY:
        switch (lParam) {
        case WM_RBUTTONUP: /* track a popup menu */
            /* http://support.microsoft.com/support/kb/articles/Q135/7/88.asp */
            GetCursorPos(&pt);
            SetForegroundWindow(hwnd);
            TrackPopupMenu(hpopup, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
            PostMessage(hwnd, WM_NULL, 0, 0); /* see above */
            break;
        case WM_LBUTTONDBLCLK: /* switch log window visibility */
            set_visible(!visible);
            break;
        }
        return TRUE;
    }
    return DefWindowProc(hwnd, message, wParam, lParam);
}
开发者ID:OPSF,项目名称:uClinux,代码行数:91,代码来源:gui.c


注:本文中的TrackPopupMenu函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。