本文整理汇总了C++中win::dow::Handle类的典型用法代码示例。如果您正苦于以下问题:C++ Handle类的具体用法?C++ Handle怎么用?C++ Handle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Handle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 ();
}
}
示例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
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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
}
示例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 ();
}
示例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
}
示例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
}
示例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
}
示例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;
}