G
Guest
Hi there,
We have a C++/CLI .NET 2 forms based application where the .NET forms front
end lives in an ATL server solution, and uses COM to talk with a separate
back end process.
For development, the executable was built as a pure .NET solution
incorporating all the back end code, and worked well. We then migrated to
the final architecture which has thrown up a couple of issues.
The main problem is this. In a few places we have FileDialogs
(OpenFileDialog and SaveFileDialog instances) as well as FolderBrowserDialog
instances. These worked fine in the .Net solution, but in the ATL solution,
cause a ThreadStateExceptions and state the main function should have an
STAThreadAttribute applied. We can't set this attribute since we're running
from an ATL server. We have however tried changing the CoInitialize call to
CoInitializeEx and specifying Apartment Threading, as well as hacking the
stdafx.h macro to be _ATL_SINGLE_THREADED. All to no avail.
The other issue is more minor but still annoying. The look and feel has
changed slightly from the pure .Net based solution. Colours are slightly
different and some button text falls off the right of the button (perhaps due
to different fonts or font sizes). Any ideas as to why this is / how to fix
it (I'd rather not check/resize all the buttons!) would also be good.
Any help much appreciated!
Regards,
Ed
We have a C++/CLI .NET 2 forms based application where the .NET forms front
end lives in an ATL server solution, and uses COM to talk with a separate
back end process.
For development, the executable was built as a pure .NET solution
incorporating all the back end code, and worked well. We then migrated to
the final architecture which has thrown up a couple of issues.
The main problem is this. In a few places we have FileDialogs
(OpenFileDialog and SaveFileDialog instances) as well as FolderBrowserDialog
instances. These worked fine in the .Net solution, but in the ATL solution,
cause a ThreadStateExceptions and state the main function should have an
STAThreadAttribute applied. We can't set this attribute since we're running
from an ATL server. We have however tried changing the CoInitialize call to
CoInitializeEx and specifying Apartment Threading, as well as hacking the
stdafx.h macro to be _ATL_SINGLE_THREADED. All to no avail.
The other issue is more minor but still annoying. The look and feel has
changed slightly from the pure .Net based solution. Colours are slightly
different and some button text falls off the right of the button (perhaps due
to different fonts or font sizes). Any ideas as to why this is / how to fix
it (I'd rather not check/resize all the buttons!) would also be good.
Any help much appreciated!
Regards,
Ed