9 case ERROR_CHILD_NOT_COMPLETE:
10 p_out =
"Application cannot be run in Win32 mode.";
12 case ERROR_INVALID_ORDINAL:
13 p_out =
"Invalid ordinal.";
15 case ERROR_INVALID_STARTING_CODESEG:
16 p_out =
"Invalid code segment.";
18 case ERROR_INVALID_STACKSEG:
19 p_out =
"Invalid stack segment.";
21 case ERROR_INVALID_MODULETYPE:
22 p_out =
"Invalid module type.";
24 case ERROR_INVALID_EXE_SIGNATURE:
25 p_out =
"Invalid executable signature.";
27 case ERROR_BAD_EXE_FORMAT:
28 p_out =
"Not a valid Win32 application.";
30 case ERROR_EXE_MACHINE_TYPE_MISMATCH:
31 p_out =
"Machine type mismatch.";
33 case ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY:
34 case ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY:
35 p_out =
"Unable to modify a signed binary.";
40 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0,p_code,0,temp,_countof(temp),0) == 0)
return FALSE;
41 for(
t_size n=0;n<_countof(temp);n++) {
56 const char * prepend_header =
"\\\\?\\";
57 const char * prepend_header_net =
"\\\\?\\UNC\\";
61 out << prepend_header << p_path;
63 out << prepend_header_net << (p_path+2);
68 const char * prepend_header =
"\\\\?\\";
69 const char * prepend_header_net =
"\\\\?\\UNC\\";
75 out = (p_path + strlen(prepend_header));
83 if (p_code == 0)
m_buffer =
"Undefined error";
100 #ifdef PFC_WINDOWS_DESKTOP_APP 103 SetWindowLong(p_wnd,GWL_STYLE, GetWindowLong(p_wnd,GWL_STYLE) | p_style);
107 SetWindowLong(p_wnd,GWL_STYLE, GetWindowLong(p_wnd,GWL_STYLE) & ~p_style);
111 SetWindowLong(p_wnd,GWL_EXSTYLE, GetWindowLong(p_wnd,GWL_EXSTYLE) | p_style);
115 SetWindowLong(p_wnd,GWL_EXSTYLE, GetWindowLong(p_wnd,GWL_EXSTYLE) & ~p_style);
120 temp.left = 0; temp.right = p_value; temp.top = temp.bottom = 0;
121 if (!MapDialogRect(p_dialog,&temp))
return 0;
126 return (GetKeyState(vk) & 0x8000) ?
true :
false;
143 if (OpenClipboard(p_owner)) {
159 if (
m_ptr == NULL)
throw std::bad_alloc();
166 HWND walk = WindowFromPoint(pt);
168 if (walk == NULL)
return false;
169 if (walk == wnd)
return true;
170 if (GetWindowLong(walk,GWL_STYLE) & WS_POPUP)
return false;
171 walk = GetParent(walk);
177 while(walk != parent && walk != NULL && (GetWindowLong(walk,GWL_STYLE) & WS_CHILD) != 0) {
178 walk = GetParent(walk);
180 return walk == parent;
184 if (m_menu != NULL) {
192 SetLastError(NO_ERROR);
193 m_menu = CreatePopupMenu();
197 #endif // #ifdef PFC_WINDOWS_DESKTOP_APP 201 SetLastError(NO_ERROR);
202 m_handle =
CreateEvent(NULL,p_manualreset ? TRUE : FALSE, p_initialstate ? TRUE : FALSE,NULL);
208 if (temp != NULL) CloseHandle(temp);
216 if (time == 0) time = 1;
217 }
else if (p_seconds < 0) {
225 SetLastError(NO_ERROR);
231 throw pfc::exception_bug_check();
254 case WAIT_OBJECT_0 + 1:
263 #ifdef PFC_WINDOWS_DESKTOP_APP 266 HICON temp = detach();
267 if (temp != NULL) DestroyIcon(temp);
273 SetLastError(NO_ERROR);
274 m_accel = LoadAccelerators(p_inst,p_id);
275 if (m_accel == NULL) {
281 if (m_accel != NULL) {
282 DestroyAcceleratorTable(m_accel);
287 #endif // #ifdef PFC_WINDOWS_DESKTOP_APP 294 #ifdef PFC_WINDOWS_DESKTOP_APP 297 const DWORD ver = GetVersion();
298 return (WORD)HIBYTE(LOWORD(ver)) | ((WORD)LOBYTE(LOWORD(ver)) << 8);
328 #endif // #ifdef PFC_WINDOWS_DESKTOP_APP
DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAll, DWORD dwMilliseconds)
void uSleepSeconds(double p_time, bool p_alertable)
void uAddWindowStyle(HWND p_wnd, LONG p_style)
CGlobalLockScope(HGLOBAL p_handle)
BOOL winFormatSystemErrorMessage(pfc::string_base &p_out, DWORD p_code)
void load(HINSTANCE p_inst, const TCHAR *p_id)
void uRemoveWindowStyle(HWND p_wnd, LONG p_style)
unsigned MapDialogWidth(HWND p_dialog, unsigned p_value)
typedef BOOL(WINAPI *pPowerSetRequest_t)(__in HANDLE PowerRequest
HANDLE get_handle() const
bool IsKeyPressed(unsigned vk)
void winPrefixPath(pfc::string_base &out, const char *p_path)
typedef HANDLE(WINAPI *pPowerCreateRequest_t)(__in void *Context)
static int g_twoEventWait(win32_event &ev1, win32_event &ev2, double timeout)
string_utf8_from_wide string_utf8_from_os
DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
static bool g_wait_for(HANDLE p_event, double p_timeout_seconds)
Returns true when signaled, false on timeout.
void uAddWindowExStyle(HWND p_wnd, LONG p_style)
void winUnPrefixPath(pfc::string_base &out, const char *p_path)
string8_fastalloc string_formatter
t_int32 rint32(double p_val)
unsigned GetHotkeyModifierFlags()
Returns current modifier keys pressed, using win32 MOD_* flags.
HANDLE CreateEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCTSTR lpName)
WORD GetWindowsVersionCode()
static DWORD g_calculate_wait_time(double p_seconds)
bool IsPointInsideControl(const POINT &pt, HWND wnd)
bool IsWindowChildOf(HWND child, HWND parent)
void uRemoveWindowExStyle(HWND p_wnd, LONG p_style)
int strcmp_partial(const char *str, const char *substr)
void create(bool p_manualreset, bool p_initialstate)
void set_state(bool p_state)