Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - NicuBaciu

Pages: [1]
1
Graphics / Re: Loading Images and Textures Failed
« on: June 15, 2018, 11:19:42 am »
No, how can I do that?

2
Graphics / Re: Loading Images and Textures Failed
« on: June 13, 2018, 09:26:02 am »
Thanks very much for helping me out. I used the flag OFN_NOCHEANGEDIR and it worked.

The only thing is it does not display the image until I restart the app. It is the same error message but only for the image i loaded. (I save the path of the image in a text file and then I load it back into the program when the program starts)

3
Graphics / Loading Images and Textures Failed
« on: June 10, 2018, 02:42:48 pm »
Hello.
I have a project in VS2017 in which i use SFML. It is a database for students.
I have encountered an error as I was trying to implement a dialog box for opening files. As soon as the dialog box is closed (with no error message) the program displays errors in opening the fonts and the images that previously worked.

The code I am using for displaying the dialog box is as follows:

string testing()
{
        OPENFILENAME ofn;       // common dialog box structure
        char szFile[260];       // buffer for file name
        HWND hwnd = NULL;              // owner window
        HANDLE hf;              // file handle

                                                        // Initialize OPENFILENAME
        ZeroMemory(&ofn, sizeof(ofn));
        ofn.lStructSize = sizeof(ofn);
        ofn.hwndOwner = hwnd;
        ofn.lpstrFile = szFile;
        // Set lpstrFile[0] to '\0' so that GetOpenFileName does not
        // use the contents of szFile to initialize itself.
        ofn.lpstrFile[0] = '\0';
        ofn.nMaxFile = sizeof(szFile);
        ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
        ofn.nFilterIndex = 1;
        ofn.lpstrFileTitle = NULL;
        ofn.nMaxFileTitle = 0;
        ofn.lpstrInitialDir = NULL;
        ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

        // Display the Open dialog box.

        if (GetOpenFileName(&ofn) == TRUE)
        {
                hf = CreateFile(ofn.lpstrFile,
                        GENERIC_READ,
                        0,
                        (LPSECURITY_ATTRIBUTES)NULL,
                        OPEN_EXISTING,
                        FILE_ATTRIBUTE_NORMAL,
                        (HANDLE)NULL);

                return ofn.lpstrFile;
        }
       
        return "";
}
 


And the function is called like this:



string s;

s = testing();

cout << s << '\n';


The error messages I get are:

Failed to load image "images/flag.png". Reason: Unable to open file
Failed to load image "images/logo_nb.png". Reason: Unable to open file
Failed to load image "images/student_data.png". Reason: Unable to open file
Failed to load font "fonts/Times_New_Roman_Normal.ttf" (failed to create the font face)

Pages: [1]