Im making a object placement editor. Ive got it fully working with buttons for each object and saving a map file for storing the positions of objects, and Ive got it loading in too and work with my game. But I decided my editor could be used for other types of games I want to make and setting up buttons for each object takes time. I found this code snippet on the old Realgametools site that allows me to access the open/save dialog box. I can load objects in with it but now I cant save my map files

One problem I can see is that I cant store the file name I just loaded into an array. Also if no file is selected and I exit the dialog box it still tries to load a file in, Please somebody help.