本文整理汇总了C++中win::dow::Handle类的典型用法代码示例。如果您正苦于以下问题:C++ Handle类的具体用法?C++ Handle怎么用?C++ Handle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Handle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dlgWin
bool Progress::MultiCtrlHandler::OnInitDialog ()
{
Win::Dow::Handle dlgWin (GetWindow ());
_caption.Init (dlgWin, Progress::MultiMeterDialog::CaptionId);
_overallActivity.Init (dlgWin, Progress::MultiMeterDialog::OverallActivityId);
_overallBar.Init (dlgWin, Progress::MultiMeterDialog::OverallProgressBarId);
_specificActivity.Init (dlgWin, Progress::MultiMeterDialog::SpecificActivityId);
_specificBar.Init (dlgWin, Progress::MultiMeterDialog::SpecificProgressBarId);
_cancel.Init (dlgWin, Out::Cancel);
dlgWin.SetText (_dlgData.GetTitle ());
dlgWin.CenterOverOwner ();
if (!_overall.CanCancel ())
_cancel.Disable ();
_progressTimer.Attach (dlgWin);
unsigned int initialDelay = _dlgData.GetInitialDelay ();
if (initialDelay != 0)
{
// Wait initial delay milliseconds before showing progress meter
_progressTimer.Set (initialDelay);
}
else
{
_progressTimer.Set (Progress::CtrlHandler::Tick); // Progress tick is 0,5 second
Show ();
}
return true;
}
开发者ID:dbremner,项目名称:WinLib,代码行数:31,代码来源:MultiProgressDialog.cpp
示例2: Main
int Win::Main (Win::Instance hInst, char const * cmdParam, int cmdShow)
{
try
{
TheOutput.Init ("Unit Test");
// Create top window class
Win::Class::TopMaker topWinClass ("UnitTestClass", hInst);
topWinClass.Register ();
// Create Window Controller (needs access to MessagePrepro)
Win::MessagePrepro msgPrepro;
TopCtrl ctrl;
// Create top window (hidden)
Win::TopMaker topWin ("Unit Test", "UnitTestClass", hInst);
Win::Dow::Handle appWin = topWin.Create (&ctrl);
appWin.Show (cmdShow);
// The main message loop
return msgPrepro.Pump ();
}
catch (Win::Exception e)
{
TheOutput.Display (e);
}
catch (...)
{
Win::ClearError ();
TheOutput.Display ("Internal error: Unknown exception", Out::Error);
}
return 0;
}
开发者ID:BartoszMilewski,项目名称:WinLib,代码行数:31,代码来源:Main.cpp
示例3: BrowseCallbackProc
int CALLBACK FolderBrowser::BrowseCallbackProc (HWND winBrowseDlg,
UINT uMsg,
LPARAM lParam,
LPARAM lpData)
{
if (uMsg == BFFM_INITIALIZED && lpData != 0)
{
// lpData == _browseInfo.lParam == pointer to the initialization data
std::pair<char const *, char const *> const * initData =
reinterpret_cast<std::pair<char const *, char const *> const *>(lpData);
Win::Dow::Handle dlgWin (winBrowseDlg);
if (initData->first != 0)
{
// Window caption specified -- display it
dlgWin.SetText (initData->first);
}
if (initData->second != 0)
{
// Startup folder specified -- expand it
// Convert path to UNICODE
std::wstring wPath = ::ToWString (initData->second);
Win::Message msg (BFFM_SETEXPANDED, TRUE, reinterpret_cast<LPARAM>(wPath.c_str ()));
dlgWin.SendMsg (msg);
}
}
return 0;
}
开发者ID:dbremner,项目名称:WinLib,代码行数:27,代码来源:Shell.cpp
示例4: OnCreate
bool TopCtrl::OnCreate (Win::CreateData const * create, bool & success) throw ()
{
Win::Dow::Handle win = GetWindow ();
try
{
win.SetText ("Unit Test");
Win::EditMaker editMaker (_h, 1);
editMaker.Style ()
<< Win::Edit::Style::MultiLine
<< Win::Edit::Style::AutoVScroll
<< Win::Style::Ex::ClientEdge
<< Win::Style::AddVScrollBar;
_output.Reset (editMaker.Create ());
_watch.reset (new Watch (win));
_timer.Attach (win);
win.PostMsg (_initMsg);
success = true;
}
catch (Win::Exception e)
{
TheOutput.Display (e);
success = false;
}
catch (...)
{
Win::ClearError ();
TheOutput.Display ("Initialization -- Unknown Error", Out::Error);
success = false;
}
TheOutput.SetParent (win);
_ready = true;
return true;
}
开发者ID:BartoszMilewski,项目名称:WinLib,代码行数:34,代码来源:TopCtrl.cpp
示例5: ctrl
FocusBar::Use::~Use ()
{
while (_ctrls.size () > 0)
{
std::auto_ptr<FocusBar::Ctrl> ctrl (_ctrls.pop_back ());
Win::Dow::Handle win = ctrl->GetWindow ();
win.Destroy ();
}
}
开发者ID:dbremner,项目名称:WinLib,代码行数:9,代码来源:FocusBarWin.cpp
示例6: 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
}
开发者ID:dbremner,项目名称:WinLib,代码行数:10,代码来源:ToolBar.cpp
示例7: focusMaker
FocusBar::Ctrl * FocusBar::Use::MakeBarWindow (Win::Dow::Handle hwndParent,
unsigned id,
unsigned associatedId,
Focus::Ring & focusRing)
{
std::auto_ptr<FocusBar::Ctrl> newCtrl (new FocusBar::Ctrl (id, associatedId, focusRing));
Win::ChildMaker focusMaker (_className, hwndParent, id);
Win::Dow::Handle win = focusMaker.Create (newCtrl.get ());
FocusBar::Ctrl * ctrl = newCtrl.get ();
_ctrls.push_back (newCtrl);
win.Show ();
return ctrl;
}
开发者ID:dbremner,项目名称:WinLib,代码行数:13,代码来源:FocusBarWin.cpp
示例8: maker
//----------
// Tool::Bar
//----------
Bar::Bar (Win::Dow::Handle winParent,
int toolbarId,
int bitmapId,
int buttonWidth,
Cmd::Vector const & cmdVector,
Tool::Item const * buttonItems,
Win::Style const & barStyle)
: _buttonImages (winParent.GetInstance (), bitmapId, buttonWidth),
_cmdVector (cmdVector),
_buttonItems (buttonItems)
{
Tool::Maker maker (winParent, toolbarId);
maker.Style () << barStyle;
Reset (maker.Create ());
int width, height;
_buttonImages.GetImageSize (width, height);
SetButtonSize (width, height);
SetImageList (_buttonImages);
// Map button id to command id and cmd id to button item index
for (unsigned i = 0; _buttonItems [i].buttonId != Item::idEnd; ++i)
{
int buttonId = _buttonItems [i].buttonId;
if (buttonId != Item::idSeparator)
{
int cmdId = _cmdVector.Cmd2Id (_buttonItems [i].cmdName);
Assert (cmdId != -1);
_buttonId2CmdId [buttonId] = cmdId;
_cmdId2ButtonIdx [cmdId] = i;
}
}
}
开发者ID:dbremner,项目名称:WinLib,代码行数:35,代码来源:ToolBar.cpp
示例9: 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;
}
开发者ID:dbremner,项目名称:WinLib,代码行数:37,代码来源:Shell.cpp
示例10: 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
}
开发者ID:dbremner,项目名称:WinLib,代码行数:27,代码来源:Shell.cpp
示例11: dlgWin
void Progress::SingleCtrlHandler::Refresh ()
{
_caption.SetText (_dlgData.GetCaption ());
int min, max, step;
if (_channel.GetRange (min, max, step))
_bar.SetRange (min, max, step);
int position;
if (_channel.GetPosition (position))
_bar.StepTo (position);
if (_channel.GetActivity (_activityStr))
_activity.SetText (_activityStr);
Win::Dow::Handle dlgWin (GetWindow ());
dlgWin.Update ();
}
开发者ID:dbremner,项目名称:WinLib,代码行数:16,代码来源:ProgressDialog.cpp
示例12: 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
}
开发者ID:dbremner,项目名称:WinLib,代码行数:29,代码来源:Shell.cpp
示例13: 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
}
开发者ID:dbremner,项目名称:WinLib,代码行数:32,代码来源:Shell.cpp
示例14: 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
}
开发者ID:dbremner,项目名称:WinLib,代码行数:28,代码来源:Shell.cpp
示例15: 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;
}
开发者ID:dbremner,项目名称:WinLib,代码行数:10,代码来源:Shell.cpp
示例16: 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);
}
}
开发者ID:BartoszMilewski,项目名称:WinLib,代码行数:14,代码来源:MsgLoop.cpp
示例17: 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;
}
开发者ID:BartoszMilewski,项目名称:WinLib,代码行数:53,代码来源:MsgLoop.cpp
示例18: 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;
}
开发者ID:BartoszMilewski,项目名称:WinLib,代码行数:14,代码来源:MsgLoop.cpp
示例19: OnCreate
bool TopCtrl::OnCreate (Win::CreateData const * create, bool & success)
{
Win::Dow::Handle win = GetWindow ();
ResString caption (win.GetInstance (), ID_CAPTION);
try
{
TheOutput.Init (caption);
win.SetText (caption);
_commander.reset (new Commander (win));
_commander->SetModelessManager (&_modelessMan);
_cmdVector.reset (new CmdVector (Cmd::Table, _commander.get ()));
Accel::Maker accelMaker (Accel::Keys, *_cmdVector);
_kbdAccel.reset (new Accel::Handler (win, accelMaker.Create ()));
_msgPrepro.SetKbdAccelerator (_kbdAccel.get ());
_menu.reset (new Menu::DropDown (Menu::barItems, *_cmdVector));
_menu->AttachToWindow (win);
_view.reset (new View (win));
RegisterAsDropTarget(win);
win.PostMsg (_initMsg);
success = true;
}
catch (Win::Exception e)
{
TheOutput.Display (e);
success = false;
}
catch (...)
{
Win::ClearError ();
TheOutput.Display ("Initialization -- Unknown Error", Out::Error);
success = false;
}
TheOutput.SetParent (win);
_ready = true;
return true;
}
开发者ID:dbremner,项目名称:WinLib,代码行数:37,代码来源:TopCtrl.cpp
示例20: 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;
}
开发者ID:dbremner,项目名称:WinLib,代码行数:18,代码来源:Shell.cpp
注:本文中的win::dow::Handle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论