コード例 #1
0
void Button::CreateButton(int x1, int y1, int x2, int y2)
{
	setPosition(x1,y1,x2,y2);
	setHWNDElement(CreateWindowEx(0, "BUTTON", GetCaption(), BS_PUSHBUTTON|
				WS_VISIBLE|WS_CHILD|WS_TABSTOP, x1, y1, x2, y2, GetHWNDForm(),
				NULL, GetHInstance(), NULL));
}
コード例 #2
0
ファイル: std_sP.cpp プロジェクト: FarGroup/FarManager
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
    if ( reason == DLL_PROCESS_ATTACH ) {
      char nm[ MAX_PATH_SIZE ];
      nm[ GetModuleFileName(NULL,nm,sizeof(nm)-1) ] = 0;
      FILELog( "STDS(%08X) Loaded by: [%s]",GetHInstance(),nm );
    }
 return 1;
}
コード例 #3
0
ファイル: openglcontrol.cpp プロジェクト: pilkch/library
 void cOpenGLControl::RegisterClass()
 {
    // Register our window class
    WNDCLASS wc;
    ZeroMemory(&wc, sizeof(WNDCLASS));
    wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS | CS_OWNDC;
    wc.lpfnWndProc = _WindowProc;
    wc.cbWndExtra = sizeof(cOpenGLControl*);
    wc.hInstance = GetHInstance();
    wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW);
    wc.lpszClassName = TEXT(LIBWIN32MM_OPENGL_CONTROLCLASS);
    ::RegisterClass(&wc);
 }
コード例 #4
0
void MouseEventTool::AddHook()
{
    myself = this;
    myPid = pid_;
    hinstDLL = GetHInstance();
    hkprc = MouseHookProc;

    hhook = SetWindowsHookEx(WH_MOUSE,
        hkprc,
        //hinstDLL,
        //0);
        NULL,
        GetCurrentThreadId());
    return;
}
コード例 #5
0
ファイル: nglKernel_WinXX.cpp プロジェクト: JamesLinus/nui3
bool nglKernel::SysInit (HINSTANCE Inst)
{
  NGL_ASSERTR(mHInstance == NULL, false);

  mHInstance = Inst;

  // Import current host/user locale
  setlocale(LC_ALL, ""); // FIXME: this call creates a bunch of memory leaks, or so boundchecker says...

  // Tell the system not to bother the user with file and path error dialogs, fail in the code instead.
  SetErrorMode(SEM_FAILCRITICALERRORS);

#ifdef HAVE_MLANG
  /* If nglStringConv relies on MLang, we need to initialize COM state.
   * See nglStringConv.cpp for more info.
   */
  CoInitialize(NULL);
#endif

  /* Register our core window class
   */
  WNDCLASSEX dummywc;
  dummywc.cbSize = sizeof(WNDCLASSEX);
  if (!GetClassInfoEx( Inst, NGL_CORE_CLASS, &dummywc))
  {
    WNDCLASS wc;

    wc.style         = CS_DBLCLKS | CS_OWNDC;
    wc.lpfnWndProc   = MainWndProcStatic;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = mHInstance;
    wc.hIcon         = LoadIcon( GetHInstance(), _T("0") );
    wc.hCursor       = LoadCursor( NULL, IDC_ARROW );
    wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = NGL_CORE_CLASS;

    if (!RegisterClass( &wc ))
    {
      NGL_DEBUG( OutputDebugString(_T("NGL: error: unable to create ") NGL_CORE_CLASS _T(" window class\n")); )
      return false;
コード例 #6
0
ファイル: openglcontrol.cpp プロジェクト: pilkch/library
  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);
  }
コード例 #7
0
ファイル: taskdialog.cpp プロジェクト: pilkch/library
  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;
  }
コード例 #8
0
ファイル: controls.cpp プロジェクト: pilkch/library
  void cImageControl::Create(cWindow& parent, const cBitmap& bitmap)
  {
    // Create the control
    control = ::CreateWindowEx(0, WC_STATIC, NULL, WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | SS_BITMAP, 0, 0, 0, 0, parent.GetWindowHandle(), 0, GetHInstance(), NULL);

    // Set the image
    SetImage(bitmap);

    parent.AddHandler(control, *this);
  }