Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    54
    Rep Power
    2
    Originally Posted by BobS0327
    One option is to use AdjustWindowRectEx to manipulate the size of your target window.

    You can also use the above Win32 API call to address your fullscreen window issue.
    This OS programming is above my education level at the moment.

    Could you give me an example of using AdjustWindowRectEx?

    And, what Win32 API call are you talking about?
    Thanks.

    I just need a little bit of code that has not GUI or buttons.

    All it does is I will place it in my secondapp.exe and it will execute when that app executes, and it will automatically window the fullscreen firstapp.exe.

    This is all I need. I'd like the window size to be: 924 x 650
    Last edited by pditty8811; January 16th, 2014 at 10:52 PM.
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    187
    Rep Power
    82
    Could you give me an example of using AdjustWindowRectEx?
    Nope. But I'll post an equivalent example as follows...

    Code:
    #pragma comment(lib,"gdi32.lib")
    #pragma comment(lib,"user32.lib")
    #include <windows.h>
    
    void WindowResize(HWND hWnd, int nWidth, int nHeight)
    {
        RECT rcClient, rcWindow;
        POINT pointDifference;
        GetClientRect(hWnd, &rcClient);
        GetWindowRect(hWnd, &rcWindow);
        pointDifference.x = (rcWindow.right - rcWindow.left) - rcClient.right;
        pointDifference.y = (rcWindow.bottom - rcWindow.top) - rcClient.bottom;
        MoveWindow(hWnd,rcWindow.left, rcWindow.top, nWidth + pointDifference.x, nHeight + pointDifference.y, TRUE);
    }
    
    BOOL CALLBACK EnumWindowsProc( HWND hwnd, LONG lParam )
    {
        DWORD dwStyle = GetWindowLongPtr( hwnd, GWL_STYLE ) ;
        DWORD dwExStyle = GetWindowLongPtr( hwnd, GWL_EXSTYLE ) ;
        TCHAR buffer[512] = {0};
        SendMessage(hwnd,WM_GETTEXT,sizeof(buffer), (LPARAM)(void*)buffer);
        if(strcmp(buffer, "Window1") == 0)
        {
            WindowResize(hwnd, 924, 650);
            SetForegroundWindow(hwnd);
            UpdateWindow(hwnd);
        }
        return TRUE;
    }
    
    int main(void)
    {
        EnumWindows(EnumWindowsProc, NULL);
        return 0;
    }
    I just need a little bit of code that has not GUI or buttons.
    It's posted above.
  4. #18
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    54
    Rep Power
    2
    Originally Posted by BobS0327
    Nope. But I'll post an equivalent example as follows...

    Code:
    #pragma comment(lib,"gdi32.lib")
    #pragma comment(lib,"user32.lib")
    #include <windows.h>
    
    void WindowResize(HWND hWnd, int nWidth, int nHeight)
    {
        RECT rcClient, rcWindow;
        POINT pointDifference;
        GetClientRect(hWnd, &rcClient);
        GetWindowRect(hWnd, &rcWindow);
        pointDifference.x = (rcWindow.right - rcWindow.left) - rcClient.right;
        pointDifference.y = (rcWindow.bottom - rcWindow.top) - rcClient.bottom;
        MoveWindow(hWnd,rcWindow.left, rcWindow.top, nWidth + pointDifference.x, nHeight + pointDifference.y, TRUE);
    }
    
    BOOL CALLBACK EnumWindowsProc( HWND hwnd, LONG lParam )
    {
        DWORD dwStyle = GetWindowLongPtr( hwnd, GWL_STYLE ) ;
        DWORD dwExStyle = GetWindowLongPtr( hwnd, GWL_EXSTYLE ) ;
        TCHAR buffer[512] = {0};
        SendMessage(hwnd,WM_GETTEXT,sizeof(buffer), (LPARAM)(void*)buffer);
        if(strcmp(buffer, "Window1") == 0)
        {
            WindowResize(hwnd, 924, 650);
            SetForegroundWindow(hwnd);
            UpdateWindow(hwnd);
        }
        return TRUE;
    }
    
    int main(void)
    {
        EnumWindows(EnumWindowsProc, NULL);
        return 0;
    }
    It's posted above.
    Wow, you're amazing. Sorry for the long delay in responding. I've been going to school full time and I have 2 jobs. But now I have some free time I'm back on my project.

    Can you create another app that can do the exact opposite, without a GUI? From windowed mode to fullscreen?
    Thank you.
  6. #19
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    54
    Rep Power
    2
    Originally Posted by pditty8811
    Wow, you're amazing. Sorry for the long delay in responding. I've been going to school full time and I have 2 jobs. But now I have some free time I'm back on my project.

    Can you create another app that can do the exact opposite, without a GUI? From windowed mode to fullscreen?
    Thank you.
    I am still unable to create a window from a fullscreen window. I can adjust a window to a different size, but unable to window a fullscreen app.
  8. #20
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    187
    Rep Power
    82
    Well, I'm not going to write any code for you. But I will give you a starting point. One way to maximize a window is to call GetSytemMetrics twice. Once using the SM_CXFULLSCREEN parm and the second call using the SM_CYFULLSCREEN parm.
  10. #21
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    54
    Rep Power
    2
    Originally Posted by BobS0327
    Well, I'm not going to write any code for you. But I will give you a starting point. One way to maximize a window is to call GetSytemMetrics twice. Once using the SM_CXFULLSCREEN parm and the second call using the SM_CYFULLSCREEN parm.
    I'm also having trouble getting it to windowed from fullscreen. It is a 3d application.
    I've been using Qt, and its QWindow class, but all I can do is minimize it and then launch back to fullscreen. I can only change the window size if the 3d app is ran in windowed mode from beginning (in 3d app settings). I'd like to be able to go to windowed from fullscreen while the 3d app is running.
  12. #22
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    54
    Rep Power
    2
    Any little bit of your help would be appreciated. This OS programming is a bit complex for me. It has types that I don't understand.
  14. #23
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    187
    Rep Power
    82
    Originally Posted by pditty8811
    Any little bit of your help would be appreciated. This OS programming is a bit complex for me. It has types that I don't understand.
    Code:
    #include <windows.h>
    #include <stdio.h>
    
    int main(void)
    {
        int iScreenWidth  = GetSystemMetrics (SM_CXFULLSCREEN);
        int	iScreenHeight = GetSystemMetrics (SM_CYFULLSCREEN);
        printf("Desktop height: %d   desktop width: %d\n", iScreenHeight, iScreenWidth);
        return 0;
    }

    OK, where do you think the iScreenHeight and iScreenWidth variables should be used in the previously posted code that does the window resizing?
  16. #24
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    54
    Rep Power
    2
    Originally Posted by BobS0327
    Code:
    #include <windows.h>
    #include <stdio.h>
    
    int main(void)
    {
        int iScreenWidth  = GetSystemMetrics (SM_CXFULLSCREEN);
        int	iScreenHeight = GetSystemMetrics (SM_CYFULLSCREEN);
        printf("Desktop height: %d   desktop width: %d\n", iScreenHeight, iScreenWidth);
        return 0;
    }

    OK, where do you think the iScreenHeight and iScreenWidth variables should be used in the previously posted code that does the window resizing?
    Insert as arguments for:
    Code:
    void WindowResize(HWND hWnd, int nWidth, int nHeight
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo