How to display a transparent gif on top of the screen?
-
Hi I'm very fresh with MFC programming. My program works on the background, when the user clicks on a predefined hot key, the app performes the action and what I'm trying to do is to notify the user with an ok image on top of the screen for less than a second and disappear. I tried to create a dialog without window borders with a picture control within, the problems i encountered are: a. The picture control takes only bmp files which are can not be transparent. b. Whenever i set the dialog as transparent it is not become on top and start to act weird. The folowing code works fine except that the picture is not transparent. 1. When the action performed:
AfxBeginThread(notify,NULL);
2. Opennig the dialog:UINT notify(LPVOID pParam){ NotifyDialog saved; saved.DoModal(); return TRUE; }
3. The initialization of the dialog:BOOL NotifyDialog::OnInitDialog() { CDialog::OnInitDialog(); hDlg = this->m_hWnd; //Saving dialog handler for closing it AfxBeginThread(WaitingToHideIcon,(LPVOID)NULL); return TRUE; }
4. Closing the dialog:UINT WaitingToHideIcon(LPVOID pParam){ Sleep(600); EndDialog(hDlg,1); return 0; }
5. The resource of the dialog and the picture control:IDD_NOTIFYDIALOG DIALOGEX 0, 0, 58, 71 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_SYSMENU EXSTYLE WS_EX_TOPMOST FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL 143,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,0,0, 58,71 END IDB_BITMAP1 BITMAP "res\\OkHandSign.bmp"
I would love to get suggestions and improvements on how to do this Thanks a lot Mamtz -
Hi I'm very fresh with MFC programming. My program works on the background, when the user clicks on a predefined hot key, the app performes the action and what I'm trying to do is to notify the user with an ok image on top of the screen for less than a second and disappear. I tried to create a dialog without window borders with a picture control within, the problems i encountered are: a. The picture control takes only bmp files which are can not be transparent. b. Whenever i set the dialog as transparent it is not become on top and start to act weird. The folowing code works fine except that the picture is not transparent. 1. When the action performed:
AfxBeginThread(notify,NULL);
2. Opennig the dialog:UINT notify(LPVOID pParam){ NotifyDialog saved; saved.DoModal(); return TRUE; }
3. The initialization of the dialog:BOOL NotifyDialog::OnInitDialog() { CDialog::OnInitDialog(); hDlg = this->m_hWnd; //Saving dialog handler for closing it AfxBeginThread(WaitingToHideIcon,(LPVOID)NULL); return TRUE; }
4. Closing the dialog:UINT WaitingToHideIcon(LPVOID pParam){ Sleep(600); EndDialog(hDlg,1); return 0; }
5. The resource of the dialog and the picture control:IDD_NOTIFYDIALOG DIALOGEX 0, 0, 58, 71 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_SYSMENU EXSTYLE WS_EX_TOPMOST FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL 143,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,0,0, 58,71 END IDB_BITMAP1 BITMAP "res\\OkHandSign.bmp"
I would love to get suggestions and improvements on how to do this Thanks a lot Mamtz