GDI

ZXNet echo conference «zxnet.pc»

From Eugene Palenock To Aleksandr Majorov 4 September 2003

Hello, Alexander! By the way, how did you do that subject glitch? I do it in the CreatePen(PS_SOLID,1,1) loop - after they are completed (when it starts return error) the interface is glitchy, but not as bad as yours... Best regards, Evgeniy.

From Aleksandr Majorov To Eugene Palenock 8 September 2003

Hello Eugene! 04 Sep 03 02:31, Eugene Palenock -> Aleksandr Majorov: EP> By the way, how did you do that subject glitch? Honestly speaking, by accident :) I searched for him much longer and more fun! EP> I do it in the CreatePen(PS_SOLID,1,1) loop - after they are completed (when EP> starts to return an error) the interface is glitchy, but not so much EP> how are you... Hehe, you also need to be able to glitch skillfully! %) It appears to be written on MSVC, the project is “normal dialogue” (it’s easier that way) ╒═════════════════════════ Home GlukDlg.cpp ═════════════════════════╕ ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // In the GlukDlg.h header we describe the variables: DWORD m_Res; CString m_Time; time_t m_time; CImageList Image_Tray; // System Tray Icons int m_num; NOTIFYICONDATA m_Tray; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // CGlukDlg message handlers BOOL CGlukDlg::OnInitDialog(){ CDialog::OnInitDialog(); // preparing for a glitch // we will often call the glitch function m_time = time(NULL); SetTimer(0, 10, NULL); // loaded the bitmap into an array of images,Image_Tray.Create(IDB_SYSTRAY, 16, 8, RGB(1,1,1)); m_num = 0; // for clarity, let's create an icon in the system tray and animate it there. m_Tray.cbSize = sizeof(NOTIFYICONDATA); m_Tray.hWnd = m_hWnd; m_Tray.uID = 123; m_Tray.uCallbackMessage = WM_USER; sprintf(m_Tray.szTip, "Glitch!"); m_Tray.hIcon = Image_Tray.ExtractIcon(0); // times leak m_Tray.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; Shell_NotifyIcon(NIM_ADD, &m_Tray); return TRUE; } // and here is the function that will be called by timer void CGlukDlg::OnTimer(UINT nIDEvent){ time_t xtime; int hour, min, sec; CDialog::OnTimer(nIDEvent); // display how long we've been buggy xtime = time(NULL) - m_time; hour = xtime / 60; min = hour % 60; hour /= 60; sec = xtime % 60; m_Time.Format("%02i:%02i:%02i", hour, min, sec); // and here’s the actual glitch! m_Tray.hIcon = Image_Tray.ExtractIcon(m_num); m_Tray.uFlags = NIF_ICON; Shell_NotifyIcon(NIM_MODIFY, &m_Tray); /* what we wanted to do: to make the tray icon animated, but for convenience we want store all icons in one bmp file. By standard means we loaded this BMP into CImageList, which has a standard function “get icon by index” ExtractIcon().What we got: well, yes, everything is animated. However, as it turns out, ExtractIcon() works differently: it does not remove the icon, but creates a new one and copies it into it picture by index. Those. it would be more correct to call this subtitle as CreateIcon()! And if the created icon is not killed with something like DestroyObject(m_Tray.hIcon), then the icons will multiply and multiply. And then they'll jump! :) And _nowhere_ there is not a word about the danger of this crap with ExtractIcon()! */ // count the number of killed resources if(m_Tray.hIcon != NULL) m_Res++; m_num++; if(m_num == 8) m_num = 0; CString str; str.Format("%i", m_Res); GetDlgItem(IDC_EDIT1)->SetWindowText(str); GetDlgItem(IDC_EDIT2)->SetWindowText(m_Time); } ╘═════════════════════════ End GlukDlg.cpp ═════════════════════════╛ Alexand

From Eugene Palenock To Aleksandr Majorov 10 September 2003

Hello, Alexander! 08 Sep 03 19:21, Aleksandr Majorov -> Eugene Palenock: AM> ExtractIcon() works differently: it does not extract the icon, but creates a new one AM> copies the image into it by index. Those. it would be more correct AM> call this item CreateIcon()! And if the created icon is not killed AM> something like DestroyObject(m_Tray.hIcon), then the icons will be multiplied and AM> multiply. And then they'll jump! :) AM> And _nowhere_ there is not a word about the danger of this muck with ExtractIcon()! I am reading msdn-2002-06: Remarks You must destroy the icon handle returned by ExtractIcon by calling the DestroyIcon function. PS I suspect that any handles (for example, file ;) may run out. And any Windows will crash. Because IMHO in the case of, for example, hFile, their kernel cannot Is it somehow safe to limit for the user... Best regards, Evgeniy.

From Aleksandr Majorov To Eugene Palenock 12 September 2003

Hello Eugene! 10 Sep 03 00:28, Eugene Palenock -> Aleksandr Majorov: [skipped] AM>> And _nowhere_ there is not a word about the danger of this muck AM>> ExtractIcon()! EP> Reading msdn-2002-06: EP> Remarks EP> You must destroy the icon handle returned by ExtractIcon by calling EP> the DestroyIcon function. Well, that means I didn't read well. EP> PS. I suspect that any handles (for example, file ;) can EP> will end. And any Windows will collapse. Because IMHO in the case of, for example, hFile - EP> their kernel cannot securely limit for the user in any way... Windows crashes faster and more fun if you open a new one in an endless loop window. At least that’s what was written on the forum, I didn’t check it myself :) Alexand