|
ok
|
|
|
|
|
Search for "stoub" on GotDotNet user samples. He is a MS employee that has done an excellent one.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
Thank you!
by the way,his name is toub,not stoub.
|
|
|
|
|
Hello,
Problem 1:
I wonder if you could use (how) dll made in delphi in C#.
Problem 2:
How do you make dll in C# and use this dll in Delphi, C++ ...
Is this posible?
I'm made dll with delphi and open it with Dependency walker. I can see my functions.
But if I made "dll" with C# (you know: New project; ClassLibrary...),
I can't see nothing. So I think that this dll is not real dll.
How can I make "real" dll in C# : you know like dll in delphi
function Something(a, b : integer) : integer; stdcall;
begin
Result:= a+ b;
end;
exports Something;
Thank you for answers,
have a nice day,
Anze
|
|
|
|
|
This may help
http://www.csharphelp.com/archives/archive52.html
All I need is a roadmap and then I might be able to find a clue.
|
|
|
|
|
Thank you for this link..
Anze
|
|
|
|
|
I have project that uses 3 files. I compile each of the subfiles to dlls and then combine them for the final exe. My question is, I have the same 'using' lines in two of them. Does this affect the exe generated? Will it slow my program down?
JJC
|
|
|
|
|
The 'using' keyword simply allows you to directly access namespace members without the namespace.
E.g.
ListBox;
rather than
System.Windows.Forms.ListBox;
So multiple 'using' lines for the same eventual build are ok. It only matters when they are in the same .cs file.
Any referenced dll's are loaded at application start. Check the debug/output window during a dubug run. It will tell you what libraries it is importing.
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
Thanks jonny, that was helpful. But what if u make a dll, use this for another dll, and finally use both for the project. Will both of them be referenced at runtime??
JJC
|
|
|
|
|
Provided the assemblies (dll's) are loaded into the same app domain, then they are only loaded once in the app's runtime life as far as i'm aware. Again, check the debug output window to see what is being loaded exactly and when.
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
That was helpful.... thanks.
But my problems are mainly due to my development environment. My professor wants me to use Eclipse 2.1 with the Improve C# plugin. Eclipse is excellent for Java development. But this IDE is not tuned for C# and lacks many of the features of VS7.
Infact, I'm totally new to .NET, C#, Eclipse.... And don't have much windows programming experience either. And I'm doing my semester project which is a 3D Graphics Engine using all of the above and this wrapper for OpenGL called CsGL by Lloyd Dupont & team. So I'm in a tight spot. Do you know of anyone who knows them all.
And about the debug thing.... I have no clue what ur talking about... coz I don't know where it is in Eclipse. If you can tell me how to do it from the command line, its be good.;)
"Excellence is never an accident" - JJC
|
|
|
|
|
nosmij wrote:
Does this affect the exe generated?
No, the using statements are just an aid to you as a programmer so you don't have to type out the full namespaces for all of the classes you want to use. If the C# compiler can't find the class in the current namespace it will then look through the namespaces provided by the using statement to see if the class exists there.
Once the C# code is compiled down to IL all classes are fully qualified with their namespaces. You can see this by running ildasm on a program you have compiled and looking through the code it shows you.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
That was helpful.... thanks.
But my problems are mainly due to my development environment. My professor wants me to use Eclipse 2.1 with the Improve C# plugin. Eclipse is excellent for Java development. But this IDE is not tuned for C# and lacks many of the features of VS7.
Infact, I'm totally new to .NET, C#, Eclipse.... And don't have much windows programming experience either. And I'm doing my semester project which is a 3D Graphics Engine using all of the above and this wrapper for OpenGL called CsGL by Lloyd Dupont & team. So I'm in a tight spot. Do you know of anyone who knows them all.
What I'm really interested is in - how does the compiler keep track of these files, especially if a referenced .cs file is not even in the project folder????? Meaning, how does it associate a using statement with a specific file??
"Excellence is never an accident" - JJC
|
|
|
|
|
nosmij wrote:
how does the compiler keep track of these files
Ok, first we need to get in touch with something Jonny was trying to explain.
A namespace is just a logical grouping construct used by C# (and all other .NET languages) to keep the chances of naming collisions down and to give some sense of order to the framework.
An assembly is a physical grouping construct used by the framework, generally used to keep common functionality together. These usually have a .dll or .exe extension (though others are possible).
A namespace -- since it is a logical grouping construct -- can span multiple assemblies and you can have multiple namespaces in an assembly (you can also have multiple namespaces span multiple assemblies). Another way of thinking of namespaces is that they are prefixes to class names and this is how the .NET Framework treats them.
Unfortunately for us programmers, we get bored if we have to type the namespace before every classname. This is where the using statement comes in. It lets us skip typing the namespace before the class name, if we put that we are using that namespace, enabling us to get on to more important thing.
In order to use a class, you must first reference the assembly it is located in. This, again, has nothing to do with the using statement but is instead something you tell the C# compiler (either through the command-line or by setting options in your IDE). By default the assemblies listed in %WINDIR%\Microsoft.NET\Framework\%VERSION%\csc.rsp will be referenced by the compiler.
A reference means that you may or may not need data out of that assembly, but if you try to use a data type that can't be found, the framework will load the assembly that data type is located in first. You can reference assemblies you don't use, but you must always reference assemblies that you use (whether that reference comes from the csc.rsp or by specifying it manually).
As to optimizations regarding excess references:
If you never use a data type in an assembly, even if it is referenced by the compiler, then you will never load that assembly into memory. Also, if you wrote your code so that you conditionally use a data type out of an assembly, then only if that condition is true will the assembly be loaded.
Hope that makes some sense, if you have any more questions I'll answer them tomorrow I need sleep
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Hey...
Thanks a ton. That sure did clear up a lot of fog. I get the picture now.
And my other question. about the project... any leads????
"Excellence is never an accident" - JJC
|
|
|
|
|
BTW, what the hell is GAC - global assembly cache. is this the csc.rsp you're talking about. If so how can you add new assemblies to the GAC. And also, if you add some to the GAC, can you get away with not having these custom assemblies in you .exe's folder?
"Excellence is never an accident" - JJC
|
|
|
|
|
The GAC is a common store for .NET Assemblies that need to be accessible to the entire machine. It speeds up load times of apps etc...
Assemblies like mscorlib.dll and System.Windows.Forms.dll are all stored there for easy access.
By running:
C:\WINNT\Microsoft.NET\Framework\v1.0.3705>gacutil.exe
in a console will list the functions avaliable to you for using the GAC. Including adding,retrieving and removing assemblies from the cache.
preJITed native assemblies is also stored in the cache.
More info at MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconglobalassemblycache.asp[^]
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
I have this little C# app I made, called "//AC". All it has is some buttons that when you click on them, they open the program. I have a button for, Explorer, Internet Explorer, Windows Media Player and Outlook. It's as simple as that.
Now, there is another program, called "moosebdc.exe" or something that keeps closing explorer on me. The reason, I made my app with a button that launches explorer again.
The question is... How could I make it so my app "AC.exe" can detect when the program "explorer.exe" is shut down, and then imeadetly restart it.
I assume it's gonna go in the Main method, which is provided below.
static void Main()
{
Application.Run(new Form1());
}
Could somebody help?
/\ |_ E X E GG
|
|
|
|
|
Look at System.Diagnostics.Process class, and the GetProcessesByName method to do this.
|
|
|
|
|
Ok, thanks for the start... I'll go mess around with it and see what I can do.
/\ |_ E X E GG
|
|
|
|
|
Im lost...
How can I let my program know if explorer.exe is running or not... and if it isn't start it? Can somebody start me off some?
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote:
How can I let my program know if explorer.exe is running or not
You have your program go through all of the processes running, if you don't find explorer.exe, then it isn't running. There is an example in MSDN which should help: Look up System.Diagnostics.Process.GetProcessesByName in MSDN and you should see the example there.
eggie5 wrote:
and if it isn't start it?
Use the System.Diagnostics.Process.Start method to start up a new process.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Ok, I see the example on MSDN. But, I then realized that if I only put the code in the "Form1_Load" method, it will only check if it's running once, right? (when the form loads). I need it to be checking constanly if explorer.exe is running or not...
How would I impliment that?
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote:
How would I impliment that?
You can use the Timer class, in VS.NET use the Timer from the Windows Forms tab of the Toolbox.
Its a relatively straight-forward class, you set the interval (in milliseconds), enable or disable it, and write the code you want to execute on every interval in the event handler for the Tick event.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
ok, so I have this....
private void Form1_Load(object sender, System.EventArgs e)
{
Process [] localByName = System.Diagnostics.Process.GetProcessesByName("notepad.exe");
}
So, first things first. From what I understand, the variable localByName (assuming it is a varible, and if it is what kind?) is storing the data from what ever "GetProcessesByName" returns, correct? If so what kind of data is it returing? A sting? A bool?
/\ |_ E X E GG
|
|
|
|