|
Isn't there an open source IDE for C# development? I can't recall the name. Does that support CF?
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
You're thinking of SharpDevelop (#develop)[^], and I don't believe it supports CF designers, but you don't really need them anyway. Drag-n-drop development is not true development. IDE's are handy, but being able to develop without them is what helps make you a decent developer.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Uh oh. You mean using VS.NET will always make me beneath all those who develop by hand?
But I thought that the real essence is not code writing, it's really the thinking behind it, if you know what I mean. This is why IDEs are okay, because they let you concentrate on writing the code that really matters, not the one you know by heart how to write already (like instantiating forms and controls).
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
I'm not saying IDEs are bad, just that good developers can live without them. I use an IDE mostly at work because IntelliSense helps me avoid stupid spelling (rather, casing) mistakes, but I never rely on it (like a lot of people, unfortunately) to tell me what a class supports in the way of method and property names. I know what a class has (good memory helps, but...) and if I don't then I look it up in the documentation to truly understand what's available and what everything does.
Most code I write for CP (especially code snippets I post here in the forums) are written using VIM[^] on the command line with the C# command-line compiler (csc.exe) because it's fast and easy and I don't have to create a project (btw, VS.NET 2005 will have "scratch projects" for this very purpose!).
So, like I said, IDEs aren't bad. They sure save a lot of time when designing forms and creating data classes (like hooking up data adapters to data sets), but they shouldn't be depended on 100%. Knowing how to code and using an IDE doesn't make a good developer. Just look at VB programmers!
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm sorry, did that sound sarcastic? That's not what I meant if it did. It's just that your opinion matters to me, I sort of look up to you!
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
Hi All,
Does anyone have a good example of using a COM Scriptlet (mine is VBS) from a CSharp application? Should it would like a normal COM control?
Regards,
Davy
My Personal Blog - Homepage. Scottish News - Angus Blog, Perth Blog and Dundee Blog
|
|
|
|
|
You should be able to. Make sure you register them first using regsvr32.exe. You'll have to create your own interop classes, though, since there wouldn't be any typelib on which to use tlbimp.exe. The WSC host (script.dll) takes care of all the details so the CCW shouldn't care how the COM control was instantiated or where it came from (one of the major development goals of COM).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
|
Hello. I'd like to write a module for IE in order to add custom http headers to each request. Is it possible? Thank you.
|
|
|
|
|
Hi all,
I have three questions,
1. What are the limitation of C# compared to C++.net ?
2. will MFC in VC++ be obsolete in future ?
3. Do we need to obsfucate the code in C++.net as in C# for
protecting the reverse engineering of software code ?
Thanks
|
|
|
|
|
pyhtang1 wrote:
1. What are the limitation of C# compared to C++.net ?
Nothing notable, really. While MC++ can easily call unmanaged APIs (which will produce mixed mode compilation), in C# you can P/Invoke these calls. It's a lot of busy work, but possible. Both can also perform pointer operations, but once again in C# you have to use an unsafe context where in MC++ you don't. The only real limitation with C# is that it can't produce completely unmanaged code, where C++ can (without using managed extensions).
pyhtang1 wrote:
2. will MFC in VC++ be obsolete in future ?
Who can say? If you're looking for a simple yes or no, you won't find it - only opinions.
pyhtang1 wrote:
3. Do we need to obsfucate the code in C++.net as in C# for
protecting the reverse engineering of software code ?
If you think obfuscating code is any sort of protection at all, you'd best forget about writing .NET and Java applications now. For every obfuscator, there's a deobfuscator. Besides, for some people like me they really don't help. I have yet to find one that doesn't let me use even something as simple as ildasm.exe from the .NET Framework SDK to see what's going on. Context clues and a good memory make it easy to get past obfuscation. Besides, for classes that don't have lots of private members obfuscation is pretty useless.
With that said, obfuscating MC++ assemblies is possible. For native instructions, everything is hidden anyway since it's not IL. For IL, private members can be obfuscated like any other assembly - the source language matters not because every language targeting the CLR compiles to IL which is contained in modules that are embedded into assemblies. Some language compilers support more feature sets and better optimization, but they still produce IL.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
If i have a Xml document like this:
<libraries>
<library name="contxtlib">
<fullname>123</fullname>
<super>true</super>
<loadorder>1</loadorder>
</library>
<library name="xmllib">
<fullname>xmllib.p</fullname>
<super>true</super>
<loadorder>2</loadorder>
</library>
</libraries>
I want this data on a windows form in textboxes and the <super> in a checkbox, so i can navigate through the records
Does anybode have an idea how to do it? Or maybe an example of an application like this?
Thx in advance
|
|
|
|
|
You might consider reading this into a DataSet (see DataSet.ReadXml ) since it's a simple 3-level XML schema. Data-bind controls to your DataSet in a form or other container control. Then you can use the CurrencyManager of your form or other container control to step through the records. See the Control.DataBindings property documentation in the .NET Framework SDK for more information and an example.
You could do this without data-binding, but you'll have to keep your element position and control text/properties in sync yourself. With such a simple XML schema, data-binding will definitely save you a lot of time.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thx a lot for your answer but the Xml schema was just an example, the real Xml schema is a lot more complex
I'll look it up and try your suggestions
thx!
|
|
|
|
|
If you want true data-binding, you'll need something to bind against so values are synchronized both ways. You could always just read-in your XML document and write it out when done as a two-step process, but that's not "true" data-binding (at least, some would argue).
If your schema is much more complex than what would fill a DataSet (try it though, it's actually a pretty intelligent class), you could always use the PropertyManager , another derivative of the BindingManagerBase like the CurrencyManager . You could read-in your XML file and either use XML deserialization to construct the object, or have the object parse and XML file itself and fill in its members (and have children fill in their members, etc.). You could then bind against the properties of that object easily enough. Kick that object up a notch with some PropertyChanged events and you've got a pretty nice OO design.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Using the following code I can run a process and trap when it has exited.
private void RunProc()
{
Process p = new Process();
p.StartInfo.FileName = "calc.exe";
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(p_Exited);
p.Start();
}
private void p_Exited(object sender, EventArgs e)
{
MessageBox.Show( "Exited" );
}
What I would like to ask is, can I in some way determine if the process has crashed, been killed, or exited in some abnormal fashion?
I can use the ExitCode property to find out what the exit code of the process was, but some processes don't return meaningful exit codes, and the exit code seems to be zero if the process crashes or is killed.
Searching the web without Google is like straining sewage with your teeth. Userfriendly, 2003/06/07
|
|
|
|
|
Look up Try...Catch blocks.
E.G.,
private void RunProc()
{
Process p = new Process();
p.StartInfo.FileName = "calc.exe";
p.EnableRaisingEvents = true;
try
{
p.Start();
}
catch (Exception exc)
{
MessageBox.Show
(
OwningForm,
"Inner Exception: " + exc.InnerException.ToString() +
" Message: " + exc.Message.ToString() +
" Source: " + exc.Source.ToString()
);
}
}
|
|
|
|
|
I tried that first, didn't think it'd work, and it doesn't, unfortunately.
Maybe if I attach to the process as a debugger...
Searching the web without Google is like straining sewage with your teeth. Userfriendly, 2003/06/07
|
|
|
|
|
A separate program crashing would not throw an exception in the executing AppDomain .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
If you don't need to process any further until the application quits, use Process.WaitForExit . This will block till normal or abnormal termination.
Since a terminated process does not signal its wait handles, watching for it won't work because thew ait handle is never signaled (and your Exited event is never fired). You could probably P/Invoke the GetExitCodeProcess and pass the process's handle (from Process.Handle after starting it) to get the exit code returned either from normal or abnormal termination. Knowing when to use it is the trick, though.
Finally, you could always start the application in a separate thread and use Process.WaitForExit . This would allow your thread to continue execution. In the class that you'll thread, create your own event (or use a callback) that you'll invoke when WaitForExit returns.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am trying to control an edit box of a combo in another app.
The apps class name is OtsDJ, and the combo class is "edit".
It is my desire to select the current data in the edit, and replace it with a generated string.
I am having trouble grasping the findwindowex method.
I would like to send a text string to the edit using sendkeys, but would use copy paste method if necessary.
The main issue is grabbing the control on the other app.
Can anyone point me in the right direction?
Jeff
|
|
|
|
|
You can P/Invoke the FindWindowEx API to first find the application and then to find the edit box. Once you get the HWND back (it'll be an IntPtr in managed code), you could also P/Invoke SendMessage to send WM_SETTEXT to it with the lParam parameter set to a string reference:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class Test
{
static void Main(string[] args)
{
if (args.Length < 1) return;
string s = args.Length > 1 ? args[1] : "Hello, world!";
IntPtr ptr = FindWindowEx(IntPtr.Zero, IntPtr.Zero,
null, args[0]);
if (ptr != IntPtr.Zero)
{
ptr = FindWindowEx(ptr, IntPtr.Zero, "Edit", null);
if (ptr != IntPtr.Zero)
SendMessage(ptr, WM_SETTEXT, IntPtr.Zero, s);
}
}
private const int WM_SETTEXT = 0x000c;
[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr FindWindowEx(
IntPtr hWndParent,
IntPtr hWndChildAfter,
[MarshalAs(UnmanagedType.LPTStr)] string lpszClass,
[MarshalAs(UnmanagedType.LPTStr)] string lpszWindow);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern int SendMessage(
IntPtr hWnd,
[MarshalAs(UnmanagedType.U4)] int msg,
IntPtr wParam,
[MarshalAs(UnmanagedType.LPTStr)] string text);
} The one thing you will have to keep in mind is that many times a control is nested. For example, the code above worked on "Calculator" (calc.exe) but not on "Microsoft Internet Explorer" (iexplore.exe) because the first "Edit" control is nested in a "ComboBox" which is nested in a "ReBarWindow32". You could easily modify the code to traverse the children, though. See the doucmentation for the FindWindowEx function for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks!
I'll give this a try.
I should also comment that I can aquire this edit box with a macro program called girder, and send information to it, so I should be able to do the same in my project. Just need the know how!
Jeff
|
|
|
|
|
What's the advantage of typed Datasets?
What's diff between typed and untyped Dataset?
TIA
Promise only what you can do. And then deliver more than what you promised. This signature was created by "Code Project Quoter".
|
|
|
|
|