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

Dialog隱藏後不在task tray顯示

程式最小化至系統列的測試中發現即使程式最小化之後,還是會存在task tray內,這樣看起來是有點怪。因此需要在最小化時,另外去處理。

所需用到的Api為SetWindowLongPtr(MSDN上說明這樣在32與64平台間比較有相容性)
LONG_PTR SetWindowLongPtr(  
HWND hWnd,
int nIndex,
LONG_PTR dwNewLong
);

以及GetWindowLongPtr
LONG_PTR GetWindowLongPtr(  
HWND hWnd,
int nIndex
);

要不顯示於task tray的時候需用
SetWindowLongPtr(hWnd, GWL_EXSTYLE,GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW);

如需還原時則可使用
SetWindowLongPtr(hWnd, GWL_EXSTYLE,GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_TOOLWINDOW);

這邊所使用的參數WS_EX_TOOLWINDOW據MSDN的說法,可以讓ALT+TAB的時候也看不到程式,但測試的結果是失敗的,所以看來還需要其他方法才能達成吧。
(結果上面那段寫完之後,竟然成功的在ALT+TAB裡面看不到隱藏的程式,這可真是神奇阿XDD)
參數部分可參考CreateWindowEX裡的dwExStyle。

最後完成的code如下:
LRESULT CMainDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
switch ( message )
{
case WM_USER: //NOTE:滑鼠移到上面就會送這個進來了
if ( lParam == WM_LBUTTONDBLCLK )
{
SetWindowLongPtr(hWnd, GWL_EXSTYLE,this->ShowWindow(SW_SHOW);
}else if ( lParam == WM_RBUTTONDOWN ) {
::AfxMessageBox("OnMessage_Right button");
}
break;
case WM_SYSCOMMAND: //NOTE:OnCancel會進來到這邊
if ( wParam == SC_MINIMIZE || wParam == SC_CLOSE)
{
if ( wParam == SC_CLOSE )
{
SetWindowLongPtr(hWnd, GWL_EXSTYLE, this->ShowWindow(SW_HIDE);
this->GotoSystemTray();
}
}
break;
}

return CDialog::WindowProc(message, wParam, lParam);
}

Reference:http://delphi.ktop.com.tw/board.php?cid=168&fid=912&tid=74287

Comments

Popular Posts