|
Thank you for the link, but this exactly what I wanted to *avoid*: having the assembly split over several modules. Instead I wanted several modules to be physically embedded into one final .dll.
Let me explain my motivation:
I have a dll written in c++ with managed extensions. I use MC++ as I do a fair amount of IJW and COM-Interop. However, I need a collection derived from CollectionBase that reimplements object* get_Item(int) with a covariant return type (SomeType * get_Item(int)). As this does not seem possible in MC++ but well in C# (I posted my problem before: http://www.codeproject.com/script/comments/forums.asp?forumid=3785#xx455157xx), I decided to write the collections in C#.
So I would have a "main" dll e.g.
GentleStorm.Nasty.Graphics.dll
and a module with the collections
GentleStorm.Nasty.Graphics.netmodule
It would be nice if I could embed the latter into the first, so that I only have to distribute the .dll
- Andre
|
|
|
|
|
there was a upload on gotdotnet, but i cant seem to find it any more. it was called IL Linker, that does exactly what you want. i can email it
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Nice tool, leppie. However I need to link a mc++ module with native code as well which is something that cannot be done using ildasm/ilasm.
- Andre
|
|
|
|
|
Thats nice to kow, o well there goes my plans for a native/managed C++ assembly...
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Assume I want a client to use two different objects created in two different servers, what am i supposed to do? I want to know how i need to write my servers & client configuration files.
novice
|
|
|
|
|
Hi everyone!
I want to write an application which has a server and some clients. I would like them to communicate with tcp/ip.
I would like to send and recieve all kinds of data.
I have read about TCPListener, TCPClient, channels, sockets sync and async methods.
What are the diffrences between those methods ? Which is the better way ?
Thanks.
|
|
|
|
|
If your wanting to talk RAW TCP/IP - then use the Listner and either the client or socket class.
Example:
TcpListener tcplpop = new TcpListener(110);
tcplpop.Start();
Socket s = tcplpop.AcceptSocket() // Blocks until someone calls
s.Send(...)
s.Receive(...)
|
|
|
|
|
What is the difference between version no.1:
TcpListener tcplpop = new TcpListener(110);
tcplpop.Start();
Socket s = tcplpop.AcceptSocket() // Blocks until someone calls
s.Send(...)
s.Receive(...)
and version no.2:
IPEndPoint dbg_EndPoint = new IPEndPoint(ipAddress, dbg_port);
Socket dbg_listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
dbg_listener.Bind(dbg_EndPoint);
dbg_listener.Listen(num_of_devices);
dbg_listener.BeginAccept( new AsyncCallback(AcceptCallback), dbg_listener );
// Get the socket that handles the client request.
Socket listener = (Socket) ar.AsyncState;
Socket handler = listener.EndAccept(ar);
// Create the state object.
StateObject state = new StateObject();
state.workSocket = handler;
handler.BeginReceive( state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReadCallback), state);
Thanks.
|
|
|
|
|
Hi
I want to do in C# what you can do in COM with custom catagories. In ATL I can implement a custom catagory in a class by adding the following macro:
BEGIN_CATEGORY_MAP(CEffect)
IMPLEMENTED_CATEGORY(CATID_EFFECTS)
END_CATEGORY_MAP()
and I can seach for class's that implement that catagory by using:
ICatInformation::EnumClassesOfCategories()
which returns a list of CLSID's of classes that implement the specified catagory.
Is there any way to do this in C#?
|
|
|
|
|
Choppa wrote:
Is there any way to do this in C#?
No. There is only one category in .NET, and it's hard coded.
Category GUID : {62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}
Category Description : .NET Category
[edit]This info is from the CLR System.Runtime.InteropServices.RegistrationServices implementation.[/edit]
|
|
|
|
|
Hello,
How to dynamically validate a xml document against a dtd when no dtd reference is actually in the xml document.
Thanks,
Chito
|
|
|
|
|
Please help,
Here is my scenario:
Mainform has a private ChatSocket object that uses a socket, and this ChatSocket object has its own thread to Receive() bytes in a while(true) loop. Whenever the socket receives data, its calls an event I made in ChatSocket called MessageReceived. The MessageReceivedEventArgs contain the string of who the message was from and the message itself. The Mainform is listening for this event and calls the
OnMessageReceived( object sender, MessageReceivedEventArgs e );
This method checks a hashtable ( which is a private member in the Mainform ) to see if a ChatForm is already on the screen for the user the message came from. If it is not already on the screen ( in the hashtable ) it makes a new ChatForm. This ChatForm is made and i call Show() on it.
It shows, but it is pure white and it says it is not responding.
I tried async events as well, calling BeginInvoke() but that does not work either.
The thread of the MainForm is named MainThread, and the thread for the socket recving is called RecvThread, however when I am in the event handler within the MainForm, the thread running has an empty string for a name. I read that only the thread that creates the form should use it. If i create the ChatForm with a OnClick event with one fo the buttons on the MainForm it works fine. I also noticed that when you click on the button the new chatform is not fully displayed untill the OnClick method has completly returned. In my case the thread that invokes the event (ChatSocket) goes back to Receive() and therfore never returns. That is why I thought the async events would work but it still does not.
|
|
|
|
|
I have fixed the problem, but im not sure if there is a better way of doing it.
I ended up making a class that displays the ChatBox form I created as ShowDialog(), this seems to noew display the form, as Show() did not work. However, ShowDialog() blocks the thread untill that form is closed. So I have to craete the ChatBox form then pass it to an object that starts a new thread just for it. I dont really like this way because if i have 20 clients im chatting with thats 20 extra threads.
If anyone knows a better way please repsond. Sorry if my first post is a lot to take in, i didnt know how to explain my problem without giving all the background and details.
original problem, trying to be more clear:
a thread invokes an event, and a form (on the main thread) that is listening for the event creates a new form in the event hanlder, but the new form pops up and is "Not Responding".
I see that the new form is actually created in the thread that invokes the event, not the thread that has the form (that has the event handler), I dont really like that, i thought events you fire off and then the form thread would work on the event handler, i think this is why i had a problem (creating a form in a different thread and calling show() if i called showDialog() it works but the other thread blocks). I even tried async events, but even though its not the thread that invoked the event now creating the new form( working on the event handler), but its an anonymous new thread working on the event handler. I dont know how to make it more clear, this does sound confusing reading it back to myself sorry again.
The class to fix the problem, but creates a thread for each new form now:
private class EEChatBoxThread
{
internal EEChatBoxThread( FormEEChatBox chatBox )
{
_chatBox = chatBox;
Thread thread = new Thread( new ThreadStart( ShowChatBox ) );
thread.Name = chatBox.Client;
thread.IsBackground = true;
thread.Priority = ThreadPriority.BelowNormal;
thread.Start();
}
private void ShowChatBox()
{
_chatBox.ShowDialog();
}
private FormEEChatBox _chatBox;
}
Part of MainForm:
public void OnMessageReceived( Object sender, MessageReceivedEventArgs e )
{
FormEEChatBox chatBox = GetChatBox( e.From );
chatBox.MessageRecv( e.From, e.Message, e.Secure );
}
private FormEEChatBox GetChatBox( string with )
{
FormEEChatBox chatBox = ( FormEEChatBox )_chatBoxes[ with ];
// if the chatBox is not already on the screen, make one and display
if( chatBox == null )
{
chatBox = CreateChatBox( new string[] { with } );
}
return chatBox;
}
private FormEEChatBox CreateChatBox( string[] with )
{
FormEEChatBox chatBox = new FormEEChatBox( with, this );
chatBox.Closing += new CancelEventHandler( OnChatBoxClosing );
Monitor.Enter( _chatBoxes );
_chatBoxes.Add( with[ 0 ], chatBox );
Monitor.Exit( _chatBoxes );
// this class is above, just calls ShowDialog() on the chatBox form.
EEChatBoxThread boxThread = new EEChatBoxThread( chatBox );
return chatBox;
}
|
|
|
|
|
I think a better way might to be to use the InvokeRequired() and Invoke() methods in the OnMessageReceived method to marshal the event to the GUI thread. You should then be able to create and display the new form with no problems. See the article http://www.codeproject.com/cs/miscctrl/TSWizard.asp[^] for some examples of this.
Chris Jobson
|
|
|
|
|
Thanks you sooo much Chris Jobson, I looked at this sample you recomended the day you sent it, and see it was only the object "Step4" in that solution that i would be concerned with. This worked perfectly and i just summed up a quick way to handle what i was trying to do and how this helped me for others to see.
Again, thanks alot.
code below of what i basically was trying to do:
private void button1_Click(object sender, System.EventArgs e)
{
System.Threading.Thread formThread =
new System.Threading.Thread(
new System.Threading.ThreadStart( ShowNewFormThread ) );
formThread.IsBackground = true;
formThread.Priority = System.Threading.ThreadPriority.BelowNormal;
formThread.Start();
}
private delegate void ShowNewFormThreadDelegate();
private void ShowNewFormThread()
{
if( InvokeRequired )
{
ShowNewFormThreadDelegate del =
new ShowNewFormThreadDelegate( ShowNewFormThread );
Invoke( del, new Object [] { } );
return ;
}
++i;
Form form = new Form();
form.Text = i.ToString();
form.Width = 50;
form.Height = 50;
form.Owner = this;
_forms.Add( form.Text, form );
form.Show();
}
private void OnFormClosed( object sender, EventArgs e )
{
_forms.Remove( ( ( Form )sender ).Text );
}
int i = 0;
private Hashtable _forms = new Hashtable();
|
|
|
|
|
Dear experts,
Does anyone know how to get access to the text box control that is displayed underneath icons on the Windows desktop. I want to re-use this text box in my own application as it has the "growth" behaviour that I urgently need. I need a text box that will grow in height as more text is added to it.
PLEASE HELP ME! Thanks in advance for your assistance.
Benjamin
|
|
|
|
|
I think you asked a similar question previously, which i answered for you earlier today. Please drop me an e-mail if you can't find it / need clarification
|
|
|
|
|
Is there a way to create a “COM - Out Of Process” style object in C# (.NET)without using .NET remoting?
Any ideas out there? Am I stuck with remoting no matter what?
Thanks!
|
|
|
|
|
Hi,
Is there an activex control for importing flash(swf)? or How can i import a swf into my app???
|
|
|
|
|
In a C# Windows Form, I have a treeview/listview pair that behaves like Windows Explorer, displaying drives, folders and files... I want to display certain treeview nodes as disabled or greyed...
Can someone tell me how this can be done?
thanks very much.
|
|
|
|
|
A simple solution that may do what you want is to simply set the ForeColor of the node you want greyed to Color.Gray or Color.LightGray . You can then handle the BeforeSelect event of the treeview and check for the fore color, if it is Color.Gray or Color.LightGray , depending on which you choose, set the Cancel property of the TreeViewCancelEventArgs to true:
private void treeView1_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
{
if(e.Node.ForeColor == Color.Gray)
{
e.Cancel = true;
}
}
Hope this is useful
|
|
|
|
|
Yo Don,
thanks for the tip, that will do nicely...
|
|
|
|
|
Hello all,
I have just created my first C# exe. The exe uses the System.Process namespace to launch another exe (say c:\\X.exe - that is the X.exe is on the c: drive) . I compile my exe and it works fine on my machine. But when I put my exe on the network (on a mapped drive) - I get the following error message when I try to click on the button that launches the X.exe, I get the dialog box with the error message -
"The application attempted to perform an operation not allowed by the security policy. The operation required the SecurityException. To grant this application the required permission please contact the system administrator, or use the Microsoft .Net security policy administration tool."
I tried building my application on the same mapped network drive and running it through .Net and I get the dialog box with the following message -
"The project location is not fully trusted by the .Net runtime. This is usually because it is either a network share or mapped to a network share not on the local machine. If the output path is under the project location, your code will not execute as fully trusted and you may receive unexpected security exceptions."
Which is pretty much what happens.
Has anyone run into this problem before. Any ideas how I can fix this?
Thanks in advance.
|
|
|
|
|
This is the intended behavior, and was done to account for situations where you can't trust computers on your LAN (college dorms for example).
To change this, run the "Microsoft .NET Configuration Wizards" applet, on 2K/XP this is in the Administrative Tools portion of the Control Panel. Not sure where this is on Win98.
If you can't trust your LAN, then use the "Trust an Assembly" wizard to give your application full trust. If you CAN trust your LAN then you can use the "Adjust .net Security" wizard to adjust the LAN to Full Trust.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
I was wondering If anyone had an experience with retrieving path of the Windows directory C#
Unfortunately, Directory namespace has no class/member function to retrieve this information,
And when I try to use
this piece of code to import SDK function:
[DllImport("kernel32")]<br />
private static extern uint GetWindowsDirectory(string lpBuffer,
uint uSize
);
But apperantly I couldnt make this work.
Basically lpBuffer should be ref parameter in C#, but in decleration of this function is LPSTR in SDK,
Any help will be appreciated,
Thanks,
~Mithat
|
|
|
|