saveasdialog_extended quits max

jlake's icon

Hello,

I'm having a problem very similar to the one discussed in this thread: https://cycling74.com/forums/alternative-to-saveasdialog_extendedfilename-path-outtype-filetype-1/

The first time I send a 'write' message, the dialog opens normally.  The second time I send a write message, Max just quits somewhere inside of saveasdialog_extended (note: doesn't crash, exits normally).

I've tried replacing defer with defer_low, which solved the problem in the thread referenced above, but this has no effect for me.

Has no one else had this problem?

I'm using OS X 10.7.5, Max 6.1.2, MaxSDK-6.1.1.  Code is copied directly from page 62 of MaxAPI-6.1.1.pdf.

Thanks for any help anyone can provide!

Joe

Thomas Resch's icon

In the SDK, the char "filename" is not initialised, I think that is the reason for the crashes, the code below works for me.
cheers,
Thomas

t_fourcc filetype = 'TEXT', outtype;
short path;
char filename[MAX_FILENAME_CHARS];
strcpy(filename, "untitled.txt");

if (saveasdialog_extended(filename, &path, &outtype, &filetype, 1)) // non-zero: user cancelled
{//do something}

else
{//something}

MIB's icon

Thanks! That fixed one of my issues!!
For now I am still getting files that are 0 bytes large... baby steps ;)

jlake's icon

thank you, thomas! sorry for the late reply. I've been away from this project for a bit.

Regarding the 0 byte files, I also had this problem. sysfile_writetextfile() actually needs a t_handle as the second parameter (char ** won't work).

does this help you at all?

Joe

rvirmoors's icon

thanks for the filename initialization tip! was wracking my brain for an hour before i found this... the SDK should be updated accordingly I think.