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 537217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:54:13+00:00 2026-05-13T09:54:13+00:00

Its a little strange. Ok so I am working with OGRE game engine which

  • 0

Its a little strange. Ok so I am working with OGRE game engine which has a “SceneManager” class which keeps some files streams open in background. If i use those streams just BEFORE using GetOpenFileName() those streams work fine, but if I try to use those streams AFTER GetOpenFileName() those strams are found to be closed. Can someone throw some light why GetOpenFileName() is killing my background streams?

String Submerge::showFileDialog(char* filters, bool savedialog, char* title)
// need to tweak flags for open/save
{
OPENFILENAME ofn ;
char szFile[255] ;
HWND hwnd = NULL;
//getOgre()->getAutoCreatedWindow()->getCustomAttribute("WINDOW", &hwnd);

ZeroMemory( &ofn , sizeof(ofn) );
ofn.hwndOwner = hwnd;
ofn.lStructSize = sizeof ( ofn );
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof( szFile );
ofn.lpstrFilter = filters ? filters : "All files\0*.*\0";
ofn.nFilterIndex =1;
ofn.lpstrFileTitle = NULL ;
ofn.nMaxFileTitle = 0 ;
ofn.lpstrInitialDir=NULL ;
if(title!=NULL)
    ofn.lpstrTitle=title;
//ofn.Flags = OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST ;

MeshLoadTest(); // this is where i use background file streams
bool success = false;
if(savedialog)
    success = GetSaveFileName( &ofn );
else
    success = GetOpenFileName( &ofn );
MeshLoadTest(); // this is where i use background file streams

if(!success)
    return "";
String str;
str.append(ofn.lpstrFile);
return str;
return "";
}
  • 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. Editorial Team
    Editorial Team
    2026-05-13T09:54:13+00:00Added an answer on May 13, 2026 at 9:54 am

    Note that GetOpenFileName() can and will change the current directory of your whole process. This might be interfering with whatever else you have going on.

    There is an option called OFN_NOCHANGEDIR, but according to the documentation, it’s ineffective:

    Restores the current directory to its original value if the user changed the directory while searching for files.
    Windows NT 4.0/2000/XP: This flag is ineffective for GetOpenFileName.

    You should check the current directory before and after making this call; if it changes then this may be your problem. In that case, add code to save and restore the current directory around the call to GetOpenFileName().

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

Sidebar

Related Questions

I'm using a std::map (VC++ implementation) and it's a little slow for lookups via
I currently use the following command, but it's a little unwieldy to type. What's
I'm using IPAddress.TryParse() to parse IP addresses. However, it's a little too permissive (parsing
It's been a while since I last coded arm assembler and I'm a little
I'm having a little problem and I don't see why, it's easy to go
OK, having tried my first TDD attempt, it's time to reflect a little and
Its possible I am just really really thick. However, looking over the SDK for
its out of question that a dao will not hold any state. however, for
Its a simple config app with 4 checkboxes and 5 textboxes, and all values
Its a .vbproj and looks like this <Project DefaultTargets=Build xmlns=http://schemas.microsoft.com/developer/msbuild/2003> <PropertyGroup> <ProjectGuid>15a7ee82-9020-4fda-a7fb-85a61664692d</ProjectGuid> all i

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.