|
Thanks for the info. I'll look into and see if it helps.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
How do I create a C# control that can run in a web-browser on the client side.
I am working on a project where it has been specified that if it can be done in C# it must be.
I don't fancy having to implement all the interfaces myself - it'll be like going back to the old days of OLE - shudder. I am sure there must be a quicker way embedded in .NET - but I just can't find the wood for the trees.
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsIeSourcing.aspx
|
|
|
|
|
|
thanks - I knew I was missing something - so they altered the object tag to do something clever - do you know what versions of IE that works on?
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
Shaun Wilde wrote:
do you know what versions of IE that works on?
I *think* it is version 5.0 and up; of course the .NET runtime still needs to be installed on the client.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
I want to be able to create a range of objects using an Eval statement, but the name is not recognized.
I'm creating a C# program using the .NET framework, and the compilers doesn't know what eval means.
I'm trying to use a DataSet to create a bunch of objects using code similar to:
Eval("TreeNode node" + ds.Tables["tableName"].Rows[i]["field1"].ToString() + " = new TreeNode(\"" + ds.Tables["tableName"].Rows[i]["field2"].ToString() + "\")");
But that's not gonna pass it seems.
How can I achieve the desired affect using C# and the .NET Framework?
I'm currently researching the System.Reflection class to see what my options are there. Any help from the outside world would be a great thing =)
--chajadan
aka charlie
|
|
|
|
|
Type t = Type.GetType("System.Windows.Forms.TreeNode");
object[] param = new object[0];
ConstructorInfo[] ci = t.GetConstructors();
object o = ci[0].Invoke
(BindingFlags.CreateInstance,null,param,null);
Be sure to pass param with expected binding for one of the TreeNode constructor (in your case, that's a String object).
|
|
|
|
|
Somewhere in the back of my head I remember seeing a VB.Net to C# converter project, but I have looked everywhere and cant find it again.
Has anyone heard of this?
Any help will be great.
PS: If I am dreaming, writing something like that cant be too hard, I dont know VB/VB.Net but I find converting code manually between VB.Net and C# quite boring, basically C# in reverse and all those pesky Capped keywords.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
There is no VB to C# converter; the reverse exists but I don't have a current pointer.
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2001 Microsoft Corporation. All rights reserved.
|
|
|
|
|
|
I take it back
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2001 Microsoft Corporation. All rights reserved.
|
|
|
|
|
Nick Hodapp (MSFT) wrote:
I take it back
hmm, both does the same, but thanx for the replies
Time to start the VB.Net to C# project then
Or maybe one of you MS guys can beat me to it.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
My take on the whole thing is rather use C# from the beginning.
Trolling, sure, but C# has always seemed to have more backing by MS and I hear the only reason why VB hasn't died is that it's Bill's baby.
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
SimonS wrote:
My take on the whole thing is rather use C# from the beginning.
I agree, but unfortunately there are quite alot of good code being published in VB.Net format
So now i have to manually parse files and change the structure, eg it took me 2 1/2 hours just to convert a 1700 line VB.Net class, excluding loops and other VB specifics, that normally would take just as long.
The thing is, in CLR its all the same. Then you can use Anakrino to view the code. That said, it does crash in some parts (maybe vb specific stuff???)
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
leppie wrote:
I agree, but unfortunately there are quite alot of good code being published in VB.Net format
That's funny, this is the major reason I was learning C# (because I keep finding alot of good code written there )
|
|
|
|
|
first of all i start a process by process start method
and then i get its parent and then child hwnd but now what want is that
if i have a button hwndle on a processs main window how to
check that this button is clicked or not or any other operation is performed on it or not.
and if i want to generate any mouse event let say mouse click event then how to generate it or any other message?
Remember that i have only the button hwndle do not have its object .
r00d0034@yahoo.com
|
|
|
|
|
Your project looks very much like a non .Net project, full with "hwnd" and so on.
I would recommend to choose a lower-level language such like C++/MFC that looks more adequate.
If you've got to stick with C#, you've got at least two choices :
- use interop, such as the code shown in the other thread
- use MessageQueue, which is a reliable messaging tunnel. I just gave a look and the .Net framrwork QuickStart tutorials are just helpful to start with. MessageQueue will not do everything, you'll have to do plummering between queues and the actual message subscribers/senders.
get to www.dotnet247.com. This server is almost as down as codeproject, but it is full of useful code snippets and revelant answers.
|
|
|
|
|
when i execute that line compiler coulde not recognise HWND structure what to do?
HWND h =(HWND)m_Handle.ToInt32();
r00d0034@yahoo.com
|
|
|
|
|
This object does not exist is C#. Use any int instead :
(from MSDN)
public static bool Report(int hwnd, int lParam) {
Console.Write("Window handle is ");
Console.WriteLine(hwnd);
return true;
}
|
|
|
|
|
but if i have to call vc++ sendMessage then i have to provide a valied hwnd .
i f not like that how to do it?
r00d0034@yahoo.com
|
|
|
|
|
I am afraid there is no more windows messaging API in C#. I guess you have to use interop and pass the HWND to lower-level code to send the message for you.
Here we go : (MSDN)
public class NativeMethods
{
public NativeMethods(){}
[StructLayout(LayoutKind.Sequential)]
public struct CopyDataStruct
{
public string ID;
public int Length;
public string Data;
}
[DllImport("user32.dll", EntryPoint="FindWindow")]
public extern static System.IntPtr FindWindow(string lpClasName,
string lpWindowName);
public const int WM_COPYDATA = 0x004a;
[DllImport("user32.dll", EntryPoint="SendMessage")]
public extern static int SendMessage(System.IntPtr hWnd,
int Msg, int wParam,
ref CopyDataStruct lParam);
}
private void SendingForm_Load(object sender, System.EventArgs e)
{
ReceivingForm rec = new ReceivingForm();
rec.Show();
}
private void button1_Click(object sender, System.EventArgs e)
{
NativeMethods.CopyDataStruct DataStruct = new NativeMethods.CopyDataStruct
();
DataStruct.ID = "1";
DataStruct.Data = "Sample Text";
DataStruct.Length = DataStruct.Data.Length;
IntPtr WHnd = NativeMethods.FindWindow(null, "ReceivingForm");
if(!WHnd.Equals(System.IntPtr.Zero))
{
NativeMethods.SendMessage(WHnd, NativeMethods.WM_COPYDATA,
0, ref DataStruct);
}
}
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case(NativeMethods.WM_COPYDATA) :
NativeMethods.CopyDataStruct ds =
(NativeMethods.CopyDataStruct)m.GetLParam(typeof
(NativeMethods.CopyDataStruct));
string s = ds.Data;
break;
default :
break;
}
base.WndProc(ref m);
}
|
|
|
|
|
You can get the Handle to the main window of a process from the "System.Diagnostics.Process" class. It has a "MainWindowHandle" property. Don't know if this helps, but hopefully it will
m
|
|
|
|
|
anybody done or know of anything fancy done with this.
the templates in visual studio aren't bad but they seem to ignore the <exception> and <example> fields amongst others
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
Go to http://www.gotdotnet.com/team/csharp, choose tools and utilities on the right. There are a couple of better programs there.
|
|
|
|