Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 74889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:25:44+00:00 2026-05-10T20:25:44+00:00

I am developing an application for pocket PC which should run in landscape mode.

  • 0

I am developing an application for pocket PC which should run in landscape mode.

I wrote the function SetScreenOrientation(int angle), which rotates the screen. This function is called on application start and on application close. I want to change the screen orientation when I minimize/maximize orientation as well. To do this I edited the following function:

void CMainFrame::OnSize(UINT nType, int cx, int cy) {     RECT r;     GetWindowRect(&r);      RECT rstatus;     rstatus.left = 0;     rstatus.top = 0;     rstatus.right = r.right;     rstatus.bottom = TOOLBAR_HEIGHT;     m_wndStatus.MoveWindow(&rstatus, TRUE);      RECT rcamera;     rcamera.left = 0;     rcamera.top = 0;     rcamera.right = r.right;     rcamera.bottom = r.bottom - TOOLBAR_HEIGHT;     m_wndCameraView.MoveWindow(&rcamera, TRUE);      if(nType == SIZE_MAXIMIZED)     {         CScreenOrientation::SetScreenOrientation(270);     }     if(nType == SIZE_MINIMIZED)     {         CScreenOrientation::SetScreenOrientation(0);     } } 

The problem is that when I minimize the application the function is executed more than once so the screen first rotates back to 0 degrees and then it rotates to 270 degrees.

While debugging I can see that the second time the function is executed the following piece of wincore code is executed:

BOOL CWnd::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult) { ... switch (lpEntry->nSig)     { ... case AfxSig_v_u_ii:         (this->*mmf.pfn_v_u_i_i)(static_cast<UINT>(wParam), LOWORD(lParam), HIWORD(lParam));         break; ... } } 

Does anyone know any other way to set the screen orientation on application minimize/maximize or any trick that could prevent multiple function execution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:25:45+00:00Added an answer on May 10, 2026 at 8:25 pm

    For one thing, it seems likely that SetScreenOrientation is going to give you another OnSize notification, so you want to detect recursive calls and do nothing when that happens.

    More importantly, how do you know what orientation the user really wants? When your application starts up you can check the orientation and save that. But if the user changed the orientation while you happened to be running, they won’t be happy when you change it back. Maybe you can check notifications of system settings changes and detect if the user changed the orientation themselves.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The difference between Cygwin and MinGW is the the Cygwin… May 11, 2026 at 11:33 pm
  • Editorial Team
    Editorial Team added an answer This should do it. Added additional level to hold the… May 11, 2026 at 11:33 pm
  • Editorial Team
    Editorial Team added an answer I haven't tested this code out, but I suspect your… May 11, 2026 at 11:33 pm

Related Questions

I am developing an application for PocketPC. When the application starts the custom function
I am developing an application in C#, using the server-client model, where the server
I am developing an application for video capture and I would like to implement
I am developing an application for the Mac as a small team (me +

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.