|
|
Joshua Quick wrote: Orca comes with the Microsoft Windows Software Development Kit.
I didn't notice it is for Windows Server 2003. We are still using Windows 2000. I will definitely try it when we move to Windows 2003. Thanks.
My articles and software tools
|
|
|
|
|
Xiangyang Liu wrote: I didn't notice it is for Windows Server 2003. We are still using Windows 2000. I will definitely try it when we move to Windows 2003. Thanks.
The version I'm using is just called "Microsoft Platform SDK February 2003", which works fine on my XP system. I tried to link to the version I was using on Microsoft's site and it pointed me to the Windows Server 2003 SDK page. It looks like the same thing. Its system requirements does say it supports Win2000.
However, it looks like someone at Microsoft has provided easy access to Orca via his blog. Try this...
http://blogs.msdn.com/astebner/archive/2004/07/12/180792.aspx[^]
|
|
|
|
|
That just means that the SDK supports Windows 2003 and below. It's not a requirement to have 2003 to use it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I'm design a windows forms application and i'm having some problems structuring it. The application itself will block a computer until a person gives a username and a password, after that it hides itself and keeps a small icon on taskbar. Lots of things will be happening meanwhile, syncs and comms with server, forms popping-up, and timers firing. My question is, what of the following approaches is the best one:
1. A console application looping forever (how to loop forever? System.Threading.Timeout.Infinite is a good choice?), which launches a splash screen on start, and then launches all other windows as needed, and keeps a child thread for server lookup (for server-client clock syncs, pings for new relevent items on server, etc). Note that the application requires timers which would probably need to be in class hosting static main().
2. A windows forms application, being the main form the one who blocks the computer, this will be the one that when minimized keeps the icon on taskbar. All other forms will be controled by this form (note the main form will be minimized most of the time)
3. The splash screen itself will be the main form, which appears only on start and then hides itself controlling all the processes and forms of the application.
Thanks to all of you
Best regards
João Vilela
jpmv
|
|
|
|
|
I have 2 project in a solution and i have added correct references. When I compile it in Debug mode it works fine but I am not able to compile it in relese mode I am getting the error saying (Are you missing a using directive or an assembly reference?)
the assemply it's missing is namespace for my 2nd project which i know i have added a reference in 1st project.
Please any help or advice?
really appericiated
Thanks, cpp
|
|
|
|
|
Possibly it has to do with with where the assembly is outputted in release mode compile. Did you add the reference to the second assembly by referencing the dll, or by referencing the project?
Matt Newman
Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots
|
|
|
|
|
try to set 2nd project in release mode also...
<< >>
|
|
|
|
|
I am trying to complie whole solution and it's giving me assembly not found error.
Thanks
|
|
|
|
|
When you created the Reference, did you select the .DLL file directly or did you reference the .DLL's Project? Yes, it makes a huge difference.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I have a problem I cannot solve by my own. The message is quite long, but I hope that someone is nice enough to read it and give me a hand.
The basic problem is that I cannot sent events over .Net remoting that has an event argument as a class I have created, but strings as arguments works just fine.
I have three projects: Server, Middle and Client.
Server going to generate events and pass them through .Net remoting to the client. The middle project contains the remoted object. It also contains a delegate that is used to define the events generated in the server. The server is remoting the class in the middle project through a TCP channel.
The connection class in the server is remoting the object:
<br />
private void OpenConnection()<br />
{<br />
BinaryClientFormatterSinkProvider clientProvider = null;<br />
BinaryServerFormatterSinkProvider serverProvider = <br />
new BinaryServerFormatterSinkProvider();<br />
serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;<br />
<br />
IDictionary props = new Hashtable();<br />
props["port"] = 7889;<br />
props["typeFilterLevel"] = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;<br />
props["name"] = "StatusControl";<br />
<br />
TcpChannel chan = new TcpChannel(<br />
props,clientProvider,serverProvider); <br />
<br />
ChannelServices.RegisterChannel(chan);<br />
<br />
RemotingConfiguration.RegisterWellKnownServiceType(<br />
Type.GetType("ProductionStatusControl.DistributedStatusControl, ProductionStatusControl"),"IDistributedControl", WellKnownObjectMode.Singleton ); <br />
<br />
m_single = StatusSingletonConnection.GetInstance();<br />
<br />
System.Threading.ThreadStart ts = new System.Threading.ThreadStart( SendMessages );<br />
System.Threading.Thread t = new System.Threading.Thread( ts );<br />
t.IsBackground = true;<br />
t.Start();<br />
}<br />
The middle project has a delegate:
<br />
public delegate void ProductionStatusDelegate( StatusMessage message );<br />
, a class as event argument:
<br />
[Serializable]<br />
public class StatusMessage<br />
{<br />
<br />
private FloatingStorageEventType m_type;<br />
private string m_message;<br />
<br />
public StatusMessage( FloatingStorageEventType type, string message )<br />
{<br />
this.m_message = message;<br />
this.m_type = type;<br />
}<br />
<br />
public FloatingStorageEventType MessageType<br />
{<br />
get{return m_type;}<br />
}<br />
<br />
public string Message<br />
{<br />
get{return m_message;}<br />
}<br />
<br />
}<br />
and a event type enumerator:
<br />
[Serializable]<br />
public enum FloatingStorageEventType<br />
{<br />
StatusText,<br />
Error, <br />
Warning, <br />
StorageStart,<br />
StorageStop,<br />
ProductionStart,<br />
ProductionStop, <br />
}<br />
The client connects to the server and starts to monitor for events:
<br />
try<br />
{<br />
BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();<br />
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();<br />
serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;<br />
<br />
IDictionary props = new Hashtable();<br />
<br />
props["port"] = 0;<br />
props["name"] = "StatusControl";<br />
props["typeFilterLevel"] = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;<br />
<br />
m_chan = new TcpChannel(props, clientProvider, serverProvider);<br />
<br />
ChannelServices.RegisterChannel(m_chan);<br />
<br />
m_dist = (ProductionStatusControl.IDistributedControl) Activator.GetObject(Type.GetType("ProductionStatusControl.IDistributedControl, ProductionStatusControl"), "tcp://127.0.0.1:7889/IDistributedControl");<br />
m_dist.OnProductionStatusChanged += new ProductionStatusControl.ProductionStatusDelegate(m_dist_OnProductionStatusChanged);<br />
}<br />
catch( Exception ex )<br />
{<br />
System.Windows.Forms.MessageBox.Show( ex.ToString() );<br />
}<br />
The problem is that an exception is thrown in the
<br />
m_dist.OnProductionStatusChanged += new ProductionStatusControl.ProductionStatusDelegate(m_dist_OnProductionStatusChanged);<br />
part of the code.
<br />
System.ArgumentException: Error binding to target method.<br />
<br />
Server stack trace: <br />
at System.Delegate.InternalCreate(Object target, String method, Boolean ignoreCase)<br />
at System.Delegate.CreateDelegate(Type type, Object target, String method)<br />
at System.DelegateSerializationHolder.GetDelegate(DelegateEntry de)<br />
at System.DelegateSerializationHolder.GetRealObject(StreamingContext context)<br />
at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)<br />
at System.Runtime.Serialization.ObjectManager.DoFixups()<br />
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)<br />
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage)<br />
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.UnsafeDeserialize(Stream serializationStream, HeaderHandler handler)<br />
at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)<br />
at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)<br />
<br />
Exception rethrown at [0]: <br />
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)<br />
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)<br />
at ProductionStatusControl.IDistributedControl.add_OnProductionStatusChanged(ProductionStatusDelegate value)<br />
at TAKAnalyzer.Form1.btnConnect_Click(Object sender, EventArgs e) in c:\vsprojects\csharp\takanalyzer\mainform.cs:line 242<br />
The exception dissaperes it I change the parameter in the delegate from EventMessage to string. The string is accepted but not the EventMessage. No exception is thrown in the server, only in the client.
Please advice, I am totally lost here.
Best Regards
Mikke
|
|
|
|
|
Events conceptually are not sound in any network protocol. I'm surprised there was even an attempt in .Net Remoting to support this. The exception you are seeing is somewhat indicitive of the general problem. I wish that future versions of .Net Remoting would throw a more accurate exception than ArgumentException you often see in this case.
Okay so what is the problem? Mechanically, it can't serialize the delegate and event cleanly across .Net Remoting. Seriously, how would .Net Remoting even begin to handle an delegates/events? Ignore the actual mechanical problems with serialization for a moment and look at the concept you are trying to do. Bare with my crude ascii art
+--------------------------------------------+ +-------------------+
+ Client + + Server +
+ + + +
+ ObjectA CallRemoteB() + ---------------->+ ObjectB Call() +
+ { + + { +
+ b.ValueChanged += ValueChangeDelegate(); + + DoSomeStuff(); +
+ b.Call(); + err??? <--------+ ValueChanged(); +
+ } + + } +
+--------------------------------------------- +-------------------+
Remember that the client and server are for all purposes are in two seperate application domains let alone two different processes let a lone two different machines. If you don't understand why marshalling events across seperate app domains is tricky then read on.
The client is making a call b.Call which is remoted and marshalled correctly over to the server. If you don't do anything fancy, it is going to be syncronous and therefore block and wait for the response from the server. Over on the server, it is going to do the ObjectB.Call method when it makes an attempt to do the event. Okay, how does the server contact the client?? If you can't come up with a good answer then you see why events are a problem in Remoting.
Neither application domain knows what state the other is in. Even if the client is making an asycronous remote call, the client would have to *stop* execution on whatever it is doing and do the event. The client side is either blocked waiting for a response or the client application is listening asycronous but off doing some other parts of the client application. In either event, the app domain is not in a state where it can handle the event.
Simply put, one app domain needs to make a call on an object in another app domain it simply has no reference too. Even if it did, there is no underlying infrastructure on its own to marshal such a call (what port on the client does the server actually open the connection on to start the soap transaction???). .Net Remoting is "client->server->client". The client app domain simply can't act as a server.
To support events in .Net Remoting is giagantic mess. If you really want event/delegates you are going to have to simulate this by using the hint in the last sentance of the last paragraph: You need a client/server in both app domains. At this point you need some heavy duty engineering and even then it doesn't guarentee the end result will work: consider the problem of crossing a firewall.
I would consider redoing the event/delegate structure of your system. Rearrange your event/delegates so they are in the same domains since they don't make sense in any other domain. Trying to marshal them across just doesn't work right nor should they really make any sense.
-- modified at 15:43 Thursday 27th October, 2005
|
|
|
|
|
Hi!
Thank you for you reply! I realize that what I was trying to do was not as easy or smart as I thought..
What puzzles me is that it works well if I use a delegate with only a string as a argument. Why does that work?? I cannot have a delegate with two strings as arguments, but one work. I tried to implement the ISerializable interface. That did not work either.
I can buy the thought of the events not working if the server cannot find the client, that is reasonable. But why does it work if the argument is a string??
Best Regards
Mikke
|
|
|
|
|
Consider what is happening when you "sign up" for the event. You need to send a message to the server object to add ClientObject.ClientFunction to the delegate list. Assuming ClientObject is a MarshalByRefObject , it can marshal "itself" across. It can also marshal strings across. So technically it will succeed in making the functional call across the .Net Remoting. The problem is that it is meaningless to the server app domain because of all of the stuff I meantioned before. All of the object references only work in the client domain and will "blow up" if used in server domain.
Oh yeah, I did mention a way to work around the limitation in .Net Remoting but it might not be clear without an example:
ObjectA CallRemoteB()
{
b.Call();
if(this.ValueChanged != null)
this.ValueChanged();
}
The event/delegate is now only in the client app domain so everything works.
|
|
|
|
|
I'm using VS2005 RC1.
I have a project file which has several applications inside it. These applications all need to use some of the same classes. I'd like to define these classes in one file that is shared among the applications, but defined in a separate namespace. The windows applications all are in separate namespaces as well.
I tried adding a new class to the project in a new solution folder in a new class file. I added a new new space to the file containing the classes, but to no avail. I could not figure out how to access the classes from the other namespaces in the applications.
Can someone explain the correct way to do this? Thanks.
|
|
|
|
|
set references
and all classes u want to share must be public
eg.
public class foo{}
Please pardon my weak English!
|
|
|
|
|
To access classes in say a class library you need all of the classes you are accessing to be public, and you need to add a reference to the library. If the library isn't in the solution you can add reference by dll, but if the library project is within the current working solution you can add reference by project. There is a references folder in the solution explorer which is were you can access the references dialog.
Matt Newman
Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots
|
|
|
|
|
I'm a bit confused still. Here's the thing.
In my project file there are two applications and a "Solution Items" folder that contains a .cs file with several helper classes and enums defined inside.
These classes are declared public, and make use of the enum's defined in this file as well.
What I can't figure out how to do, is access the classes from the other applications defined within the project file.
I tried like you said, adding a reference to the file individually from the "Add Reference" selection that appears when you rightclick an application within the project.
However, my classes nor my solution file that contains the classes appear in any of the tabs available from within the references tab.
Can you reiterate on what you said, to clear this up for me a little bit?
Thank you.
|
|
|
|
|
Create a new project item of type class library (give it a name like "myapp_shared" or whatever makes sense to you). move the cs files that are in your 'solution items' file there. build that project (it should create a dll). in the other projects refence the new project, and add a "using" for the namespace that contains the shared classes. This will require you to distribute the dll with both applications, but is the easiest and most maintainable way to share functionallity...
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
I don't understand why you want the same classes to appear in different namespaces. I would think you would shared classes to appear in a common namespace that was used by all the applications. This might require putting the shared classes in their own dll, but that would seem more maintainable in the long run.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Granted, I'm new to C#. But I don't want the helper classes defined in the solution file to be put in separate namespaces, I want them to be in their own namespace that is accessable from the different applications, to avoid confusion.
I'm going to try the DLL solution you mentioned and see if I can get that to work.
Just to reiterate on my goal:
The applications in the project are contained within separate namespaces because MOST of the data in each is not used in the other. However, some of the basic data is derived from the same classes. Those classes I've put in a separate file in their own namespace. Just to show the structure:
The first two applications are like so:
Application 1:
namespace client
{
... // requires processing of class helper1 and helper 2
}
Application 2:
namespace server
{
... // requires processing of class helper1 and helper 2
}
SolutionFile.cs
namespace helper
{
enum type1 { ... }
enum type2 { ... }
class helper1 { ... } // USES ENUM TYPES
class helper2 { ... } // USES ENUM TYPES
}
I hope that clears up my problem a bit.
|
|
|
|
|
I want make my C# application to get all procedures' defination from IQ database using SQL "select * from sys.sysprocedure where proc_id>200",but when executing this sql,the exception "Capacity must be larger than 0" occused.
m_command = m_connection.CreateCommand();
m_command.CommandType = System.Data.CommandType.Text;
m_command.CommandText = m_strSql;
m_reader = m_command.ExecuteReader();
public Object this[String key]
{
get { return m_reader[key]; }
}
public String GetString(String key)
{
Object value = this[key];
if (Convert.DBNull.Equals(value))
{
return null;
}
else
{
return Convert.ToString(value);
}
}
How to get the long text which length more than 8K?plz help me!
Please pardon my weak English!
|
|
|
|
|
Hello
How I can show TV with Managed DirectX 9 ?
Can you showme a sample ? please
Thanks
|
|
|
|
|
Hy guys.
I'm Alessio, I don't speak english very well, so excuse me in advance.
I'm writing because I'm getting an error when I use the Graphics.DrawImage method with ImageAttributes parameter.
I've created a Form class to customize the TitleBar.
This "base" form is borderless and in the Constructor I store a small "gif" (30-40 Kb) in a bitmap object with the TitleBar I want to put in the form.
In the paint event I call a procedure passing the PaintEventArgs Graphic object and then I call the DrawImage using the bitmap object.
When the form has got the focus, I call "simple" DrawImage method, but when this form loss the focus, I use the ImageAttributes.SetGamma to brighten up the TitleBar (I pass "0.55f" to SetGamma) and then I call DrawImage passing the ImageAttributes object.
When I run my project, it's ok, but if I create a form that inherits from the "base form", and run the project, I've got an "out of memory" error when this form loss the focus.
Can you help me to understand ?
Thanx anyway
Alessio
|
|
|
|
|
Just a correction.
In that project I can load image from an extern file or from an embedded image I had added in project resource file.
In both cases I tried gif, png & jpg.
When forms are using external images, it's all right but when they use embedded image the "out of memory" error comes up.
I load this image in a Stream object through "Assembly.GetManifestResourceStream" method and then I create my bitmap object by "new Bitmap(MyStreamObj);".
If I use an Image object instead of the Bitmap object, all works fine, but I need Bitmap object because in the case of jpg images I need to call MakeTransparent method.
So, please, help me.
|
|
|
|
|