#include <string>
#include <iostream>
#include <windows.h>
#include <tchar.h>
#include <windowsx.h>
#include <commctrl.h>
#include <objbase.h>
#include <oleauto.h>
#include <malloc.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <vector>
Go to the source code of this file.
Classes | |
struct | CommonControlInit |
initialization of windows common controls More... | |
struct | WaitCursor |
wait cursor More... | |
struct | WindowHandle |
base of all structures storing a window handle More... | |
struct | HiddenWindow |
locally hide a window More... | |
struct | CritSect |
critical section wrapper More... | |
struct | Lock |
Lock protects a code section utilizing a critical section. More... | |
struct | Thread |
Thread base class. More... | |
struct | ClientRect |
ClientRect retreives the client area rectangle of a window. More... | |
struct | WindowRect |
ClientRect retreives the window rectangle of a window. More... | |
struct | Point |
PointL encapsulates the POINT structure into a C++ object. More... | |
struct | FullScreenParameters |
structure containing information about full screen display of the frame window More... | |
struct | PaintCanvas |
PaintCanvas is a encapsulation of device contexts managed by BeginPaint()/EndPaint(). More... | |
struct | Canvas |
Canvas is a encapsulation of device contexts. More... | |
struct | WindowCanvas |
WindowCanvas is a encapsulation of client area device contexts. More... | |
struct | MemCanvas |
Memory Canvas creates and destroys memory devoce contexts. More... | |
struct | SelectedBitmap |
SelectedBitmap is used to localy select bitmaps into device contexts. More... | |
struct | BufferCanvas |
BufferCanvas manages offscreen bitmaps selected into memory device contexts. More... | |
struct | BufferedCanvas |
BufferedCanvas enables double buffering for a device context. More... | |
struct | BufferedPaintCanvas |
BufferedPaintCanvas extends PaintCanvas for double buffering. More... | |
struct | TextColor |
TextColor locally selects a text color for drawing. More... | |
struct | BkMode |
BkMode locally sets the background mode for drawing. More... | |
struct | FontSelection |
FontSelection locally selects a font for drawing. More... | |
struct | BitmapSelection |
BitmapSelection locally selects a bitmap into a device context. More... | |
struct | BrushSelection |
BrushSelection locally selects a brush into a device context. More... | |
struct | PopupMenu |
Popup Menus. More... | |
struct | Variant |
struct | BStr |
struct | String |
string class for TCHAR strings More... | |
struct | FmtString |
struct | UNC |
struct | DynamicFct< FCT > |
link dynamicly to functions by using GetModuleHandle() and GetProcAddress() More... | |
struct | DynamicLoadLibFct< FCT > |
link dynamicly to functions by using LoadLibrary() and GetProcAddress() More... | |
struct | Context |
Defines | |
#define | WIN32_LEAN_AND_MEAN |
#define | WIN32_EXTRA_LEAN |
#define | _MAX_DRIVE 3 |
#define | _MAX_FNAME 256 |
#define | _MAX_DIR _MAX_FNAME |
#define | _MAX_EXT _MAX_FNAME |
#define | _MAX_PATH 260 |
#define | W_VER_NT 0 |
#define | for if (0) {} else for |
#define | COUNTOF(x) (sizeof(x)/sizeof(x[0])) |
#define | BUFFER_LEN 2048 |
#define | LOG(txt) _log_(txt) |
#define | LONGLONGARG TEXT("L") |
#define | _tcsrchr strrchr |
#define | _stprintf sprintf |
#define | U2A(s, d, l) WideCharToMultiByte(CP_ACP, 0, s, -1, d, l, NULL, NULL) |
#define | U2nA(s, d, l) WideCharToMultiByte(CP_ACP, 0, s, l, d, l, NULL, NULL) |
#define | A2U(s, d, l) MultiByteToWideChar(CP_ACP, 0, s, -1, d, l) |
#define | A2nU(s, d, l) MultiByteToWideChar(CP_ACP, 0, s, l, d, l) |
#define | FILE_ATTRIBUTE_ENCRYPTED 0x00000040 |
#define | FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 |
#define | FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 |
#define | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 |
#define | SetDlgCtrlID(hwnd, id) SetWindowLong(hwnd, GWL_ID, id) |
#define | SetWindowStyle(hwnd, val) (DWORD)SetWindowLong(hwnd, GWL_STYLE, val) |
#define | SetWindowExStyle(h, val) (DWORD)SetWindowLong(hwnd, GWL_EXSTYLE, val) |
#define | Window_SetIcon(hwnd, type, hicon) (HICON)SendMessage(hwnd, WM_SETICON, type, (LPARAM)(hicon)) |
#define | strcpy_s(d, l, s) strcpy(d, s) |
#define | _tcscpy_s(d, l, s) _tcscpy(d, s) |
#define | wcsncpy_s(d, l, s, n) wcsncpy(d, s, n) |
#define | _stprintf_s1(b, l, f, p1) _stprintf(b, f, p1) |
#define | _stprintf_s2(b, l, f, p1, p2) _stprintf(b, f, p1,p2) |
#define | _tsplitpath_s(f, d, dl, p, pl, n, nl, e, el) _tsplitpath(f, d, p, n, e) |
#define | launch_fileA launch_file |
#define | _STRING_DEFINED |
#define | ANS(x) ((LPCSTR)(x)) |
#define | CONTEXT_OBJ __ctx__._obj |
#define | CONTEXT(c) Context __ctx__(c) |
#define | CURRENT_CONTEXT Context::current() |
#define | OBJ_CONTEXT(c, o) Context __ctx__(c, o) |
Functions | |
void | _log_ (LPCTSTR txt) |
void | CenterWindow (HWND hwnd) |
void | MoveVisible (HWND hwnd) |
void | display_error (HWND hwnd, DWORD error) |
BOOL | time_to_filetime (const time_t *t, FILETIME *ftime) |
int | find_window_class (LPCTSTR classname) |
BOOL | RecursiveCreateDirectory (LPCTSTR path_in) |
DWORD | RegGetDWORDValue (HKEY root, LPCTSTR path, LPCTSTR valueName, DWORD def) |
BOOL | RegSetDWORDValue (HKEY root, LPCTSTR path, LPCTSTR valueName, DWORD value) |
BOOL | exists_path (LPCTSTR path) |
BOOL | launch_file (HWND hwnd, LPCTSTR cmd, UINT nCmdShow=SW_SHOWNORMAL, LPCTSTR parameters=NULL) |
BOOL | RunDLL (HWND hwnd, LPCTSTR dllname, LPCSTR procname, LPCTSTR cmdline, UINT nCmdShow) |
BOOL | launch_cpanel (HWND hwnd, LPCTSTR applet) |
void | ClientToScreen (HWND hwnd, RECT *prect) |
transform coordinates in a RECT from client to screen coordiantes | |
void | ScreenToClient (HWND hwnd, RECT *prect) |
transform coordinates in a RECT from screen to client coordiantes | |
String | get_windows_version_str () |
bool | SplitFileSysURL (LPCTSTR url, String &dir_out, String &fname_out) |
#define _MAX_DIR _MAX_FNAME |
Definition at line 70 of file utility.h.
Referenced by SplitFileSysURL().
#define _MAX_DRIVE 3 |
Definition at line 68 of file utility.h.
Referenced by MDIMainFrame::activate_drive_window(), MDIMainFrame::Command(), FileChildWindow::FileChildWindow(), and SplitFileSysURL().
#define _MAX_EXT _MAX_FNAME |
Definition at line 71 of file utility.h.
Referenced by StartMenu::AddShellEntries(), BookmarkList::import_IE_favorites(), FileTypeManager::is_exe_file(), and SplitFileSysURL().
#define _MAX_FNAME 256 |
Definition at line 69 of file utility.h.
Referenced by StartMenu::AddShellEntries(), FileChildWindow::FileChildWindow(), ShellDirectory::read_directory(), ScanNTFSStreams(), and SplitFileSysURL().
#define _MAX_PATH 260 |
Definition at line 72 of file utility.h.
Referenced by ShellDirectory::read_directory(), NtObjDirectory::read_directory(), and SplitFileSysURL().
#define _stprintf sprintf |
Definition at line 119 of file utility.h.
Referenced by QuickLaunchBar::AddShortcuts(), Pane::draw_item(), RegDirectory::read_directory(), and SplitFileSysURL().
#define _stprintf_s2 | ( | b, | |
l, | |||
f, | |||
p1, | |||
p2 | |||
) | _stprintf(b, f, p1,p2) |
Definition at line 198 of file utility.h.
Referenced by COMException::toString().
#define _tcscpy_s | ( | d, | |
l, | |||
s | |||
) | _tcscpy(d, s) |
Definition at line 195 of file utility.h.
Referenced by RegDirectory::read_directory(), and FATDirectory::read_directory().
#define _tcsrchr strrchr |
Definition at line 111 of file utility.h.
Referenced by FileTypeManager::set_type().
#define _tsplitpath_s | ( | f, | |
d, | |||
dl, | |||
p, | |||
pl, | |||
n, | |||
nl, | |||
e, | |||
el | |||
) | _tsplitpath(f, d, p, n, e) |
Definition at line 199 of file utility.h.
Referenced by MDIMainFrame::activate_drive_window(), StartMenu::AddShellEntries(), MDIMainFrame::Command(), FileChildWindow::FileChildWindow(), BookmarkList::import_IE_favorites(), and SplitFileSysURL().
#define A2nU | ( | s, | |
d, | |||
l | |||
) | MultiByteToWideChar(CP_ACP, 0, s, l, d, l) |
#define A2U | ( | s, | |
d, | |||
l | |||
) | MultiByteToWideChar(CP_ACP, 0, s, -1, d, l) |
#define ANS | ( | x ) | ((LPCSTR)(x)) |
Definition at line 933 of file utility.h.
Referenced by Context::getStackTrace(), and XMLStorage::XMLDoc::read_file().
#define BUFFER_LEN 2048 |
Definition at line 92 of file utility.h.
Referenced by String::appendf(), String::assign(), BStr::BStr(), MDIMainFrame::Command(), MainFrameBase::Command(), DecodeURLString(), Pane::draw_item(), FlatButton::DrawItem(), PictureButton::DrawItem(), XMLStorage::EncodeXMLString(), TaskBar::EnumWndProc(), MainFrameBase::ExecuteCommandbar(), HyperlinkCtrl::init(), MDIMainFrame::MDIMainFrame(), String::operator wstring(), String::printf(), Bookmark::read_url(), XMLStorage::ReadBuffer::ReadBuffer(), ResString::ResString(), COMException::toString(), String::vappendf(), and String::vprintf().
#define CONTEXT | ( | c ) | Context __ctx__(c) |
Definition at line 1076 of file utility.h.
Referenced by _tWinMain(), QuickLaunchBar::AddShortcuts(), ShellFolder::attach(), QuickLaunchBar::Command(), MDIMainFrame::Command(), MainFrameBase::Command(), QuickLaunchBar::Create(), FileChildWindow::create(), WinEntry::create_absolute_pidl(), ShellEntry::create_absolute_pidl(), ShellPath::create_absolute_pidl(), FATEntry::create_absolute_pidl(), MainFrameBase::ExecuteCommandbar(), explorer_main(), FileChildWindow::FileChildWindow(), ShellDirectory::fill_w32fdata_shell(), ShellPath::get_folder(), ShellFolder::get_name(), ShellDirectory::get_path(), ShellPath::GetUIObjectOf(), CommonDesktop::init(), MDIShellBrowserChild::Init(), ShellBrowser::Init(), ShellBrowser::InitDragDrop(), DesktopShellView::InitDragDrop(), ShellBrowser::InitializeTree(), ShellBrowser::InsertSubitems(), ShellEntry::launch_entry(), launch_file(), name_from_pidl(), ShellBrowser::OnDefaultCommand(), ShellBrowser::OnTreeGetDispInfo(), ShellBrowser::OnTreeItemExpanding(), ShellBrowser::OnTreeItemRClick(), ShellBrowser::OnTreeItemSelected(), path_from_pidlA(), path_from_pidlW(), QuickLaunchBar::QuickLaunchBar(), WinDirectory::read_directory(), ShellDirectory::read_directory(), RegDirectory::read_directory(), NtObjDirectory::read_directory(), FATDirectory::read_directory(), Entry::read_directory_base(), Entry::read_tree(), FileChildWindow::scan_entry(), ShellBrowser::select_entry(), ShellBrowser::select_folder(), FileChildWindow::set_curdir(), ShellDirectory::ShellDirectory(), ShellFolder::ShellFolder(), ShellItemEnumerator::ShellItemEnumerator(), ShellPath::ShellPath(), Entry::smart_scan(), ShellBrowser::UpdateFolderView(), MDIShellBrowserChild::WndProc(), SDIMainFrame::WndProc(), MDIMainFrame::WndProc(), and FileChildWindow::WndProc().
#define COUNTOF | ( | x ) | (sizeof(x)/sizeof(x[0])) |
Definition at line 88 of file utility.h.
Referenced by _tWinMain(), MDIMainFrame::activate_drive_window(), StartMenu::ActivateEntry(), StartMenu::AddShellEntries(), String::appendf(), FindProgramDlg::collect_programs_callback(), MDIMainFrame::Command(), WinEntry::create_absolute_pidl(), MDIShellBrowserChild::entry_selected(), SDIMainFrame::entry_selected(), Entry::extract_icon(), FileChildWindow::FileChildWindow(), ShellFolder::get_name(), Entry::get_path_base(), Entry::GetUIObjectOf(), BookmarkList::import_IE_favorites(), Entry::launch_entry(), NotifyInfo::modify(), NotifyHook::ModulePathCopyData(), String::printf(), ShellDirectory::read_directory(), NtObjDirectory::read_directory(), FATDirectory::read_directory(), FindProgramDlg::Refresh(), TrayIcon::Set(), FileChildWindow::set_curdir(), ShellPath::ShellPath(), SplitFileSysURL(), String::vappendf(), String::vprintf(), FileChildWindow::WndProc(), and ExecuteDialog::WndProc().
#define CURRENT_CONTEXT Context::current() |
Definition at line 1077 of file utility.h.
Referenced by COMException::COMException().
#define FILE_ATTRIBUTE_ENCRYPTED 0x00000040 |
Definition at line 140 of file utility.h.
Referenced by Pane::draw_item().
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 |
Definition at line 143 of file utility.h.
Referenced by Pane::draw_item().
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 |
Definition at line 142 of file utility.h.
Referenced by Pane::draw_item().
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 |
Definition at line 141 of file utility.h.
Referenced by Pane::draw_item().
#define LOG | ( | txt ) | _log_(txt) |
Definition at line 97 of file utility.h.
Referenced by _tWinMain(), COMException::COMException(), display_error(), TaskBar::Init(), MainFrameBase::OpenShellFolders(), RecursiveCreateDirectory(), SDIMainFrame::WndProc(), and MDIMainFrame::WndProc().
#define LONGLONGARG TEXT("L") |
Definition at line 103 of file utility.h.
Referenced by Pane::draw_item().
#define OBJ_CONTEXT | ( | c, | |
o | |||
) | Context __ctx__(c, o) |
Definition at line 1078 of file utility.h.
Referenced by ShellPath::ShellPath(), and MDIMainFrame::WndProc().
#define SetDlgCtrlID | ( | hwnd, | |
id | |||
) | SetWindowLong(hwnd, GWL_ID, id) |
#define SetWindowExStyle | ( | h, | |
val | |||
) | (DWORD)SetWindowLong(hwnd, GWL_EXSTYLE, val) |
#define SetWindowStyle | ( | hwnd, | |
val | |||
) | (DWORD)SetWindowLong(hwnd, GWL_STYLE, val) |
Definition at line 148 of file utility.h.
Referenced by DesktopShellView::DesktopShellView(), and QuickLaunchBar::QuickLaunchBar().
#define strcpy_s | ( | d, | |
l, | |||
s | |||
) | strcpy(d, s) |
Definition at line 194 of file utility.h.
Referenced by handle_exception().
#define U2A | ( | s, | |
d, | |||
l | |||
) | WideCharToMultiByte(CP_ACP, 0, s, -1, d, l, NULL, NULL) |
#define U2nA | ( | s, | |
d, | |||
l | |||
) | WideCharToMultiByte(CP_ACP, 0, s, l, d, l, NULL, NULL) |
Definition at line 124 of file utility.h.
Referenced by NtObjDirectory::read_directory().
#define W_VER_NT 0 |
Definition at line 75 of file utility.h.
Referenced by MDIMainFrame::MDIMainFrame().
#define wcsncpy_s | ( | d, | |
l, | |||
s, | |||
n | |||
) | wcsncpy(d, s, n) |
Definition at line 196 of file utility.h.
Referenced by NtObjDirectory::read_directory().
#define Window_SetIcon | ( | hwnd, | |
type, | |||
hicon | |||
) | (HICON)SendMessage(hwnd, WM_SETICON, type, (LPARAM)(hicon)) |
Definition at line 150 of file utility.h.
Referenced by SetWindowIcon().
void _log_ | ( | LPCTSTR | txt ) |
Definition at line 143 of file explorer.cpp.
References ExplorerGlobals::_log, and TEXT.
void CenterWindow | ( | HWND | hwnd ) |
Definition at line 49 of file utility.cpp.
References HWND, and MoveVisible().
Referenced by ExplorerAboutDlg::ExplorerAboutDlg(), FindProgramDlg::FindProgramDlg(), and MdiSdiDlg::MdiSdiDlg().
{ RECT rt, prt; GetWindowRect(hwnd, &rt); DWORD style; HWND owner = 0; for(HWND wh=hwnd; (wh=GetWindow(wh,GW_OWNER))!=0; ) if (((style=GetWindowStyle(wh))&WS_VISIBLE) && !(style&WS_MINIMIZE)) {owner=wh; break;} if (owner) GetWindowRect(owner, &prt); else SystemParametersInfo(SPI_GETWORKAREA, 0, &prt, 0); //@@ GetDesktopWindow() wäre auch hilfreich. SetWindowPos(hwnd, 0, (prt.left+prt.right+rt.left-rt.right)/2, (prt.top+prt.bottom+rt.top-rt.bottom)/2, 0,0, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER); MoveVisible(hwnd); }
void ClientToScreen | ( | HWND | hwnd, |
RECT * | prect | ||
) | [inline] |
transform coordinates in a RECT from client to screen coordiantes
Definition at line 454 of file utility.h.
Referenced by StartMenu::CreateSubmenu(), MainFrameBase::fullscreen_move(), ShellBrowser::OnTreeItemRClick(), MainFrameBase::toggle_fullscreen(), PopupMenu::TrackPopupMenu(), and StartButton::WndProc().
{::ClientToScreen(hwnd,(LPPOINT)&prect->left); ::ClientToScreen(hwnd,(LPPOINT)&prect->right);}
void display_error | ( | HWND | hwnd, |
DWORD | error | ||
) |
Definition at line 98 of file utility.cpp.
Referenced by StartMenu::ActivateEntry(), MDIMainFrame::Command(), MainFrameBase::Command(), MainFrameBase::ExecuteCommandbar(), ShellEntry::launch_entry(), and launch_file().
{ PTSTR msg; if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, 0, error, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (PTSTR)&msg, 0, NULL)) { LOG(FmtString(TEXT("display_error(%#x): %s"), error, msg)); SetLastError(0); MessageBox(hwnd, msg, TEXT("ROS Explorer"), MB_OK); if (GetLastError() == ERROR_INVALID_WINDOW_HANDLE) MessageBox(0, msg, TEXT("ROS Explorer"), MB_OK); } else { LOG(FmtString(TEXT("Unknown Error %#x"), error)); FmtString msg(TEXT("Unknown Error %#x"), error); SetLastError(0); MessageBox(hwnd, msg, TEXT("ROS Explorer"), MB_OK); if (GetLastError() == ERROR_INVALID_WINDOW_HANDLE) MessageBox(0, msg, TEXT("ROS Explorer"), MB_OK); } LocalFree(msg); }
BOOL exists_path | ( | LPCTSTR | path ) |
Definition at line 489 of file utility.cpp.
Referenced by SplitFileSysURL().
{ WIN32_FIND_DATA fd; HANDLE hfind = FindFirstFile(path, &fd); if (hfind != INVALID_HANDLE_VALUE) { FindClose(hfind); return TRUE; } else return FALSE; }
int find_window_class | ( | LPCTSTR | classname ) |
Definition at line 237 of file utility.cpp.
{ EnumWindows(EnumWndProc, (LPARAM)classname); if (g_foundPrevInstance) return 1; return 0; }
String get_windows_version_str | ( | ) |
Definition at line 248 of file utility.cpp.
References _tcsicmp, String::printf(), and TEXT.
Referenced by ExplorerAboutDlg::ExplorerAboutDlg().
{ OSVERSIONINFOEX osvi = {sizeof(OSVERSIONINFOEX)}; BOOL osvie_val; String str; if (!(osvie_val = GetVersionEx((OSVERSIONINFO*)&osvi))) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx((OSVERSIONINFO*)&osvi)) return TEXT("???"); } switch(osvi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: #ifdef __REACTOS__ // This work around can be removed if ReactOS gets a unique version number. str = TEXT("ReactOS"); #else if (osvi.dwMajorVersion <= 4) str = TEXT("Microsoft Windows NT"); else if (osvi.dwMajorVersion==5 && osvi.dwMinorVersion==0) str = TEXT("Microsoft Windows 2000"); else if (osvi.dwMajorVersion==5 && osvi.dwMinorVersion==1) str = TEXT("Microsoft Windows XP"); #endif if (osvie_val) { if (osvi.wProductType == VER_NT_WORKSTATION) { if (osvi.wSuiteMask & VER_SUITE_PERSONAL) str += TEXT(" Personal"); else str += TEXT(" Professional"); } else if (osvi.wProductType == VER_NT_SERVER) { if (osvi.wSuiteMask & VER_SUITE_DATACENTER) str += TEXT(" DataCenter Server"); else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) str += TEXT(" Advanced Server"); else str += TEXT(" Server"); } else if (osvi.wProductType == VER_NT_DOMAIN_CONTROLLER) { str += TEXT(" Domain Controller"); } } else { TCHAR type[80]; DWORD dwBufLen; HKEY hkey; if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"), 0, KEY_QUERY_VALUE, &hkey)) { RegQueryValueEx(hkey, TEXT("ProductType"), NULL, NULL, (LPBYTE)type, &dwBufLen); RegCloseKey(hkey); if (!_tcsicmp(TEXT("WINNT"), type)) str += TEXT(" Workstation"); else if (!_tcsicmp(TEXT("LANMANNT"), type)) str += TEXT(" Server"); else if (!_tcsicmp(TEXT("SERVERNT"), type)) str += TEXT(" Advanced Server"); } } break; case VER_PLATFORM_WIN32_WINDOWS: if (osvi.dwMajorVersion>4 || (osvi.dwMajorVersion==4 && osvi.dwMinorVersion>0)) { if (osvi.dwMinorVersion == 90) str = TEXT("Microsoft Windows ME"); else str = TEXT("Microsoft Windows 98"); if (osvi.szCSDVersion[1] == 'A') str += TEXT(" SE"); } else { str = TEXT("Microsoft Windows 95"); if (osvi.szCSDVersion[1]=='B' || osvi.szCSDVersion[1]=='C') str += TEXT(" OSR2"); } break; case VER_PLATFORM_WIN32s: str = TEXT("Microsoft Win32s"); default: return TEXT("???"); } String vstr; if (osvi.dwMajorVersion <= 4) vstr.printf(TEXT(" Version %d.%d %s Build %d"), osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.szCSDVersion, osvi.dwBuildNumber&0xFFFF); else vstr.printf(TEXT(" %s (Build %d)"), osvi.szCSDVersion, osvi.dwBuildNumber&0xFFFF); return str + vstr; }
Definition at line 383 of file utility.cpp.
References TEXT.
Referenced by NotifyArea::Command(), DesktopBar::Command(), and ClockWindow::WndProc().
{ TCHAR parameters[MAX_PATH]; _tcscpy(parameters, TEXT("shell32.dll,Control_RunDLL ")); _tcscat(parameters, applet); return ((int)ShellExecute(hwnd, TEXT("open"), TEXT("rundll32.exe"), parameters, NULL, SW_SHOWDEFAULT) > 32); }
BOOL launch_file | ( | HWND | hwnd, |
LPCTSTR | cmd, | ||
UINT | nCmdShow = SW_SHOWNORMAL , |
||
LPCTSTR | parameters = NULL |
||
) |
Definition at line 189 of file utility.cpp.
References CONTEXT, and display_error().
Referenced by FavoritesMenu::Command(), StartMenuHandler::Command(), MainFrameBase::Command(), DesktopBar::Command(), Entry::launch_entry(), and DesktopBar::WndProc().
{ CONTEXT("launch_file()"); HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, cmd, parameters, NULL/*dir*/, nCmdShow); if ((int)hinst <= 32) { display_error(hwnd, GetLastError()); return FALSE; } return TRUE; }
void MoveVisible | ( | HWND | hwnd ) |
Definition at line 72 of file utility.cpp.
Referenced by CenterWindow(), StartMenu::Create(), and ResizeManager::Resize().
{ RECT rc; GetWindowRect(hwnd, &rc); int left=rc.left, top=rc.top; int xmax = GetSystemMetrics(SM_CXSCREEN); int ymax = GetSystemMetrics(SM_CYSCREEN); if (rc.left < 0) rc.left = 0; else if (rc.right > xmax) if ((rc.left-=rc.right-xmax) < 0) rc.left = 0; if (rc.top < 0) rc.top = 0; else if (rc.bottom > ymax) if ((rc.top-=rc.bottom-ymax) < 0) rc.top = 0; if (rc.left!=left || rc.top!=top) SetWindowPos(hwnd, 0, rc.left,rc.top, 0,0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE); }
BOOL RecursiveCreateDirectory | ( | LPCTSTR | path_in ) |
Definition at line 394 of file utility.cpp.
References _tcslen, LOG, and TEXT.
Referenced by QuickLaunchBar::AddShortcuts(), and ExplorerGlobals::write_persistent().
{ TCHAR path[MAX_PATH], hole_path[MAX_PATH]; _tcscpy(hole_path, path_in); int drv_len = 0; LPCTSTR d; for(d=hole_path; *d && *d!='/' && *d!='\\'; ++d) { ++drv_len; if (*d == ':') break; } LPTSTR dir = hole_path + drv_len; int l; LPTSTR p = hole_path + (l=_tcslen(hole_path)); while(--p>=hole_path && (*p=='/' || *p=='\\')) *p = '\0'; WIN32_FIND_DATA w32fd; HANDLE hFind = FindFirstFile(hole_path, &w32fd); if (hFind == INVALID_HANDLE_VALUE) { _tcsncpy(path, hole_path, drv_len); int i = drv_len; for(p=dir; *p=='/'||*p=='\\'; p++) path[i++] = *p++; for(; i<l; i++) { memcpy(path, hole_path, i*sizeof(TCHAR)); for(; hole_path[i] && hole_path[i]!='/' && hole_path[i]!='\\'; i++) path[i] = hole_path[i]; path[i] = '\0'; hFind = FindFirstFile(path, &w32fd); if (hFind != INVALID_HANDLE_VALUE) FindClose(hFind); else { LOG(FmtString(TEXT("CreateDirectory(\"%s\")"), path)); if (!CreateDirectory(path, 0)) return FALSE; } } } else FindClose(hFind); return TRUE; }
Definition at line 455 of file utility.cpp.
Referenced by BackgroundWindow::BackgroundWindow().
{ HKEY hkey; DWORD ret; if (!RegOpenKey(root, path, &hkey)) { DWORD len = sizeof(ret); if (RegQueryValueEx(hkey, valueName, 0, NULL, (LPBYTE)&ret, &len)) ret = def; RegCloseKey(hkey); return ret; } else return def; }
Definition at line 474 of file utility.cpp.
Referenced by BackgroundWindow::WndProc().
{ HKEY hkey; BOOL ret = FALSE; if (!RegOpenKey(root, path, &hkey)) { ret = RegSetValueEx(hkey, valueName, 0, REG_DWORD, (LPBYTE)&value, sizeof(value)); RegCloseKey(hkey); } return ret; }
Definition at line 349 of file utility.cpp.
{ HMODULE hmod = LoadLibrary(dllname); if (!hmod) return FALSE; /*TODO <Windows NT/2000> It is possible to create a Unicode version of the function. Rundll32 first tries to find a function named EntryPointW. If it cannot find this function, it tries EntryPointA, then EntryPoint. To create a DLL that supports ANSI on Windows 95/98/Me and Unicode otherwise, export two functions: EntryPointW and EntryPoint. */ RUNDLLPROC proc = (RUNDLLPROC)GetProcAddress(hmod, procname); if (!proc) { FreeLibrary(hmod); return FALSE; } proc(hwnd, hmod, cmdline, nCmdShow); FreeLibrary(hmod); return TRUE; }
void ScreenToClient | ( | HWND | hwnd, |
RECT * | prect | ||
) | [inline] |
transform coordinates in a RECT from screen to client coordiantes
Definition at line 458 of file utility.h.
Referenced by TreeDropTarget::DragOver(), DesktopDropTarget::DragOver(), StartMenu::GetButtonRect(), ResizeManager::HandleSize(), NotifyArea::Notify(), TaskBar::Notify(), ShellBrowser::OnTreeItemRClick(), ChildWindow::WndProc(), NotifyArea::WndProc(), TaskBar::WndProc(), StartMenu::WndProc(), QuickLaunchBar::WndProc(), SDIMainFrame::WndProc(), FileChildWindow::WndProc(), and StartButton::WndProc().
{::ScreenToClient(hwnd,(LPPOINT)&prect->left); ::ScreenToClient(hwnd,(LPPOINT)&prect->right);}
Definition at line 504 of file utility.cpp.
References _MAX_DIR, _MAX_DRIVE, _MAX_EXT, _MAX_FNAME, _MAX_PATH, _stprintf, _tcsnicmp, _tsplitpath_s, COUNTOF, exists_path(), String::printf(), and TEXT.
Referenced by MDIShellBrowserChild::jump_to_int(), and FileChildWindow::jump_to_int().
{ if (!_tcsnicmp(url, TEXT("file://"), 7)) { url += 7; // remove third slash in front of drive characters if (*url == '/') ++url; } if (exists_path(url)) { TCHAR path[_MAX_PATH]; // convert slashes to back slashes GetFullPathName(url, COUNTOF(path), path, NULL); if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) fname_out.erase(); else { TCHAR drv[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; _tsplitpath_s(path, drv, COUNTOF(drv), dir, COUNTOF(dir), fname, COUNTOF(fname), ext, COUNTOF(ext)); _stprintf(path, TEXT("%s%s"), drv, dir); fname_out.printf(TEXT("%s%s"), fname, ext); } dir_out = path; return true; } else return false; }
BOOL time_to_filetime | ( | const time_t * | t, |
FILETIME * | ftime | ||
) |
Definition at line 159 of file utility.cpp.
{ #ifdef __STDC_WANT_SECURE_LIB__ SYSTEMTIME stime; struct tm tm_; struct tm* tm = &tm_; if (gmtime_s(tm, t) != 0) return FALSE; #else struct tm* tm = gmtime(t); SYSTEMTIME stime; if (!tm) return FALSE; #endif stime.wYear = tm->tm_year+1900; stime.wMonth = tm->tm_mon+1; stime.wDayOfWeek = (WORD)-1; stime.wDay = tm->tm_mday; stime.wHour = tm->tm_hour; stime.wMinute = tm->tm_min; stime.wSecond = tm->tm_sec; stime.wMilliseconds = 0; return SystemTimeToFileTime(&stime, ftime); }
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |