Example #1
0
void _al_win_set_window_frameless(ALLEGRO_DISPLAY *display, HWND hWnd,
   bool frameless)
{
   int w = display->w;
   int h = display->h;

   if (frameless) {
      SetWindowLong(hWnd, GWL_STYLE, WS_VISIBLE);
      SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
      SetWindowPos(hWnd, 0, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
   }
   else {
      RECT r;
      DWORD style;
      DWORD exStyle;

      display_flags_to_window_styles(display->flags, &style, &exStyle);
      style |= WS_VISIBLE;

      GetWindowRect(hWnd, &r);
      AdjustWindowRectEx(&r, style, false, exStyle);

      w = r.right - r.left;
      h = r.bottom - r.top;

      SetWindowLong(hWnd, GWL_STYLE, style);
      SetWindowLong(hWnd, GWL_EXSTYLE, exStyle);
      SetWindowPos(hWnd, 0, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
   }
}
Example #2
0
/*
==============
CreateEntityWindow
==============
*/
BOOL CreateEntityWindow(HINSTANCE hInstance)
{
	HWND hwndEntityPalette;

	inspector_mode = W_ENTITY;

	WEnt_Create (hInstance);

	hwndEntityPalette = CreateDialog(hInstance, (char *)IDD_ENTITY, g_qeglobals.d_hwndMain, (DLGPROC)NULL);
	if (!hwndEntityPalette)
		Error ("CreateDialog failed");

	GetEntityControls (hwndEntityPalette);
	DestroyWindow (hwndEntityPalette);

	OldFieldWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC);
	SetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC, (long)FieldWndProc);
	SetWindowLong (hwndEnt[EntValueField], GWL_WNDPROC, (long)FieldWndProc);

	OldEntityListWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntList], GWL_WNDPROC);
	SetWindowLong (hwndEnt[EntList], GWL_WNDPROC, (long)EntityListWndProc);

	FillClassList ();


	LoadWindowPlacement(g_qeglobals.d_hwndEntity, "EntityWindowPlace");
	ShowWindow (g_qeglobals.d_hwndEntity, SW_HIDE);
	SetInspectorMode (W_CONSOLE);

	return TRUE;
}
Example #3
0
/*
===================
GLimp_SetScreenParms

Sets up the screen based on passed parms..
===================
*/
bool GLimp_SetScreenParms( glimpParms_t parms ) {
    // Optionally ChangeDisplaySettings to get a different fullscreen resolution.
    if ( !GLW_ChangeDislaySettingsIfNeeded( parms ) ) {
        return false;
    }

    int x, y, w, h;
    if ( !GLW_GetWindowDimensions( parms, x, y, w, h ) ) {
        return false;
    }

    int exstyle;
    int stylebits;

    if ( parms.fullScreen ) {
        exstyle = WS_EX_TOPMOST;
        stylebits = WS_POPUP|WS_VISIBLE|WS_SYSMENU;
    } else {
        exstyle = 0;
        stylebits = WINDOW_STYLE|WS_SYSMENU;
    }

    SetWindowLong( win32.hWnd, GWL_STYLE, stylebits );
    SetWindowLong( win32.hWnd, GWL_EXSTYLE, exstyle );
    SetWindowPos( win32.hWnd, parms.fullScreen ? HWND_TOPMOST : HWND_NOTOPMOST, x, y, w, h, SWP_SHOWWINDOW );

    glConfig.isFullscreen = parms.fullScreen;
    glConfig.pixelAspect = 1.0f;	// FIXME: some monitor modes may be distorted

    glConfig.isFullscreen = parms.fullScreen;
    glConfig.nativeScreenWidth = parms.width;
    glConfig.nativeScreenHeight = parms.height;

    return true;
}
LRESULT _etk_create_window(EWin32GraphicsEngine *win32Engine, etk_win32_gdi_callback_t *callback)
{
	if(win32Engine == NULL || callback == NULL ||
	   callback->command != WM_ETK_MESSAGE_CREATE_WINDOW || callback->win == NULL) return FALSE;

	EAutolock <EWin32GraphicsEngine> autolock(win32Engine);
	if(autolock.IsLocked() == false || win32Engine->InitCheck() != E_OK) return FALSE;

	LONG style = _etk_get_window_style(E_TITLED_WINDOW_LOOK);
	LONG styleEx = _etk_get_window_style_ex(E_TITLED_WINDOW_LOOK);

	RECT r;
	r.left = callback->x;
	r.top = callback->y;
	r.right = callback->x + (int)callback->w;
	r.bottom = callback->y + (int)callback->h;

	AdjustWindowRectEx(&r, style, FALSE, styleEx);

	if((callback->win->win32Window = CreateWindowEx(styleEx, MAKEINTATOM(win32Engine->win32RegisterClass), "", style,
							r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1,
							NULL, NULL, win32Engine->win32Hinstance, NULL)) == NULL) return FALSE;

	callback->win->fLook = E_TITLED_WINDOW_LOOK;

	// FIXME: maybe 64-bit pointer
	SetWindowLong(callback->win->win32Window, 0, reinterpret_cast<long>(win32Engine));
	SetWindowLong(callback->win->win32Window, GWL_USERDATA, reinterpret_cast<long>(callback->win));

	return TRUE;
}
BOOL CScoreDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CenterWindow();	

	// subclass edit boxes to make them read-only without graying them
	// (kind of a hack)
	wpOrigEditROProc = (WNDPROC) SetWindowLong(GetDlgItem(IDC_BONUS_POINTS)->m_hWnd, GWL_WNDPROC, (LONG) EditROSubclassProc);
	SetWindowLong(GetDlgItem(IDC_TRICK_POINTS)->m_hWnd, GWL_WNDPROC, (LONG) EditROSubclassProc);
	SetWindowLong(GetDlgItem(IDC_TOTAL_POINTS)->m_hWnd, GWL_WNDPROC, (LONG) EditROSubclassProc);

/*
	//
	if (m_bDisableGameControls)
	{
		GetDlgItem(ID_REBID_HAND)->EnableWindow(FALSE);
		GetDlgItem(ID_REPLAY_HAND)->EnableWindow(FALSE);
	}
*/

	//
	ScrollToBottom((CRichEditCtrl&) *(GetDlgItem(IDC_BONUS_POINTS)));
	ScrollToBottom((CRichEditCtrl&) *(GetDlgItem(IDC_TRICK_POINTS)));
	
	//
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
SCERROR Win32ScreenDevice::AttachTo(HWND wnd)
{
 // if ( wnd == hwnd_ ) return SCE_OK;
  if ( hwnd_ ) {
    if ( hdc_ && !attached_ )  ReleaseDC( hwnd_,hdc_ );
    if (!attached_)
      DestroyWindow(hwnd_);
    else
      if (defproc_) SetWindowLong(hwnd_,GWL_WNDPROC,(LONG)defproc_);
    hdc_ = 0;
  }
  if ( wnd )
  {
    hwnd_ = wnd;
    //*(LONG*)&defproc_ = GetWindowLong(hwnd_,GWL_WNDPROC);
    defproc_ = 0;
    *(LONG*)&defproc_ = SetWindowLong(hwnd_,GWL_WNDPROC,(LONG)WindowProc);
    if ( (LONG)defproc_ & 0x80000000 ) defproc_ = 0;
    attached_ = true;
  }
  else
  {
    attached_ = false;
    hwnd_ = 0;
    defproc_ = 0;
  }

  return SCE_OK;
}
LRESULT _etk_set_window_look(EWin32GraphicsEngine *win32Engine, etk_win32_gdi_callback_t *callback)
{
	if(win32Engine == NULL || callback == NULL ||
	   callback->command != WM_ETK_MESSAGE_SET_WINDOW_LOOK || callback->win == NULL ||
	   callback->win->win32Window == NULL) return FALSE;

	EAutolock <EWin32GraphicsEngine> autolock(win32Engine);
	if(autolock.IsLocked() == false || win32Engine->InitCheck() != E_OK) return FALSE;

	BOOL visible = IsWindowVisible(callback->win->win32Window);

	if(callback->win->fLook != callback->look)
	{
		LONG style = _etk_get_window_style(callback->look);
		LONG styleEx = _etk_get_window_style_ex(callback->look);
		SetWindowLong(callback->win->win32Window, GWL_EXSTYLE, styleEx);
		SetWindowLong(callback->win->win32Window, GWL_STYLE, style);
		SetWindowPos(callback->win->win32Window, NULL, 0, 0, 0, 0,
			     SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
		callback->win->fLook = callback->look;

		if(visible)
		{
			SetWindowPos(callback->win->win32Window, NULL, 0, 0, 0, 0,
				     SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW);
			SetWindowPos(callback->win->win32Window, NULL, 0, 0, 0, 0,
				     SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
		}
	}

	return TRUE;
}
Example #8
0
/*
 * If we are fullscreen, resize the current window back to its original size
 */
void fgPlatformGlutLeaveFullScreen( SFG_Window *win )
{
#if !defined(_WIN32_WCE) /* FIXME: what about WinCE */
    if (!glutGet(GLUT_FULL_SCREEN))
    {
        /* nothing to do */
        return;
    }

    /* restore style of window before making it fullscreen */
    SetWindowLong(win->Window.Handle, GWL_STYLE, win->State.pWState.OldStyle);
    SetWindowLong(win->Window.Handle, GWL_EXSTYLE, win->State.pWState.OldStyleEx);

    /* Then resize */
    SetWindowPos(win->Window.Handle,
        HWND_TOP,
        win->State.pWState.OldRect.left,
        win->State.pWState.OldRect.top,
        win->State.pWState.OldRect.right  - win->State.pWState.OldRect.left,
        win->State.pWState.OldRect.bottom - win->State.pWState.OldRect.top,
        SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING |
        SWP_NOZORDER
        );

    if (win->State.pWState.OldMaximized)
        SendMessage(win->Window.Handle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);

    win->State.IsFullscreen = GL_FALSE;
#endif
}
Example #9
0
////////////////////////////////////////////////////////////
/// Switch to fullscreen mode
////////////////////////////////////////////////////////////
void SwitchToFullscreen(struct VideoMode * Mode)
{
    DEVMODE DevMode;
	long Style;

    DevMode.dmSize       = sizeof(DEVMODE);
    DevMode.dmPelsWidth  = Mode->Width;
    DevMode.dmPelsHeight = Mode->Height;
    DevMode.dmBitsPerPel = Mode->BitsPerPixel;
    DevMode.dmFields     = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;

    // Apply fullscreen mode
    if (ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
    {
        MessageError("SwitchToFullscreen", "Failed to change display mode for fullscreen.");
        return;
    }

    // Change window style (no border, no titlebar, ...)
    SetWindowLong(WindowhWnd, GWL_STYLE,   WS_POPUP);
    SetWindowLong(WindowhWnd, GWL_EXSTYLE, WS_EX_APPWINDOW);

    // And resize it so that it fits the entire screen
    SetWindowPos(WindowhWnd, HWND_TOP, 0, 0, Mode->Width, Mode->Height, SWP_FRAMECHANGED);
    ShowWindow(WindowhWnd, SW_SHOW);

    // SetPixelFormat can fail (really ?) if window style doesn't contain these flags
    Style = GetWindowLong(WindowhWnd, GWL_STYLE);
    SetWindowLong(WindowhWnd, GWL_STYLE, Style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
}
Example #10
0
WXLRESULT DisassemblyDialog::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
	switch (nMsg)
	{
	case WM_SHOWWINDOW:
		{
			WXHWND hwnd = GetHWND();

			u32 style = GetWindowLong((HWND)hwnd,GWL_STYLE);
			style &= ~(WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
			SetWindowLong((HWND)hwnd,GWL_STYLE,style);

			u32 exStyle = GetWindowLong((HWND)hwnd,GWL_EXSTYLE);
			exStyle |= (WS_EX_CONTEXTHELP);
			SetWindowLong((HWND)hwnd,GWL_EXSTYLE,exStyle);
		}
		break;
	case WM_SYSCOMMAND:
		if (wParam == SC_CONTEXTHELP)
		{
			DebuggerHelpDialog help(this);
			help.ShowModal();
			return 0;
		}
		break;
	}

	return wxFrame::MSWWindowProc(nMsg,wParam,lParam);
}
//--------------------------------------------------------------
bool ofxDetectDisplays::placeWindowOnDisplay(int displayID, bool borderless)
{

#if defined(TARGET_OSX)
    ofSetFullscreen(false);
    ofSetWindowPosition(displays[displayID]->left, displays[displayID]->top);
    ofSetWindowShape(displays[displayID]->width, displays[displayID]->height);

#elif defined(TARGET_WIN32)
	HWND hwnd = ofGetWin32Window();
 
	DWORD EX_STYLE;
	DWORD STYLE;

	if (borderless) {
		EX_STYLE = WS_EX_WINDOWEDGE;
		STYLE = WS_OVERLAPPED;
	}
	else {
		EX_STYLE = WS_EX_OVERLAPPEDWINDOW;
		STYLE = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
	}
	
	SetWindowLong(hwnd, GWL_EXSTYLE, EX_STYLE);
	SetWindowLong(hwnd, GWL_STYLE, STYLE);
	SetWindowPos(hwnd, HWND_TOPMOST, displays[displayID]->left, displays[displayID]->top, displays[displayID]->width, displays[displayID]->height, SWP_SHOWWINDOW);
#endif

	return true;
}
	void CoreWin32Platform::ToggleFullscreen()
	{
		// Setup styles based on windowed / fullscreen mode
		isFullscreen = !isFullscreen;

		if ( isFullscreen )
		{
			currentMode = fullscreenMode;
			GetWindowRect(hWindow, &windowPositionBeforeFullscreen);

			SetMenu( hWindow, NULL );
			SetWindowLong( hWindow, GWL_STYLE, FULLSCREEN_STYLE );
			SetWindowPos( hWindow, NULL, 0, 0, currentMode.width, currentMode.height, SWP_NOZORDER );
		} 
		else
		{
			SetWindowLong( hWindow, GWL_STYLE, WINDOWED_STYLE );

			currentMode = windowedMode;
			RECT windowedRect = GetWindowedRectForDisplayMode(currentMode);
	
			SetWindowPos( hWindow, HWND_NOTOPMOST, windowPositionBeforeFullscreen.left, windowPositionBeforeFullscreen.top, windowedRect.right - windowedRect.left, windowedRect.bottom - windowedRect.top, SWP_NOACTIVATE | SWP_SHOWWINDOW );
		}
		
		Logger::FrameworkDebug("[RenderManagerDX9] toggle mode: %d x %d isFullscreen: %d", currentMode.width, currentMode.height, isFullscreen);

		RenderManager::Instance()->ChangeDisplayMode(currentMode, isFullscreen);
		RenderManager::Instance()->Init(currentMode.width, currentMode.height);
		UIControlSystem::Instance()->SetInputScreenAreaSize(currentMode.width, currentMode.height);
		Core::Instance()->SetPhysicalScreenSize(currentMode.width, currentMode.height);
	}
Example #13
0
/*
================
MaskEdit_Attach

Attaches the mask edit control to a normal edit control
================
*/
void MaskEdit_Attach ( HWND hWnd, const char* invalid )
{
	rvGEMaskEdit* edit = new rvGEMaskEdit;
	edit->mProc = (WNDPROC)GetWindowLong ( hWnd, GWL_WNDPROC );
	strcpy ( edit->mInvalid, invalid );
	SetWindowLong ( hWnd, GWL_USERDATA, (LONG)edit );
	SetWindowLong ( hWnd, GWL_WNDPROC, (LONG)MaskEdit_WndProc );
}
Example #14
0
void AddRTLStyle(HWND hWnd, long dwStyle)
{
    long s;

    s = GetWindowLong(hWnd, GWL_STYLE);
    SetWindowLong(hWnd, GWL_STYLE, s | dwStyle);
    s = GetWindowLong(hWnd, GWL_EXSTYLE);
    SetWindowLong(hWnd, GWL_EXSTYLE, s | WS_EX_RIGHT | WS_EX_RTLREADING);
}
Example #15
0
bool GEItescriptsDlg_Init( HWND hwnd ) {
	idWindow			*window;
	rvGEWindowWrapper	*wrapper;
	HWND				script;
	// Extract the window pointer from the win32 windows user data long
	window = ( idWindow * )GetWindowLong( hwnd, GWL_USERDATA );
	assert( window );
	// Get the window wrapper of the script window
	wrapper = rvGEWindowWrapper::GetWrapper( window );
	assert( wrapper );
	// Get the edit box used to edit the script
	script = GetDlgItem( hwnd, IDC_GUIED_SCRIPT );
	UINT tabsize = 16;
	SendMessage( script, EM_SETTABSTOPS, 1, ( LPARAM )&tabsize );
	SetWindowLong( script, GWL_USERDATA, GetWindowLong( script, GWL_WNDPROC ) );
	SetWindowLong( script, GWL_WNDPROC, ( LONG ) GEScriptEdit_WndProc );
	TEXTMETRIC tm;
	HDC dc;
	dc = GetDC( script );
	GetTextMetrics( dc, &tm );
	ReleaseDC( script, dc );
	LOGFONT lf;
	ZeroMemory( &lf, sizeof( lf ) );
	lf.lfHeight = tm.tmHeight;
	strcpy( lf.lfFaceName, "Courier New" );
	SendMessage( script, WM_SETFONT, ( WPARAM )CreateFontIndirect( &lf ), 0 );
	SendMessage( script, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG( 10, 10 ) );
	int i;
	for( i = 0; i < wrapper->GetVariableDict().GetNumKeyVals( ); i ++ ) {
		const idKeyValue *key = wrapper->GetVariableDict().GetKeyVal( i );
		SendMessage( script, EM_SETSEL, -1, -1 );
		SendMessage( script, EM_REPLACESEL, FALSE, ( LPARAM )key->GetKey().c_str() );
		SendMessage( script, EM_SETSEL, -1, -1 );
		SendMessage( script, EM_REPLACESEL, FALSE, ( LPARAM )"\t" );
		SendMessage( script, EM_SETSEL, -1, -1 );
		SendMessage( script, EM_REPLACESEL, FALSE, ( LPARAM )key->GetValue().c_str() );
		SendMessage( script, EM_SETSEL, -1, -1 );
		SendMessage( script, EM_REPLACESEL, FALSE, ( LPARAM )"\r\n" );
	}
	if( i ) {
		SendMessage( script, EM_SETSEL, -1, -1 );
		SendMessage( script, EM_REPLACESEL, FALSE, ( LPARAM )"\r\n" );
	}
	for( i = 0; i < wrapper->GetScriptDict().GetNumKeyVals( ); i ++ ) {
		const idKeyValue *key = wrapper->GetScriptDict().GetKeyVal( i );
		SendMessage( script, EM_SETSEL, -1, -1 );
		SendMessage( script, EM_REPLACESEL, FALSE, ( LPARAM )va( "%s\r\n", key->GetKey().c_str() ) );
		SendMessage( script, EM_SETSEL, -1, -1 );
		SendMessage( script, EM_REPLACESEL, FALSE, ( LPARAM )key->GetValue().c_str() );
		SendMessage( script, EM_SETSEL, -1, -1 );
		SendMessage( script, EM_REPLACESEL, FALSE, ( LPARAM )"\r\n\r\n" );
	}
	SendMessage( script, EM_SETSEL, 0, 0 );
	SendMessage( script, EM_SCROLLCARET, 0, 0 );
	return true;
}
Example #16
0
//=============================================================================
// Toggle window or fullscreen mode
// Pre: All user created D3DPOOL_DEFAULT surfaces are freed.
// Post: All user surfaces are recreated.
//=============================================================================
void Graphics::changeDisplayMode(graphicsNS::DISPLAY_MODE mode)
{
    try{
        switch(mode)
        {
        case graphicsNS::FULLSCREEN:
            if(fullscreen)      // if already in fullscreen mode
                return;
            fullscreen = true; break;
        case graphicsNS::WINDOW:
            if(fullscreen == false) // if already in window mode
                return;
            fullscreen = false; break;
        default:        // default to toggle window/fullscreen
            fullscreen = !fullscreen;
        }
        reset();
        if(fullscreen)  // fullscreen
        {
            SetWindowLong(hwnd, GWL_STYLE,  WS_EX_TOPMOST | WS_VISIBLE | WS_POPUP);
        }
        else            // windowed
        {
            SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
            SetWindowPos(hwnd, HWND_TOP, 0,0,GAME_WIDTH,GAME_HEIGHT,
                SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);

            // Adjust window size so client area is GAME_WIDTH x GAME_HEIGHT
            RECT clientRect;
            GetClientRect(hwnd, &clientRect);   // get size of client area of window
            MoveWindow(hwnd,
                       0,                                           // Left
                       0,                                           // Top
                       GAME_WIDTH+(GAME_WIDTH-clientRect.right),    // Right
                       GAME_HEIGHT+(GAME_HEIGHT-clientRect.bottom), // Bottom
                       TRUE);                                       // Repaint the window
        }

    } catch(...)
    {
        // An error occured, try windowed mode 
        SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
        SetWindowPos(hwnd, HWND_TOP, 0,0,GAME_WIDTH,GAME_HEIGHT,
            SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);

        // Adjust window size so client area is GAME_WIDTH x GAME_HEIGHT
        RECT clientRect;
        GetClientRect(hwnd, &clientRect);   // get size of client area of window
        MoveWindow(hwnd,
                    0,                                           // Left
                    0,                                           // Top
                    GAME_WIDTH+(GAME_WIDTH-clientRect.right),    // Right
                    GAME_HEIGHT+(GAME_HEIGHT-clientRect.bottom), // Bottom
                    TRUE);                                       // Repaint the window
    }
}
/* OnInitDone
 * ----------------------------------------------------------------------------
 */
void CFolderDialog::OnInitDone()
{
    HideControl(stc2);
    HideControl(cmb1);

    CWnd* pFD = GetParent();

    LCID lcid = GetSystemDefaultLCID();

    switch(PRIMARYLANGID(LANGIDFROMLCID(lcid)))
    {
    default:
    case LANG_ENGLISH:
        SetControlText(stc3, "Folder:");
        SetControlText(IDOK, "&Select");
        pFD->SetWindowText("Select Folder");
        break;

    case LANG_GERMAN:
        SetControlText(stc3, "Verzeichnis:");
        SetControlText(IDOK, "&Auswahl");
        pFD->SetWindowText("Verzeichnis auswählen");
        break;
    }

    SetControlText(edt1, m_sSelPath);

    CRect rStatic;
    pFD->GetDlgItem(stc3)->GetWindowRect(rStatic);
    pFD->ScreenToClient(rStatic);
    rStatic.right -= 10;
    pFD->GetDlgItem(stc3)->SetWindowPos(0, 0, 0, rStatic.Width(), rStatic.Height(), SWP_NOMOVE | SWP_NOZORDER);

    CRect rectCancel;
    pFD->GetDlgItem(IDCANCEL)->GetWindowRect(rectCancel);
    pFD->ScreenToClient(rectCancel);

    CRect rectOK;
    pFD->GetDlgItem(IDOK)->GetWindowRect(rectOK);
    pFD->ScreenToClient(rectOK);
    pFD->GetDlgItem(IDOK)->SetWindowPos(0,rectCancel.left - rectOK.Width() - 4, rectCancel.top, 0,0, SWP_NOZORDER | SWP_NOSIZE);

    CRect rList;
    pFD->GetDlgItem(lst1)->GetWindowRect(rList);
    pFD->ScreenToClient(rList);

    CRect rEdit;
    pFD->GetDlgItem(edt1)->GetWindowRect(rEdit);
    pFD->ScreenToClient(rEdit);
    rEdit.left = rStatic.right + 10;
    pFD->GetDlgItem(edt1)->SetWindowPos(0, rEdit.left, rEdit.top, rList.right - rEdit.left, rEdit.Height(), SWP_NOZORDER);

    m_fpWndProcDiag = (WNDPROC)SetWindowLong(pFD->m_hWnd, GWL_WNDPROC, (long)WindowProcDiag);
    m_fpWndProcEdit = (WNDPROC)SetWindowLong(pFD->GetDlgItem(edt1)->m_hWnd, GWL_WNDPROC, (long)WindowProcEdit);
}
Example #18
0
// =============================================
// CallbackSelectDir
// 概要  : フォルダ参照で使用するコールバック関数
//       : 開いたときにフォルダを選択した状態で開かせる処理をする場合に必要
// 引数  : ...
// 戻り値: int CALLBACK
// =============================================
int CALLBACK CSHBrowseForFolder::CallbackSelectDir(HWND hWnd, UINT uMsg, LPARAM, LPARAM lpData)
{
	if (uMsg == BFFM_INITIALIZED) {
		// デフォルトのフォルダを選択させる
		SendMessage(hWnd, BFFM_SETSELECTION, (WPARAM)TRUE, lpData);
		{
			// フォルダーツリーで常に選択状態を表示
			HWND hwndTree = FindWindowEx(hWnd, NULL, "SysTreeView32", NULL);
			if (hwndTree != NULL) {
				LONG style;
				style = GetWindowLong(hwndTree, GWL_STYLE);
				style |= TVS_SHOWSELALWAYS;
				SetWindowLong(hwndTree, GWL_STYLE, style);
			}
		}

		// [サブディレクトリを検索] ボタンを追加
		if (GetEnableSubDirButton()) {
			pSubDir = new CButton; /* WildCherry2 080 */
			if (pSubDir) {
				RECT	rectClient, rectOK, rectCancel, rect;
				CWnd	*pClient	= CWnd::FromHandle(hWnd);
				CWnd	*pOK		= pClient->GetDlgItem(IDOK);
				CWnd	*pCANCEL	= pClient->GetDlgItem(IDCANCEL);
				// クライアントウィンドウサイズを取得
				pClient->GetClientRect(&rectClient);
				// [OK] / [CANCEL] のウィンドウ位置を取得
				pOK->GetWindowRect(&rectOK);
				pCANCEL->GetWindowRect(&rectCancel);
				pClient->ScreenToClient(&rectOK) ;
				pClient->ScreenToClient(&rectCancel) ;
				// サブディレクトリ対象チェックボタンの RECT を求める
				rect = CRect(rectClient.right - rectCancel.right,
				             rectCancel.top,
				             rectOK.left,
				             rectCancel.bottom);
				// チェックボタン作成
				if (pSubDir->Create(GetCheckBoxTitle(),
				                    WS_CHILD | WS_VISIBLE | BS_CHECKBOX | WS_TABSTOP,
				                    rect, pClient, IDC_CH_SUB_DIR)) {
					// フォントを設定
					HFONT hFontCurr = (HFONT)pClient->SendMessage(WM_GETFONT, 0, 0);
					if (hFontCurr != NULL) pSubDir->PostMessage(WM_SETFONT, (WPARAM)hFontCurr, 0); 

					// チェック状態を設定
					pSubDir->SetCheck(GetSearchSubDirState() ? TRUE : FALSE);

					// サブクラス化
					m_VSSelectOrgProc = (WNDPROC)SetWindowLong(hWnd, GWL_WNDPROC, (LONG)VSSelectFolderSubProc);
				}
			}
		}
	}
	return 0;
}
int PropertySheetUI::runModal(HINSTANCE hInstance, HWND hParent, LPWSTR pCaption)
{	
	MSG msg;	
	m_pages = _buildPageArray();	
		
	m_nRslt = IDCANCEL;
		
	memset (&m_psh, 0, sizeof(PROPSHEETHEADER));		
		
	m_psh.dwSize = sizeof(PROPSHEETHEADER);
	m_psh.dwFlags = PSH_PROPSHEETPAGE | PSH_WIZARD;
	m_psh.hwndParent = hParent;
	m_psh.hInstance = hInstance;
	m_psh.hIcon = NULL;
	m_psh.pszIcon = NULL;	
	m_psh.nPages = m_vecPages.size();
    m_psh.nStartPage = 0;
	m_psh.ppsp = (LPCPROPSHEETPAGE) m_pages;
	m_psh.pfnCallback = m_pCallback;    
    
	if (m_pCallback)
		m_psh.dwFlags |= PSH_USECALLBACK;    	
    
	if (!m_bApplyButton)
		m_psh.dwFlags |= PSH_NOAPPLYNOW;
    
	m_psh.pszCaption = pCaption;
	m_psh.dwFlags |= PSH_MODELESS;	
	m_hWnd = (HWND)::PropertySheet(&m_psh);
	EnableWindow(m_psh.hwndParent, FALSE);

	// Set buttons for first page after creation
	PropertyPageUI* pPage = m_vecPages.at(0);
	pPage->_sendSetButtonsMessage();

	/* Subclassing */
	m_lpfnDefSheet = (WHICHPROC)GetWindowLong(m_hWnd, GWL_WNDPROC);
	SetWindowLong(m_hWnd, GWL_USERDATA, (LONG)this);	
	SetWindowLong(m_hWnd, GWL_WNDPROC, (LONG)m_pfnDlgProc);
		
	_onInitDialog();

	while (GetMessage(&msg, NULL, 0, 0))
	{				
		if(m_hWnd && PropSheet_IsDialogMessage(m_hWnd, &msg))
			continue;				
					
		TranslateMessage(&msg);
		DispatchMessage(&msg);		
	}	
	
	destroy();	
	return m_nRslt;
}
Example #20
0
void GButton::OnAttach()
{
	#ifdef SKIN_MAGIC

	d->ButtonClassProc = GetWindowLong(Handle(), GWL_WNDPROC);
	SetWindowLong(Handle(), GWL_WNDPROC, (DWORD)GWin32Class::Redir);
	SetWindowLong(Handle(), GWL_USERDATA, (DWORD)(GViewI*)this);

	#endif

	SetFont(SysFont);
}
Example #21
0
static LRESULT CALLBACK IEViewWindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
    IEView *view = IEView::get(hwnd);
    if (view!=NULL) {
        WNDPROC oldWndProc = view->getUserWndProc();
        if (message == WM_PARENTNOTIFY && wParam == WM_CREATE) {
            SetWindowLong(hwnd, GWL_WNDPROC, (LONG) oldWndProc);
            view->setUserWndProc((WNDPROC) SetWindowLong((HWND)lParam, GWL_WNDPROC, (LONG) IEViewDocWindowProcedure));
        }
        return CallWindowProc(oldWndProc, hwnd, message, wParam, lParam);
    }
    return DefWindowProc (hwnd, message, wParam, lParam);
}
Example #22
0
void WINAPI showCfgDlg()
{
  lpWndProcOld = (void *) SetWindowLong(hMainWindow,DWL_DLGPROC,(long)ParentWndProc);

  // Tell NSIS to remove old inner dialog and pass handle of the new inner dialog
  mySendMessage(hMainWindow, WM_NOTIFY_CUSTOM_READY, (WPARAM)hConfigWindow, 0);
  ShowWindow(hConfigWindow, SW_SHOWNA);

  g_done = g_NotifyField = 0;

  while (!g_done) {
    MSG msg;
    int nResult = GetMessage(&msg, NULL, 0, 0);
    if (!IsDialogMessage(hConfigWindow,&msg) && !IsDialogMessage(hMainWindow,&msg) && !TranslateMessage(&msg))
      DispatchMessage(&msg);
  }

  // we don't save settings on cancel since that means your installer will likely
  // quit soon, which means the ini might get flushed late and cause crap. :) anwyay.
  if (!g_is_cancel) SaveSettings();

  if (lpWndProcOld)
    SetWindowLong(hMainWindow,DWL_DLGPROC,(long)lpWndProcOld);
  DestroyWindow(hConfigWindow);

  // by ORTIM: 13-August-2002
  if (bCancelShow!=-1) ShowWindow(hCancelButton,old_cancel_visible?SW_SHOWNA:SW_HIDE);

  FREE(pFilenameStackEntry);
  FREE(pszTitle);
  FREE(pszCancelButtonText);
  FREE(pszNextButtonText);
  FREE(pszBackButtonText);

  int i = nNumFields;
  while (i--) {
    FieldType *pField = pFields + i;
    FREE(pField->pszText);
    FREE(pField->pszState);
    FREE(pField->pszListItems);
    FREE(pField->pszFilter);
    FREE(pField->pszRoot);
    if (pField->nType == FIELD_BITMAP) {
      DeleteObject(pField->hImage);
    }
    if (pField->nType == FIELD_ICON) {
      DestroyIcon((HICON)pField->hImage);
    }
  }
  FREE(pFields);

  pushstring(g_is_cancel?"cancel":g_is_back?"back":"success");
}
Example #23
0
BOOL COptionsWnd::GeneralSheetDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_INITDIALOG:
		{
			m_hGeneralSheet = hwnd;
			GeneralOnInit();

			return TRUE;
		}
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDC_CHOOSE_SOUND:
			GeneralOnChooseSound();
			break;

		case IDC_PlAY_SOUND:
			GeneralOnPlayFile();
			break;

		case IDC_STOP_SOUND:
			GeneralOnStopFile();
			break;
		}
		break;

		case WM_NOTIFY:
			switch (((NMHDR*) lParam)->code)
			{
			case PSN_KILLACTIVE:
				{
					SetWindowLong(hwnd, DWL_MSGRESULT, FALSE);
				}

				return TRUE;
				break;

			case PSN_APPLY:
				GeneralOnExit();
				SetWindowLong(m_hGeneralSheet, DWL_MSGRESULT, FALSE);
				break;
			}
			break;
	}

	return FALSE;
}
Example #24
0
void update_border (HWND displayWnd, int showborder)
{
	if (GLOBAL.locksession) {
		 if (showborder)
		    SetWindowLong(displayWnd, GWL_STYLE, GetWindowLong(displayWnd, GWL_STYLE)& ~(WS_SIZEBOX) | (WS_CAPTION));
		 else 
 		    SetWindowLong(displayWnd, GWL_STYLE, GetWindowLong(displayWnd, GWL_STYLE)& ~(WS_SIZEBOX+WS_CAPTION+WS_THICKFRAME));
	} else {
		 if (showborder)
			  SetWindowLong(displayWnd, GWL_STYLE, GetWindowLong(displayWnd, GWL_STYLE) | (WS_SIZEBOX+WS_CAPTION));
		 else 
 		    SetWindowLong(displayWnd, GWL_STYLE, GetWindowLong(displayWnd, GWL_STYLE)& ~(WS_CAPTION+WS_THICKFRAME) | WS_SIZEBOX);
	}
}
Example #25
0
UINT CShellContextMenu::ShowContextMenu(HWND hWnd, CPoint pt)
{
	int iMenuType = 0;	// to know which version of IContextMenu is supported
	LPCONTEXTMENU pContextMenu;	// common pointer to IContextMenu and higher version interface

	if(!GetContextMenu((LPVOID*)&pContextMenu, iMenuType))	
		return 0;	// something went wrong

	if(!m_Menu)
	{
		delete m_Menu;
		m_Menu = NULL;
		m_Menu = new CMenu;
		m_Menu->CreatePopupMenu();
	}

	// lets fill the popupmenu 
	pContextMenu->QueryContextMenu(m_Menu->m_hMenu, m_Menu->GetMenuItemCount(), ID_SHELLCONTEXTMENU_MIN, ID_SHELLCONTEXTMENU_MAX, CMF_NORMAL | CMF_EXPLORE);

	// subclass window to handle menurelated messages in CShellContextMenu 
	WNDPROC OldWndProc;
	if(iMenuType > 1)	// only subclass if its version 2 or 3
	{
		OldWndProc = (WNDPROC) SetWindowLong(hWnd, GWL_WNDPROC, (DWORD) HookWndProc);
		if(iMenuType == 2)
			g_IContext2 = (LPCONTEXTMENU2) pContextMenu;
		else	// version 3
			g_IContext3 = (LPCONTEXTMENU3) pContextMenu;
	}
	else
		OldWndProc = NULL;

	UINT idCommand = m_Menu->TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN, pt.x, pt.y, hWnd);

	if(OldWndProc) // unsubclass
		SetWindowLong(hWnd, GWL_WNDPROC, (DWORD) OldWndProc);

	if(idCommand >= ID_SHELLCONTEXTMENU_MIN && idCommand <= ID_SHELLCONTEXTMENU_MAX)
	{
		InvokeCommand(pContextMenu, idCommand - ID_SHELLCONTEXTMENU_MIN);
		idCommand = 0;
	}

	pContextMenu->Release();
	g_IContext2 = NULL;
	g_IContext3 = NULL;

	return idCommand;
}
Example #26
0
/// register zero size window with TouchPanelRegisterWindow
/// set zero size window extra memory with TOUCH_SEND_TO_SYSTEM
/// using SetWindowLong(hWnd, 0, x) sets the DWL_MSGRESULT of the window
/// DWL_MSGRESULT: Sets the return value of a message processed in the dialog box procedure
void HookTouchPanel(bool bHook) {
    if (HookTouchPanelStatus == bHook) {
        LOGDEBUG(L"HookTouchPanel nothing to do");
        return;
    }
    LOGDEBUG(L"HookTouchPanel");
    HookTouchPanelStatus = bHook;

    if (!lazyInitialized) {
        lazyInitialized = true;
        SetWindowLong(m_LockedWindow, 0, TOUCH_SEND_TO_SYSTEM);
        //SetWindowPos(m_LockedWindow, HWND_BOTTOM, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW);
    }

    if (bHook && !touchPanelWindowRegistered) {
        touchPanelWindowRegistered = true;
        BOOL result = m_fpTouchRegisterWindow(m_LockedWindow);
        if (!result) {
            LOGERROR(L"Error in registering m_LockedWindow");
        } else {
            LOGDEBUG(L"TouchRegisterWindow Ok");
        }
    }

    SetLastError(0);
    LONG nNew;
    if(bHook)
        nNew = TOUCH_SEND_TO_WINDOW;
    else
        nNew = TOUCH_SEND_TO_SYSTEM;
    ///LONG nNew = bHook ? TOUCH_SEND_TO_WINDOW : TOUCH_SEND_TO_SYSTEM;
    LONG prevNew = GetWindowLong(m_LockedWindow, 0); //read DLG_MSG_RESULT
    if (prevNew != nNew) { ///if not equal, try a second time to register window
        LONG setResult = SetWindowLong(m_LockedWindow, 0, nNew);
        if (setResult == 0) {
            LOGERROR(L"Error in SetWindowLong");
        } else {
            LOGDEBUG(L"SetWindowLong result");
            //SetWindowPos(m_LockedWindow, HWND_BOTTOM, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW);
        }
    }

    //unregister wanted?
    if (!bHook && touchPanelWindowRegistered) {
        touchPanelWindowRegistered = false;
        m_fpTouchUnregisterWindow(m_LockedWindow);
        LOGDEBUG(L"TouchUnregisterWindow done");
    }
}
FramelessDialog::FramelessDialog(QWidget * parent)
    : QDialog(parent),
    wrapper(nullptr),
    bIsFramelessSetup(false)
{
    pfOriginalFramelessdialogProc = (WNDPROC)SetWindowLong((HWND)winId(), GWL_WNDPROC, (long)FramelessDialogProc);

    wndProcMap.insert(std::make_pair((HWND)winId(), pfOriginalFramelessdialogProc));

    this->setWindowFlags(Qt::WindowCloseButtonHint | Qt::FramelessWindowHint);
    DWORD style = GetWindowLong((HWND)winId(), GWL_STYLE);
    //style |= WS_CAPTION;
    //style |= WS_SYSMENU;
    SetWindowLong((HWND)winId(), GWL_STYLE, style);
};
Example #28
0
//
//  FUNCTION: CreateNativeWindow()
//
//  PURPOSE: Creates a new browser dialog.
//
//  COMMENTS:
//
//    This function loads the browser dialog from a resource template
//    and returns the HWND for the webbrowser container dialog item
//    to the caller.
//
nativeWindow WebBrowserChromeUI::CreateNativeWindow(nsIWebBrowserChrome* chrome)
{
  // Load the browser dialog from resource
  HWND hwndDialog;
  PRUint32 chromeFlags;

  chrome->GetChromeFlags(&chromeFlags);
  if ((chromeFlags & nsIWebBrowserChrome::CHROME_ALL) == nsIWebBrowserChrome::CHROME_ALL)
    hwndDialog = CreateDialog(ghInstanceResources,
                              MAKEINTRESOURCE(IDD_BROWSER),
                              NULL,
                              BrowserDlgProc);
  else
    hwndDialog = CreateDialog(ghInstanceResources,
                              MAKEINTRESOURCE(IDD_BROWSER_NC),
                              NULL,
                              BrowserDlgProc);
  if (!hwndDialog)
    return NULL;

  // Stick a menu onto it
  if (chromeFlags & nsIWebBrowserChrome::CHROME_MENUBAR) {
    HMENU hmenuDlg = LoadMenu(ghInstanceResources, MAKEINTRESOURCE(IDC_WINEMBED));
    SetMenu(hwndDialog, hmenuDlg);
  } else
    SetMenu(hwndDialog, 0);

  // Add some interesting URLs to the address drop down
  HWND hwndAddress = GetDlgItem(hwndDialog, IDC_ADDRESS);
  if (hwndAddress) {
    for (int i = 0; i < sizeof(gDefaultURLs) / sizeof(gDefaultURLs[0]); i++)
    {
      SendMessage(hwndAddress, CB_ADDSTRING, 0, (LPARAM) gDefaultURLs[i]);
    }
  }

  // Fetch the browser window handle
  HWND hwndBrowser = GetDlgItem(hwndDialog, IDC_BROWSER);
  SetWindowLong(hwndBrowser, GWL_USERDATA, (LONG)chrome);  // save the browser LONG_PTR.
  SetWindowLong(hwndBrowser, GWL_STYLE, GetWindowLong(hwndBrowser, GWL_STYLE) | WS_CLIPCHILDREN);

  // Activate the window
  PostMessage(hwndDialog, WM_ACTIVATE, WA_ACTIVE, 0);

  gDialogCount++;

  return hwndBrowser;
}
Example #29
0
BOOL CALLBACK upsStatus::DialogProc(
   HWND hwnd,
   UINT uMsg,
   WPARAM wParam,
   LPARAM lParam)
{
   upsStatus *_this;

   // Retrieve virtual 'this' pointer. When we come in here the first time for
   // the WM_INITDIALOG message, the pointer is in lParam. We then store it in
   // the user data so it can be retrieved on future calls.
   if (uMsg == WM_INITDIALOG)
   {
      // Set dialog user data to our "this" pointer which comes in via lParam.
      // On subsequent calls, this will be retrieved by the code below.
      SetWindowLong(hwnd, GWL_USERDATA, lParam);
      _this = (upsStatus *)lParam;
   }
   else
   {
      // We've previously been initialized, so retrieve pointer from user data
      _this = (upsStatus *)GetWindowLong(hwnd, GWL_USERDATA);
   }

   // Call thru to non-static member function
   return _this->DialogProcess(hwnd, uMsg, wParam, lParam);
}
Example #30
0
/* GetWindowLong(hwnd, 4) must be available for use */
BOOL
PrintSize(HDC printer, HWND hwnd, LPRECT lprect)
{
    HDC hdc;
    BOOL status = FALSE;
    GP_PRINT pr;

    SetWindowLongPtr(hwnd, 4, (LONG_PTR)&pr);
    pr.poff.x = 0;
    pr.poff.y = 0;
    pr.psize.x = GetDeviceCaps(printer, HORZSIZE);
    pr.psize.y = GetDeviceCaps(printer, VERTSIZE);
    hdc = GetDC(hwnd);
    GetClientRect(hwnd,lprect);
    pr.pdef.x = MulDiv(lprect->right-lprect->left, 254, 10*GetDeviceCaps(hdc, LOGPIXELSX));
    pr.pdef.y = MulDiv(lprect->bottom-lprect->top, 254, 10*GetDeviceCaps(hdc, LOGPIXELSX));
    ReleaseDC(hwnd,hdc);

    if (DialogBox (hdllInstance, "PrintSizeDlgBox", hwnd, PrintSizeDlgProc)
	== IDOK)
	{
	    lprect->left = MulDiv(pr.poff.x*10, GetDeviceCaps(printer, LOGPIXELSX), 254);
	    lprect->top = MulDiv(pr.poff.y*10, GetDeviceCaps(printer, LOGPIXELSY), 254);
	    lprect->right = lprect->left + MulDiv(pr.psize.x*10, GetDeviceCaps(printer, LOGPIXELSX), 254);
	    lprect->bottom = lprect->top + MulDiv(pr.psize.y*10, GetDeviceCaps(printer, LOGPIXELSY), 254);
	    status = TRUE;
	}
    SetWindowLong(hwnd, 4, (LONG)(0L));

    return status;
}