Cannot use Common Language Runtime Support?


So I am working on an application that runs on openframeworks. Because we are working with arduino’s and might want to implement some other stuff like kinect in the future. I am trying to implement the System.Windows.Forms namespace for using openfiledialog :

Because I want to be able to save stuff to a file from my application. But to be able to use the System namespace I need to set the Common Language Runtime support to /clr. and then I need to add System.Windows.Forms as a reference. But if I do this the whole application will be full of errors when building. Is this not possible in combination with openFrameworks? Or does anyone know what I can do to fix this.

Thanks for any help!


Here is a screenshot from some of the errors. Which do only appear when using /clr. Otherwise it is all working perfectly.

1 Like

Ok, so I found out I should use ofSystemSaveDialog. But somehow the defaultname and messagename is not working. Any ideas why?

ofFileDialogResult saveFileResult = ofSystemSaveDialog(ofGetTimestampString() + "." + ofToLower(FILE_EXTENSION), "Save your file"); if (saveFileResult.bSuccess) { SaveToFile(saveFileResult.filePath); }

I found the ofSystemUtils.cpp doesn’t do anything on windows with the strings defaultname and messagename. It is solved.


Thanks for the tip.

Here’s the code that needs to be swapped in to ofSystemUtils.cpp get this to work on Windows:

	std::wstring messName = convertNarrowToWide(messageName);
	ofn.lpstrTitle = messName.c_str();

	std::wstring defName = convertNarrowToWide(defaultName);
	for (int i = 0; i < defName.length(); i++)
		fileName[i] = defName[i];
	fileName[defName.length()] = 0;
	ofn.lpstrFile = fileName;