473,395 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

.Net Forms application, File and FolderDialogs

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
Oct 25 '06 #1
1 1234
Hi All,

Dubious form to follow up yourself I know, but I've found the answers...

The STA issue looks like it occurs as, since the solution contains both
managed and unmanaged, it is kicked off via mscorwks which does a
CoInitialise/CoInitialiseEx for you rendering the one in my ATL server main
useless (it returned the CHANGED_MODE failure). It is easily solved however
when you finally locate and set the "CLR Thread Attribute" setting in the
Linker->Advanced settings for the project to STA.

The look and feel / text length issue is down to needing calls to
EnableVisualStyles() and a SetCompatibleTextRenderingDefault(false) which get
put in the main function that Studio creates for a pure WinForms solution,
but weren't in mine since I didn't have the WinForms main any longer.

Hope this helps someone in future.

Regards,
Ed

Oct 27 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
3
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
12
by: Brett Robichaud | last post by:
Is anyone familiar with this error? I have this running just fine on my local machine but when I pushed it out to our development server I get this error. I have no idea what it is saying. Any...
2
by: Thomas Scheiderich | last post by:
I am trying to set up forms authentication in my IIS pages. I have a folder inside of my root folder I am trying to protect and I am getting an error when a page in the folder is accessed. The...
1
by: Sumaira Ahmad | last post by:
Hi, Please help me with this.. I am trying to use Forms Authentication in a sample project. I basically want to have two folders in my application , one in which I store pages that can be...
6
by: William F. Zachmann | last post by:
We've got a project going that involves moving an old web site with a massive dll written in C++ that produces most of the output from a SQL 7.0 data base on NT4 onto IIS on Windows 2003 Server...
8
by: J.S. | last post by:
I was under the impression that frames could be used in Windows forms in earlier version of VB. However, in VB 2005 Express I don't see any such tool/control. Is SplitContainer used for this...
6
by: dbuchanan | last post by:
I have a Windows Forms application that accesses SQL Server 2k from a small local network. The application has been used for weeks on other systmes but a new install on a new machine retruns...
5
by: kirschpe | last post by:
I developed an application using visual studio 2003. Now I want to make a similar application without having to redesign similar forms. Is there a way to copy and paste windows forms across...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.