本文整理汇总了C++中cWindow::GetWindowHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ cWindow::GetWindowHandle方法的具体用法?C++ cWindow::GetWindowHandle怎么用?C++ cWindow::GetWindowHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cWindow
的用法示例。
在下文中一共展示了cWindow::GetWindowHandle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void cTaskBar::Init(cWindow& owner)
{
std::cout<<"LTaskbarButton::Init"<<std::endl;
ASSERT(hwndWindow == NULL);
hwndWindow = owner.GetWindowHandle();
ASSERT(!taskBarList.IsValid());
taskBarList.CreateObject((REFCLSID)CLSID_TaskbarList, IID_ITaskbarList3);
ASSERT(taskBarList.IsValid());
}
示例2: OpenWebPage
void OpenWebPage(const cWindow& parent, const string_t& sWebPage)
{
// Launch this web page in the default browser
SHELLEXECUTEINFO sh;
memset(&sh, 0, sizeof(SHELLEXECUTEINFO));
sh.cbSize = sizeof(SHELLEXECUTEINFO);
sh.lpVerb = TEXT("open");
sh.lpFile = sWebPage.c_str();
sh.hwnd = parent.GetWindowHandle();
sh.nShow = SW_NORMAL;
::ShellExecuteEx(&sh);
}
示例3: Create
void cLinkControl::Create(cWindow& parent, cLinkControlListener& listener, int idControl, const string_t& sText)
{
// Create the SysLink control
control = ::CreateWindowEx(NULL, WC_LINK, sText.c_str(),
WS_VISIBLE | WS_CHILD | WS_TABSTOP,
50, 220, 100, 24,
parent.GetWindowHandle(),
(HMENU)NULL,
::GetModuleHandle(NULL), NULL
);
// Set the default font
parent.SetControlDefaultFont(control);
parent.AddHandler(control, *this);
pListener = &listener;
}
示例4: Create
void cOpenGLControl::Create(cWindow& parent, int idControl)
{
// Register our window class
RegisterClass();
// Create the OpenGL control
control = ::CreateWindowEx(0, TEXT(LIBWIN32MM_OPENGL_CONTROLCLASS), TEXT(""), WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | WS_TABSTOP, 0, 0, 0, 0, parent.GetWindowHandle(), (HMENU)idControl, GetHInstance(), (LPVOID)0);
parent.SetControlDefaultFont(control);
UpdateSize();
// Set our user data for this window
::SetProp(control, TEXT("cOpenGLControlThis"), (HANDLE)this);
}
示例5: Run
int cTaskDialog::Run(cWindow& parent, const cTaskDialogSettings& settings)
{
// Create our task dialog
TASKDIALOGCONFIG tdc = { 0 };
tdc.cbSize = sizeof(tdc);
tdc.dwFlags = TDF_ALLOW_DIALOG_CANCELLATION;
if (settings.bIsCheckBoxTickedInitially) tdc.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED;
tdc.dwCommonButtons = (settings.bCloseButtonText ? TDCBF_CLOSE_BUTTON : TDCBF_CANCEL_BUTTON);
tdc.hwndParent = parent.GetWindowHandle();
tdc.hInstance = GetHInstance();
//tdc.hMainIcon = hIcon;
switch (settings.type) {
case cTaskDialogSettings::TYPE::INFORMATION: {
tdc.pszMainIcon = TD_INFORMATION_ICON;
break;
}
case cTaskDialogSettings::TYPE::WARNING: {
tdc.pszMainIcon = TD_ERROR_ICON;
break;
}
case cTaskDialogSettings::TYPE::ERROR: {
tdc.pszMainIcon = TD_ERROR_ICON;
break;
}
};
tdc.pszWindowTitle = settings.sCaption.c_str();
tdc.pszMainInstruction = settings.sInstructions.c_str();
tdc.pszContent = settings.sContent.c_str();
// Add our buttons
TASKDIALOG_BUTTON* pButtons = nullptr;
const size_t nButtons = settings.items.size();
if (!settings.items.empty()) {
tdc.dwFlags |= TDF_USE_COMMAND_LINKS;
pButtons = new TASKDIALOG_BUTTON[nButtons];
for (size_t i = 0; i < nButtons; i++) {
pButtons[i].nButtonID = settings.items[i].iCommandID;
string_t sText(settings.items[i].sText);
if (!settings.items[i].sTextDescription.empty()) {
sText += TEXT("\n");
sText += settings.items[i].sTextDescription;
}
const size_t nSize = sText.length() + 1;
pButtons[i].pszButtonText = new wchar_t[nSize];
wcscpy_s((wchar_t*)(pButtons[i].pszButtonText), nSize, sText.c_str());
}
tdc.pButtons = pButtons;
tdc.cButtons = UINT(nButtons);
tdc.nDefaultButton = settings.iDefaultItemCommandID;
}
/*PCWSTR pszExpandedInformation;
PCWSTR pszExpandedControlText;
PCWSTR pszCollapsedControlText;*/
tdc.pfCallback = _TaskDialogCallbackProc;
tdc.lpCallbackData = LONG_PTR(this);
if (settings.bIsProgressBarVisible) {
tdc.dwFlags |= TDF_CALLBACK_TIMER | TDF_SHOW_PROGRESS_BAR;
}
// Checkbox
if (settings.bIsCheckBoxVisible) {
tdc.dwFlags |= TDF_EXPAND_FOOTER_AREA;
tdc.pszVerificationText = settings.sCheckBoxTitle.c_str();
}
// Run the task dialog
int iButton = 0;
//BOOL bResult = FALSE;
const HRESULT rResult = TaskDialogIndirect(&tdc, &iButton, NULL, nullptr /*&bResult*/);
assert(rResult == S_OK);
// Clear our window handle
hwndWindow = NULL;
// Destroy our buttons
if (pButtons != nullptr) {
for (size_t i = 0; i < nButtons; i++) delete [] pButtons[i].pszButtonText;
delete [] pButtons;
}
// If there was an error then pretend the user cancelled
if (rResult != S_OK) iButton = IDCANCEL;
// If no valid selection was made then pretend the user cancelled
if (iButton < 0) iButton = IDCANCEL;
// Return the button that was selected
return iButton;
}