Skip to main content

Featured

Build docker image from multiple build contexts

Build docker image from multiple build contexts Building a docker image requires specifying a source of truth to include in the image from a local directory or a remote git repository. In the previous version, the docker BuildKit allows users to specify the build context from a single source of truth only. However, the engineers may need to have the context from different locations based on the type of files. For instance, icons, images or other resources that are not included in the same package, including the resource from other docker images. Fortunately, the Docker Buildx toolkit supports multiple build context flag for Docker 1.4. Let's learn how to use this new feature. The following list is a shortcut for jumping into a specific topic handy. What version of Docker is this tutorial targeting? How to specify the version of Dockerfile frontend? Ho

[Win]在SystemTray Icon上跳出Pop-up Menu

一開始先加入Menu的resource,然後輸入所要顯示的項目。

之後將對應的ID加入到MessageMap裡面去,並且也需要建立對應的操作行為。
這邊所需要用到的Function為ON_COMMAND()
例如:
Message Map
BEGIN_MESSAGE_MAP(CMainDlg, CDialog)
ON_COMMAND(ID_TRAYMENU_MAXIMIZE, OnTraymenuMax)
ON_COMMAND(ID_TRAYMENU_MINIMIZE, OnTraymenuMin)
ON_COMMAND(ID_TRAYMENU_CLOSE, OnTraymenuClose)
ON_COMMAND(ID_TRAYMENU_SHOWBALLOON, &CMDXMainDlg::OnTraymenuShowballoon)
END_MESSAGE_MAP()

之後再宣告CMenu物件來使用。宣告位置在function或是header內都可以。

之後需要彈出menu時,僅需做下列步驟:
     this->m_pRClkMenu->LoadMenu(nMenuID);  
     this->m_pRClkMenu->GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, rect.left, rect.top, this, &rect);  
     this->m_pRClkMenu->Detach();    //這行也會讓menu消失

Maximum function
In Head file
afx_msg void OnTraymenuMax();


In Cpp
void CMainDlg::OnTraymenuMax()
{
this->ShowMainForm();
}


不過目前跳出來的Pop-up menu在focus離開後並不會自行消失,且無法使用HotKey,所以這邊之後有時間再補上。

2009/12/08 - 註記
Pop-up menu不會消失的問題,只需在顯示pop-up menu之前多加個main form的SetForegroundWindow()就可以解決了。

Comments

Popular Posts