bool EffectShaderAnnotationDX9Imp::acquireResource() { assert( effect_ ); if( NULL == effect_ ) return false; switch( searchBy_ ) { case ESEARCH_BY_INDEX: handle_ = effect_->GetAnnotation( getParentHandle(), index_ ); break; case ESEARCH_BY_NAME: handle_ = effect_->GetParameterByName( getParentHandle(), convertString( name_ ).c_str() ); break; } if( NULL == handle_ ) { wchar_t tmp[256]; _snwprintf_s( tmp, 256, L"EffectShaderAnnotationDX9Imp::acquireResource\n" ); OutputDebugStr( tmp ); return false; } assert( effect_ ); effect_->GetParameterDesc( getHandleDX9(), & desc_ ); return true; }
bool ListViewEdit::onKeyDown(const UINT iVirtKey) { NotifyMessage<NMLVDISPINFO> oMessage(LVN_ENDLABELEDIT, Handle, WindowID); wstring szText; switch (iVirtKey) { // [RETURN] Pass text to parent, then destroy case VK_RETURN: szText = getText(); oMessage.item.mask = LVIF_TEXT; oMessage.item.pszText = const_cast<TCHAR*>(szText.c_str()); oMessage.item.iItem = m_iItem; oMessage.item.iSubItem = m_iSubItem; oMessage.Send(getParentHandle()); // Fall through... // [ESCAPE] Destroy by switching focus to parent case VK_ESCAPE: getParent()->SetFocus(); break; } return Unhandled; // Pass to base }
TableViewImpl * TableViewImpl::clone() const { auto result = std::make_unique<TableViewImpl>(getParentHandle(),getControlData()); ListView_SetExtendedListViewStyle(result->hWnd,ListView_GetExtendedListViewStyle(hWnd)); result->imageListImpl = imageListImpl; for( int c = 0; c != colCount; ++c ) { result->addColumn(column(c)); } result->setRows(rowCount); return result.release(); }
bool ColorDialog::open( ColorParams & colorParams, bool basic, bool allowFullOpen ) { CHOOSECOLOR cc = { sizeof( CHOOSECOLOR ) }; cc.hwndOwner = getParentHandle(); cc.rgbResult = colorParams.itsColor; cc.lpCustColors = itsColorParams.itsCustomColors; cc.Flags = CC_ANYCOLOR | CC_RGBINIT; if ( !basic ) cc.Flags |= CC_FULLOPEN; if ( !allowFullOpen ) cc.Flags |= CC_PREVENTFULLOPEN; if(::ChooseColor( & cc )) { colorParams.itsColor = cc.rgbResult; return true; } return false; }
bool FontDialog::open(DWORD dwFlags, LOGFONT& font, DWORD& rgbColors) { CHOOSEFONT cf = { sizeof(CHOOSEFONT) }; // Initialize CHOOSEFONT cf.hwndOwner = getParentHandle(); cf.Flags = dwFlags | CF_INITTOLOGFONTSTRUCT; cf.lpLogFont = &font; cf.rgbColors = rgbColors; if ( ::ChooseFont( & cf ) ) { rgbColors = cf.rgbColors; return true; } return false; }
int prepareHostCommandStream (HostCommandStream *hcs, void *data) { SECURITY_ATTRIBUTES attributes; ZeroMemory(&attributes, sizeof(attributes)); attributes.nLength = sizeof(attributes); attributes.bInheritHandle = TRUE; attributes.lpSecurityDescriptor = NULL; if (CreatePipe(&hcs->package.inputHandle, &hcs->package.outputHandle, &attributes, 0)) { if (SetHandleInformation(*getParentHandle(hcs), HANDLE_FLAG_INHERIT, 0)) { return 1; } else { logWindowsSystemError("SetHandleInformation"); } } else { logWindowsSystemError("CreatePipe"); } return 0; }
void MDIParent::create( const Seed & cs ) { CLIENTCREATESTRUCT ccs; ccs.hWindowMenu = cs.windowMenu; ccs.idFirstChild = cs.idFirstChild; HWND wnd = ::CreateWindowEx( cs.exStyle, getDispatcher().getClassName(), cs.caption.c_str(), cs.style, cs.location.x(), cs.location.y(), cs.location.width(), cs.location.height(), getParentHandle(), NULL, ::GetModuleHandle(NULL), reinterpret_cast< LPVOID >( &ccs ) ); if (wnd == NULL) { // The most common error is to forget WS_CHILD in the styles throw Win32Exception("CreateWindowEx failed"); } }
static int finishParentHostCommandStream (HostCommandStream *hcs, void *data) { { HANDLE *handle = getParentHandle(hcs); int mode = hcs->isInput? O_WRONLY: O_RDONLY; int fileDescriptor; if ((fileDescriptor = _open_osfhandle((intptr_t)*handle, mode)) == -1) { logSystemError("_open_osfhandle"); return 0; } *handle = INVALID_HANDLE_VALUE; if (!finishHostCommandStream(hcs, fileDescriptor)) { _close(fileDescriptor); return 0; } } closeHandle(getChildHandle(hcs)); return 1; }
bool FolderDialog::open(tstring& folder) { BROWSEINFO bws = { 0 }; bws.hwndOwner = getParentHandle(); bws.pidlRoot = itsPidlRoot; if(!itsTitle.empty()) { bws.lpszTitle = itsTitle.c_str(); } bws.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS | BIF_EDITBOX; if(!folder.empty()) { bws.lParam = reinterpret_cast<LPARAM>(folder.c_str()); bws.lpfn = &browseCallbackProc; } // Avoid errors about missing cdroms, floppies etc.. UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS); LPITEMIDLIST lpIDL = SHBrowseForFolder( & bws ); ::SetErrorMode(oldErrorMode); if(lpIDL) { TCHAR buf[MAX_PATH + 1]; if ( ::SHGetPathFromIDList( lpIDL, buf ) ) { folder = buf; if(folder.size() > 0 && folder[folder.size()-1] != _T('\\')) { folder += _T('\\'); } ::CoTaskMemFree(lpIDL); return true; } ::CoTaskMemFree(lpIDL); } return false; }
PaintBoxImpl * PaintBoxImpl::clone() const { return new PaintBoxImpl(getParentHandle(),getControlData()); }
FolderDialog& FolderDialog::setRoot( const int csidl ) { if (FAILED(SHGetSpecialFolderLocation( getParentHandle(), csidl, &itsPidlRoot ))) { itsPidlRoot = NULL; } return *this; }
MemoImpl * MemoImpl::clone() const { auto result = std::make_unique<MemoImpl>(getParentHandle(),getControlData()); cloneInto(*result); return result.release(); }
PaintBoxX11 * PaintBoxX11::clone() const { return new PaintBoxX11(getParentHandle(),getControlData()); }