コード例 #1
0
ファイル: mHpWebClient.cpp プロジェクト: wyrover/mHelp
void mHpWebClient::Create(int x, int y, int nWidth, int nHeight, HWND hWndParent) {
  TraceFunc("mHpWebClient::Create");

  if (!ole_is_initialized_) {
    /* An application, when initializing the WebBrowser Control, should use
       OleInitialize rather than CoInitialize to start COM. OleInitialize
       enables support for the clipboard, drag-and-drop, OLE, and in-place
       activation. Use OleUninitialize to close the COM library when your
       application shuts down.  */

    HRESULT hr = ::OleInitialize(0);
    switch(hr) {
        case S_OK: // Initialized
        case S_FALSE: { // Already initialized
            ole_is_initialized_ = true;
            break;
        }
        case RPC_E_CHANGED_MODE:
        case OLE_E_WRONGCOMPOBJ: {
            ::MessageBox(0, "Could not initialize Ole", 0, 0);
            return;
        }
    }
  }

  WNDCLASSEX    wc;

  ::ZeroMemory (&wc, sizeof(WNDCLASSEX));
  wc.cbSize        = sizeof(WNDCLASSEX);
  wc.hInstance     = instance_;
  wc.lpfnWndProc   = this->WindowProc;
  wc.lpszClassName = "mHpWebClient";

  RegisterClassEx(&wc);

  hwnd_ = ::CreateWindowEx(WS_EX_CLIENTEDGE, "mHpWebClient", "mHpWebClientCtrl", WS_CHILDWINDOW | WS_BORDER,
            x, y, 
            nWidth, nHeight,
            hWndParent, 0, 
            instance_, 0);

  if (hwnd_) { 
    SetWindowLongPtr(hwnd_, GWLP_USERDATA, (LONG_PTR)this);
    if (CreateBrowserObject()) {
      ::MessageBox(0, "Could not create browser object", 0, 0);
    }

    AddSink();

    ShowWindow(hwnd_, SW_SHOWNORMAL);
    UpdateWindow(hwnd_);
  }
}
コード例 #2
0
ファイル: window.cpp プロジェクト: AllegianceZone/Allegiance
void Window::AddSink(IEventSink* psink)
{
    AddSink(psink, 1.0f);
}
コード例 #3
-3
bool MAPIStorageAdviser::AdviseAll()
{
  IMAPISession* pSession = InitIMAPISession();
  IMAPITable* pStoresTable = GetStoresTable(pSession); 
  
  SizedSPropTagArray(2, tblColumns) = {2, {PR_DISPLAY_NAME, PR_ENTRYID}};
  pStoresTable->SetColumns((LPSPropTagArray)&tblColumns, 0);
  
  for(;;) {
    SRowSet * pRowSet = NULL;

    pStoresTable->QueryRows(1, 0, &pRowSet);
    
    if(pRowSet->cRows != 1)
      break;

    ASSERT(pRowSet->aRow[0].cValues == tblColumns.cValues);
    SPropValue* pVal = pRowSet->aRow[0].lpProps;

    ASSERT(pVal[0].ulPropTag == PR_DISPLAY_NAME);
    ASSERT(pVal[1].ulPropTag == PR_ENTRYID);

    LPWSTR lpStoreName = pRowSet->aRow[0].lpProps[0].Value.lpszW;

    // Open Store
    LPBYTE pEntry = (LPBYTE)pRowSet->aRow[0].lpProps[1].Value.bin.lpb;
    ULONG ulStoreBytes = pRowSet->aRow[0].lpProps[1].Value.bin.cb;

    IMsgStore* pStore = _GetStoreFromEntryID(pSession, ulStoreBytes, pEntry);
    if (pStore == NULL)
    {
      continue;
    }
    
	if (AddSink(pStore) == true) {
	}else{
	}

    pStore->Release();
    
    FreeProws(pRowSet);
  }
  
  pStoresTable->Release();
  pSession->Release();
  
  return true;
}