本文整理汇总了C++中win::dow::Handle::ToNative方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::ToNative方法的具体用法?C++ Handle::ToNative怎么用?C++ Handle::ToNative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类win::dow::Handle
的用法示例。
在下文中一共展示了Handle::ToNative方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
OveralyWindow::OveralyWindow (Win::Dow::Handle hwndTool, Win::Dow::Handle toolTipHandlerWin)
{
memset (this, 0, sizeof (TOOLINFO));
cbSize = sizeof (TOOLINFO);
uFlags = TTF_IDISHWND | TTF_SUBCLASS; // Tool id is a window handle.
// Subclass tool window to intercept mouse moves
uId = reinterpret_cast<UINT_PTR>(hwndTool.ToNative ()); // Window added to the tool bar
hwnd = toolTipHandlerWin.ToNative (); // Window that receives tool tip notifications
lpszText = LPSTR_TEXTCALLBACK; // Send TTN_NEEDTEXT message to the handler window
}
示例2: DeleteFiles
// Revisit: File list should be something else than char const * -- too confusing
// SHFileOperation requires that the file list is ended with double '\0'
// File list can contain multiple file paths separated by '\0'
bool DeleteFiles (Win::Dow::Handle win,
char const * fileList,
FILEOP_FLAGS flags,
char const * title,
bool quiet)
{
SHFILEOPSTRUCT fileInfo;
memset (&fileInfo, 0, sizeof (fileInfo));
fileInfo.hwnd = win.ToNative ();
fileInfo.wFunc = FO_DELETE;
fileInfo.pFrom = fileList;
fileInfo.fFlags = flags;
fileInfo.lpszProgressTitle = title;
int result = ::SHFileOperation (&fileInfo);
if (quiet)
{
Win::ClearError (); // Clear any error code set by the shell
return (result == 0) && !fileInfo.fAnyOperationsAborted;
}
else
{
if (fileInfo.fAnyOperationsAborted)
throw Win::Exception ();
if (result != 0)
{
if ((flags & FOF_NOERRORUI) != 0) // Throw exception only if Shell was asked not to display error information
throw Win::Exception ("Internal error: Cannot delete files");
else
return false;
}
}
Win::ClearError (); // Clear any error code set by the shell
return true;
}
示例3: FileMove
void FileMove (Win::Dow::Handle win,
char const * oldPath,
char const * newPath,
FILEOP_FLAGS flags)
{
char srcPath [MAX_PATH + 2];
char tgtPath [MAX_PATH + 2];
memset (srcPath, 0, sizeof (srcPath));
memset (tgtPath, 0, sizeof (tgtPath));
strcpy (srcPath, oldPath);
strcpy (tgtPath, newPath);
SHFILEOPSTRUCT fileInfo;
memset (&fileInfo, 0, sizeof (fileInfo));
fileInfo.hwnd = win.ToNative ();
fileInfo.wFunc = FO_MOVE;
fileInfo.pFrom = srcPath;
fileInfo.pTo = tgtPath;
fileInfo.fFlags = flags;
if (::SHFileOperation (&fileInfo))
{
if (fileInfo.fAnyOperationsAborted)
throw Win::Exception ();
else
throw Win::Exception ("Internal error: Cannot move file", oldPath);
}
if (fileInfo.fAnyOperationsAborted)
throw Win::Exception ();
Win::ClearError (); // Clear any error code set by the shell
}
示例4: CopyContents
void CopyContents (Win::Dow::Handle win,
char const * fromPath,
char const * toPath,
FILEOP_FLAGS flags)
{
FilePath fromFolderContent (fromPath);
// SHFileOperation requires that the from path is ended with double '\0'
// WARNING: paths cannot be allocated on the heap -- SHFileOperation will fail
char srcPath [MAX_PATH + 2];
char tgtPath [MAX_PATH + 2];
memset (srcPath, 0, sizeof (srcPath));
memset (tgtPath, 0, sizeof (tgtPath));
strcpy (srcPath, fromFolderContent.GetAllFilesPath ());
strcpy (tgtPath, toPath);
SHFILEOPSTRUCT fileInfo;
memset (&fileInfo, 0, sizeof (fileInfo));
fileInfo.hwnd = win.ToNative ();
fileInfo.wFunc = FO_COPY;
fileInfo.pFrom = srcPath;
fileInfo.pTo = tgtPath;
fileInfo.fFlags = flags;
if (::SHFileOperation (&fileInfo))
{
if (fileInfo.fAnyOperationsAborted)
throw Win::Exception ();
else
throw Win::Exception ("Internal error: Cannot copy folder contents", fromPath);
}
if (fileInfo.fAnyOperationsAborted)
throw Win::Exception ();
Win::ClearError (); // Clear any error code set by the shell
}
示例5: CopyFiles
// Revisit: File list should be something else than char const * -- too confusing
// SHFileOperation requires that the file list is ended with double '\0'
// File list and toPath can contain multiple file paths separated by '\0'
void CopyFiles (Win::Dow::Handle win,
char const * fileList,
char const * toPath,
FILEOP_FLAGS flags,
char const * title)
{
SHFILEOPSTRUCT fileInfo;
memset (&fileInfo, 0, sizeof (fileInfo));
fileInfo.hwnd = win.ToNative ();
fileInfo.wFunc = FO_COPY;
fileInfo.pFrom = fileList;
fileInfo.pTo = toPath;
fileInfo.fFlags = flags;
fileInfo.lpszProgressTitle = title;
if (::SHFileOperation (&fileInfo))
{
if (fileInfo.fAnyOperationsAborted)
throw Win::Exception ();
else
throw Win::Exception ("Internal error: Cannot copy files to:", toPath);
}
if (fileInfo.fAnyOperationsAborted)
throw Win::Exception ();
Win::ClearError (); // Clear any error code set by the shell
}
示例6: Delete
void Delete (Win::Dow::Handle win, char const * path, FILEOP_FLAGS flags)
{
if (!File::Exists (path))
return;
// SHFileOperation requires that the from path is ended with double '\0'
// WARNING: path cannot be allocated on the heap -- SHFileOperation will fail
char fromPath [MAX_PATH + 2];
memset (fromPath, 0, sizeof (fromPath));
SHFILEOPSTRUCT fileInfo;
memset (&fileInfo, 0, sizeof (fileInfo));
fileInfo.hwnd = win.ToNative ();
fileInfo.wFunc = FO_DELETE;
fileInfo.pFrom = fromPath;
fileInfo.fFlags = flags;
strcpy (fromPath, path);
if (::SHFileOperation (&fileInfo))
{
if (fileInfo.fAnyOperationsAborted)
throw Win::Exception ();
else
throw Win::Exception ("Internal error: Cannot delete file or folder.", fromPath);
}
if (fileInfo.fAnyOperationsAborted)
throw Win::Exception ();
Win::ClearError (); // Clear any error code set by the shell
}
示例7: Properties
bool Properties (Win::Dow::Handle win, char const * path, char const * page)
{
std::wstring wPath = ToWString (path);
std::wstring wPage = ToWString (page);
BOOL result = ::SHObjectProperties (win.ToNative (),
SHOP_FILEPATH,
&wPath [0],
&wPage [0]);
return result != FALSE;
}
示例8: PumpPeek
// Peek at the queue and process only messages
// to the specified window. Don't translate accellerators
void MessagePrepro::PumpPeek (Win::Dow::Handle hwnd)
{
MSG msg;
int status;
while ((status = ::PeekMessage (&msg, hwnd.ToNative (), 0, 0, PM_REMOVE )) != 0)
{
if (status == -1)
throw Win::Exception ("Error in the Windows peek message loop");
::TranslateMessage (&msg);
::DispatchMessage (&msg);
}
}
示例9: Pump
int ModalMessagePrepro::Pump (Win::Dow::Handle hwnd)
{
MSG msg;
int status;
while ((status = ::GetMessage (&msg, hwnd.ToNative (), 0, 0 )) != 0)
{
if (status == -1)
throw Win::Exception ("Error in the Windows modal message loop");
if (msg.message == _breakMsg)
break;
switch (msg.message)
{
// Filter out the following messages:
// Mouse
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MOUSEACTIVATE:
// Revisit: WM_MOUSEHOVER not available in NT 4.0 even the docs says otherwise ?!?
//case WM_MOUSEHOVER:
case WM_MOUSEMOVE:
// Revisit: WM_MOUSEWHEEL not available in NT 4.0 even the docs says otherwise ?!?
//case WM_MOUSEWHEEL:
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
// Keyboard
case WM_CHAR:
case WM_CHARTOITEM:
case WM_DEADCHAR:
case WM_GETHOTKEY:
case WM_HOTKEY:
case WM_KEYDOWN:
case WM_KEYUP:
case WM_SETHOTKEY:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
case WM_SYSCHAR:
case WM_SYSDEADCHAR:
case WM_VKEYTOITEM:
break;
default:
// Dispatch all other messages
::TranslateMessage (&msg);
::DispatchMessage (&msg);
break;
}
}
return msg.wParam;
}
示例10: PumpHidden
int MessagePrepro::PumpHidden (Win::Dow::Handle hwnd)
{
MSG msg;
int status;
while ((status = ::GetMessage (&msg, hwnd.ToNative (), 0, 0 )) != 0)
{
if (status == -1)
throw Win::Exception ("Error in the Windows message loop");
if (msg.message == _breakMsg)
break;
::DispatchMessage (&msg);
}
return msg.wParam;
}
示例11: QuietDelete
// Doesn't throw when delete fails -- returns false instead
bool QuietDelete (Win::Dow::Handle win, char const * path)
{
// SHFileOperation requires that the from path is ended with double '\0'
// WARNING: path cannot be allocated on the heap -- SHFileOperation will fail
char fromPath [MAX_PATH + 2];
memset (fromPath, 0, sizeof (fromPath));
SHFILEOPSTRUCT fileInfo;
memset (&fileInfo, 0, sizeof (fileInfo));
fileInfo.hwnd = win.ToNative ();
fileInfo.wFunc = FO_DELETE;
fileInfo.pFrom = fromPath;
fileInfo.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
strcpy (fromPath, path);
int result = ::SHFileOperation (&fileInfo);
Win::ClearError (); // Clear any error code set by the shell
return (result == 0) && !fileInfo.fAnyOperationsAborted;
}
示例12: initData
FolderBrowser::FolderBrowser (Win::Dow::Handle winOwner,
Ptr<ITEMIDLIST> & pidlRoot,
char const * userInstructions,
char const * dlgWinCaption,
char const * startupFolder)
{
std::pair<char const *, char const *> initData (dlgWinCaption, startupFolder);
_displayName [0] = '\0';
_fullPath [0] = '\0';
_browseInfo.hwndOwner = winOwner.ToNative ();
_browseInfo.pidlRoot = pidlRoot;
_browseInfo.pszDisplayName = _displayName;
_browseInfo.lpszTitle = userInstructions;
_browseInfo.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
_browseInfo.lpfn = ShellMan::FolderBrowser::BrowseCallbackProc;
_browseInfo.lParam = reinterpret_cast<LPARAM>(&initData);
_browseInfo.iImage = 0;
_p = SHBrowseForFolder (&_browseInfo);
if (_p != 0)
SHGetPathFromIDList (_p, _fullPath);
}
示例13: ShellAction
// returns ShellMan::Success if success
int ShellAction (Win::Dow::Handle win, char const * action, char const * path, char const * arguments = 0)
{
HINSTANCE hInst = ::ShellExecute (win.ToNative (), action, path, arguments, 0, SW_SHOWNORMAL);
return ErrCode (hInst);
}
示例14:
void Tool::Rebar::BandInfo::AddChildWin (Win::Dow::Handle win)
{
Assert (hwndChild == 0);
fMask |= RBBIM_CHILD;
hwndChild = win.ToNative ();
}