// -------------------------------------------- void Desk_Init(void) { if (Settings_disableDesk) ; else if (Settings_desktopHook) { if (load_imp(&pSetHooks, deskhook_dll, "SetHooks")) pSetHooks(BBhwnd, g_underExplorer); else BBMessageBox(MB_OK, NLS2("$Error_DesktopHook$", "Error: %s not found!"), deskhook_dll); } else { BBRegisterClass(szDesktopName, Desk_WndProc, BBCS_VISIBLE); CreateWindowEx( WS_EX_TOOLWINDOW, szDesktopName, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, 0,0,0,0, GetDesktopWindow(), NULL, hMainInstance, NULL ); } Desk_new_background(NULL); }
int BBMessageBox(int flg, const char *fmt, ...) { const char *caption = BBAPPNAME; const char *message; char *p, *q; int r; va_list args; static int (WINAPI *pMessageBoxIndirectW)(CONST MSGBOXPARAMSW*); va_start(args, fmt); message = p = m_formatv(fmt, args); if ('#' == p[0] && NULL != (q = strchr(p+1, p[0]))) // "#Title#Message" is wanted *q = 0, caption = p+1, message = q+1; #ifdef BBTINY r = MessageBox (NULL, message, caption, flg | MB_SYSTEMMODAL); #else MessageBeep(0); if (usingNT && load_imp(&pMessageBoxIndirectW, "user32.dll", "MessageBoxIndirectW")) { MSGBOXPARAMSW mp; int lc = 1+strlen(caption); int lm = 1+strlen(message); WCHAR *wcaption = (WCHAR*)m_alloc(lc * sizeof (WCHAR)); WCHAR *wmessage = (WCHAR*)m_alloc(lm * sizeof (WCHAR)); bbMB2WC(caption, wcaption, lc); bbMB2WC(message, wmessage, lm); memset(&mp, 0, sizeof mp); mp.cbSize = sizeof mp; mp.hInstance = hMainInstance; //mp.hwndOwner = NULL; mp.lpszText = wmessage; mp.lpszCaption = wcaption; mp.dwStyle = flg | MB_USERICON | MB_SYSTEMMODAL; mp.lpszIcon = MAKEINTRESOURCEW(IDI_BLACKBOX); r = pMessageBoxIndirectW(&mp); m_free(wcaption); m_free(wmessage); } else { MSGBOXPARAMSA mp; memset(&mp, 0, sizeof mp); mp.cbSize = sizeof mp; mp.hInstance = hMainInstance; //mp.hwndOwner = NULL; mp.lpszText = message; mp.lpszCaption = caption; mp.dwStyle = flg | MB_USERICON | MB_SYSTEMMODAL; mp.lpszIcon = MAKEINTRESOURCE(IDI_BLACKBOX); r = MessageBoxIndirectA(&mp); } #endif m_free(p); return r; }
char* get_exe_path(HINSTANCE h, char* pszPath, int nMaxLen) { GetModuleFileName(h, pszPath, nMaxLen); if (load_imp(&pGetLongPathName, "KERNEL32.DLL", "GetLongPathNameA")) pGetLongPathName(pszPath, pszPath, nMaxLen); *(char*)file_basename(pszPath) = 0; return pszPath; }