|
Hi all,
I've been using C++ for almost everything I've done in software development, Windows or otherwise. It is only recently I've looked into .NET and C# in depth. I have a few questions that someone can hopefully shed some light on.
The main question really, is if .NET can be used somewhat like a script engine for an (unmanaged) application. For example, most games embed a scripting engine such as Lua, Tcl, or even Java in the application to allow themselves and the end users to modify the game itself, extending its replay value.
While perusing through the .NET docs, I noticed that you can dynamically load assemblies during runtime. This is where I got the idea.
Also, is there a way to have a piece of code compiled into bytecode and executed during runtime, similar to an eval() function?
-Maki
|
|
|
|
|
|
Also, JScript.NET is a .NET language, and still included the .eval method. But yeah, C# or any other .NET language should be able to dynamically execute code.
---------------------------
He who knows that enough is enough will always
have enough.
-Lao Tsu
|
|
|
|
|
Hello,
is there a way to derive C# classes form C++ classes. The C++ classes are within a MFC or standard DLL.
Thanks Maxim
|
|
|
|
|
I would have thought not. But you should be able to do it if you create a Managed C++ DLL.
Kevin
|
|
|
|
|
What would be the best place to start to implement registration for an application I have written in .Net. I would like for the application to be disabled a year after registration until a new license has been arranged.
Mike
|
|
|
|
|
Hi,
I am working on VB.NET. And used treeView and RichTextBox to dispaly the details. When I clicked the treeView node, the details of the node are displayed in the RichTextBox and some other controls. Now I selected some text in the RichTextBox and made bold and underline. Now I want to save and retrive the same. When I used RichTextBox.Rtf, then the text is converted to rtf format, but when I retrive the same and want to display in the RichTextBox again, I need to convert back to text with Bold or Underline as I set earlier.
I could set Bold and Underline to the selected text in RichTextBox using Font dialog box.
Can any one help me in doing this.
Thanks,
Sree
Sreepathi Rao
|
|
|
|
|
Your question is not very clear, how do you exactly you want to store your rtf? You can save it as file with RichTextBox.SaveFile() method.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
Hi Mazdak,
Thanks for your reply. Actually I have some nodes in a TreeView, and RichTextBox control on a frame. Now as I navigate through the records in the treeview, the details of the node text are displayed in the RichTextBox. I selected the text in the RichTextBox and made Bold and some text to Underline. Then when I tabOut of the RichTextBox, the details are updated to the respective TreeView node. When I select the same TreeView node I would like to see the same text with Bold or Underline(what ever I set for the text).
For this I have written that
TreeView.SelectedNode.Text = RichTextBox.Rtf, but when I tabbed out of the RichTextBox then the TreeView node text is changed to Rtf format I think. And it is not readable and having all {.../b.../u...} etc. When I click the TreeView node again the RichTextBox also displays the same in the Rtf format and which can not be readable.
I hope you got my problem. Can you help me in this please.
|
|
|
|
|
try the following solution:
set
treeview.selectedNode.text = richtextbox.text and
treeview.selectednode.tag = richtextbox.rtf
and retrieve
richtextbox.rtf = treeview.selectednode.tag
the hope dies at last
|
|
|
|
|
Thanks for the answer. Actually can you give me a method which will translate the Rtf formatted string to stadard text, as I am going to use the same on different controls, which are not having Rtf property with them.
I am looking for a method which can translate both ways, i.e. if I send Rtf then it should return Standard string and If I send Standard string it should send Rtf formatted string.
Thanks
|
|
|
|
|
I tried to construct my first web-control using vb. I named it CatTree and derived it from the TreeView out of Microsoft.Web.UI.WebControls. For Testing I make a vb web Testapplication. It runs fine. I can add my CatTree-Control to the Toolbar and can place it on the Web-Form.
Now I sent the control to my partner for further testing. Unfortunately he is a C# - fan und tried to use the control in a C# Web. It fails with:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'CatTree' does not exist in the class or namespace 'CatTree.CatTree' (are you missing an assembly reference?)
Source Error:
Line 85:
Line 86: private System.Web.UI.Control __BuildControlCatTree2() {
Line 87: CatTree.CatTree __ctrl;
Line 88:
Line 89: #line 17 "c:\inetpub\wwwroot\TestWebControl_C\WebForm1.aspx"
Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\testwebcontrol_c\105dcde8\29beb7c7\ytfyaxo4.0.cs Line: 87
What goes wrong?
|
|
|
|
|
Hi, I had a problem with socket permission.
I have created a server that has leaves its port opened to clients and telnet applications.
Clients can run succesfully if they stay in the same machine (localhost). Telnet on local host to the server port can be connected too.
However, if I tried to connect to the server port from another machine in the intranet, I won't be able to connect.
I've tried many ways, I've set the trust region of intranet to full trust, I've made instances of SocketPermission:
SocketPermission mySocketPermission1 = new SocketPermission(PermissionState.Unrestricted);
SocketPermission mySocketPermission = new SocketPermission(NetworkAccess.Accept, TransportType.Tcp, "192.168.*.*", SocketPermission.AllPorts);
But, why can't remote clients (hyperterminals / telnet) connect?
For your information, I'm using asynchronous sockets for my server application. Is the problem related with the socket permission, or is there any other possible problems, i.e. wrong class library usage. Thanks.
|
|
|
|
|
Ran into this while trying to interoperate with an existing socket based server...
i need to construct a buffer that contains mixture of strings & ints - the shorts/ints are stored in network byte order. So, i came with the following P/Invoke declaration in C#.
<br />
#region P/Invoke stuff<br />
[DllImport("ws2_32.dll")]<br />
private static extern short htons(short value);<br />
<br />
[DllImport("ws2_32.dll")]<br />
private static extern long htonl(short long);<br />
#endregion<br />
Unfortunately, the compiler barfs - says "expected class, delegate, enum, interface or struct". It looks like it doesn't like the return value specified as short or int. They are blittable types & i'm not sure what it doesn't like about them. Any pointers? TIA
Chen Venkataraman
|
|
|
|
|
Sorry i had a typo... the code should have been
<br />
<br />
#region P/Invoke stuff<br />
[DllImport("ws2_32.dll")]<br />
private static extern short htons(short val);<br />
<br />
[DllImport("ws2_32.dll")]<br />
private static extern long htonl(long val);<br />
#endregion<br />
<br />
Chen Venkataraman
|
|
|
|
|
You have to declare them as a part of a class:
namespace MyNamespace
{
public class MyClass
{
#region P/Invoke stuff
[System.Runtime.InteropServices.DllImport("ws2_32.dll")]
private static extern short htons(short val);
[System.Runtime.InteropServices.DllImport("ws2_32.dll")]
private static extern long htonl(long val);
#endregion
}
}
They cannot be a member of the namespace directly (ie the following code will make the compiler barf in the way that you described)
namespace MyNamespace
{
#region P/Invoke stuff
[System.Runtime.InteropServices.DllImport("ws2_32.dll")]
private static extern short htons(short val);
[System.Runtime.InteropServices.DllImport("ws2_32.dll")]
private static extern long htonl(long val);
#endregion
}
--
Russell Morris
"So, broccoli, mother says you're good for me... but I'm afraid I'm no good for you!" - Stewy
|
|
|
|
|
duh... i gave up after struggling with it for a day. And i've done P/Invoke stuff before & usually could make sense of what the compiler thought was wrong - with this one, i just lost it! Silly me!
Thanks.
Chen Venkataraman
|
|
|
|
|
Hello all !
I am about to develop an application which purpose is to edit information of one or a couple of days...
Here is the approximative final look it should have :
Month --------Janvier----------- ...
Days --Mon--Tue--We--Thu -- ...
Day -- 01 -- 02 -- 03 -- 04 -- ...
Color --Bl -- Wh -- Gr -- Red--...
Price -- 12-- 10 -- 11 -- 12 --...
So let me explain a few things :
- each day is set in a column of a grid (separated by '--' here) and the day of week are drawn on a blue background whereas the WE are green
- please point out the first title column which will be always visible
- the column width is constant whatever the screen width and no scrollbar are visible so that we can browse throught days by clicking around on the calendar (first 3 rows) by implementing the onclick event
- No keyboard edition is allowed. The inputs are made by click or click&drag on the 2 last rows (color&price) depending upon a parameter box previously filled. Like painting on the calendar with the mouse if you see what I mean...
- No selection control should be visible on this grid
- The whole thing should be smooth enough to use for us to feel comfortable.
- the original datas are retrieved using a web service that returns a typed dataset with a row by date.
- another request should be made and datas should be added to the original datas
All that is very beautiful but... there are issues....
So here are my problems :
Should I use a datagrid with columnstyle or draw it by myself on a paintbox ?
What's the best way to implement the databinding between the retrieved dataset and the datagrid (in case I use a datagrid !!) which are reverse in fact (date in rows and date in cols) ?
In case I use a datagrid, should I bind a blank matrix to it in order to fix the number of rows and columns and draw the values retrieved from another dataset, or should I transform the retrieved from WS dataset for it to fit the datagrid orientation ?
Here we are for the moment...
If you have any suggestions or ideas on how to improve or implement my application, feel free to inform me !
Thank you in advance for all and have a good day !!!!!
Guim7
--diving in the abyss of C# and .NET--
|
|
|
|
|
Nobody has a clue ???
please help me!!!!
Guim7
|
|
|
|
|
Hi,
Does anyone know if it is possible to replace an existing COM server with a .NET server without having to rebuild the existing COM clients?
Any help or pointers would really be appreciated,
cheers
Jamie.
|
|
|
|
|
Someone here is very likely much more knowledgable about it... but I can say that it should not require a rebuild if the interface definition does not change. That said, however, I can't imagine you can keep the exact calling semantics between ATL COM or VB OCX and .NET. The types, if nothing else, will probably be different enough to cause a problem... maybe not. Try it. It shouldn't be difficult to code a minor test.
|
|
|
|
|
COM Callable Wrappers (CCW's) - check it out.
HTH
There are only 10 kinds of programmers - those who understand binary, and those who don't.
|
|
|
|
|
Hi All
What is nmake used for?? Can anyone give me an example for its usage ???
Thanxs
Maharishi
Nothing is Impossible. Even impossible spells "i m possible"
|
|
|
|
|
nmake is a build environment tool which uses a "makefile" to execute build instructions. The "makefile" contains variables and commands. Here you go: NMAKE Reference.
|
|
|
|
|
I'm writing a plug-in in VB.NET to a an application called DesktopSidebar for Windows. Right clicking my plug-in's "panel" shows among other things a Properties Dialog. All I need to do is pop up the dialog in the proper place and on the same monitor in a multiple monitor environment. My plug-in doesn't appear at this point to have the Window handle of the calling application. After quite a bit of trial and
error I came up with this:
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Int32,
ByRef lpRect As RECT) As Int32
Public Structure RECT
Dim Left As Int32
Dim Top As Int32
Dim Right As Int32
Dim Bottom As Int32
End Structure
Dim colProcess() As System.Diagnostics.Process
Dim oProcess As Diagnostics.Process
colProcess = Diagnostics.Process.GetProcessesByName("sidebar")
If colProcess.Length > 0 Then
oProcess = colProcess(0)
Dim handle As System.IntPtr = oProcess.MainWindowHandle
Dim loc As RECT
If GetWindowRect(handle.ToInt32, loc) > 0 Then
'Where are we docked?
If loc.Left = 0 Then
Me.Location = New Drawing.Point(loc.Right,(loc.Bottom -
loc.Top)/2)
Else
Me.Location = New Drawing.Point(loc.Left - Me.Width,
(loc.Bottom - loc.Top)/2)
End If
End If
End If
This works great as long as you have a single monitor, whether DesktopSideBar is docked to the Left or the Right. However, I run in a
multi-monitor environment. In my particular setup my primary display is my laptop and my secondary display actually hovers ABOVE my primary display (it's a 19 inch monitor) and I have my desktop extended onto it. The code above, only targets the primary display, even though I dock DesktopSideBar on my secondary monitor. My screen coordinates are still good... just not on the right monitor.
Could anyone offer up some suggestions on how to not only determine the monitor my panel is on, but also how to set the location of my dialog to a specific place on the proper monitor?
|
|
|
|