|
Well, you can call C# stuff from a C# dll embedded in an HTML page. See this page[^] for more info.
Calling JavaScript from C#, that is something a little more involved. Perhaps you could compile the JavaScript using the Microsoft JScript.NET compiler, then call the .NET methods on the resulting JScript.NET dll.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Hi,
I've tried to integrate a C# library in a C++ program I created using Visual C++ 6.0. I've been able to do this and make it work properly, but it seems the COM object in the C# library is never properly released and I have outrageous memory leaks. Since this C++ program is a service, it doesn't close each time I use it and the leaking just goes on and on. Does anybody have a clue how I could solve this problem?
Thanks a lot!
Francois Dubé
|
|
|
|
|
see System.Runtime.InteropServices.Marshal.ReleaseComObject();
You might need to do this in the Dispose method of your library...
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
My C# object is a COM Interop Object. I am using it in a C++ service. So basically it's the other way around, it's the C# object that doesn't get released.
|
|
|
|
|
To write to Notepad from c# without creating a file I found the following code.
I need this because I dont have write permission on the client but I need to show
the extracted data in the Notepad.
Private Declare Ansi Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32
Private Const WM_SETTEXT As Integer = &HC
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim hwnd As Integer = FindWindow(vbNullString, "Untitled - Notepad") '/// assuming you have notepad open.
Dim x As Integer = FindWindowEx(hwnd, 0, "Edit", vbNullString)
Dim strText As String = "some text"
If Not x = 0 Then
SendMessage(x, WM_SETTEXT, 256, strText)
End If
End Sub
My question is: Is there a way to append text to notepad instead of WM_SETTEXT. I need this because sometimes the data to be extracted is huge and WM_SETTEXT may not suffice.
Live Life King Size
Alomgir Miah
Live Life King Size
Alomgir Miah
|
|
|
|
|
There was a question about this here a few days ago. Look for that.
---
b { font-weight: normal; }
|
|
|
|
|
I was the one who asked the question. I can set text to Notepad but cannot append.
Live Life King Size
Alomgir Miah
|
|
|
|
|
You have to get the current text, append to it, and then set the full text altogether.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I know I can call a dll by c# like this:
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
public static extern int MessageBox(int hWnd, String text,
String caption, uint type);
but now I want to call a lib file created by VC6.0,for example "a.lib".
Could anybody tell me how to do it?
Thanks!
|
|
|
|
|
A lib is not a PE executable, its sole purpose is to link with other library files to generate PE files. I don't see how you can call a method in a lib. You surely would have a dll/exe that has the functions in the lib?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hello,
I'm programming with C#, I did work with the method "Export" of CrystalReport to export data to a file on my disk. this method work prefectly if number of lines isn't more than a limit (exp : 60 000).
so if I have too many lines, an exception is generated : CrystalDecisions.CrystalReports.Engine.DataSourceException.
is there someone how had the same problem?
what can I do too resolve that?
thanks for your help!
|
|
|
|
|
I have an xml document (really simple) and I am trying to to display its content in the datagridview (I am using vs2005 beta2). Actually I know how to display it in the datagrid using dataset, but what I want is only to diplay one or two columns, not all of them. How do I display only one column from the dataset in the datagrid? Thanks
np
|
|
|
|
|
After you've bound your DataGridView to your XML data source, you could go myGrid.Colums.Remove on all columns but the first. There might be a better way to do this though, I don't have a whole lot of experience with the DataGridView.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Hi all,
For a MVC pattern, if the model have changes by another
thread, how can it signal the view to reflect the change immediately ? What is the best pattern to use ?
|
|
|
|
|
Implement events on the business objects (Model) which your forms (View) should subscribe to. Whenever a business object is changed it should fire an event and whatever forms are interested in the change will be notified and can update itself.
/Patric
My C# blog: C# Coach
|
|
|
|
|
Thanks for your reply.
Are there any sample codes or reference on this kind of
implementation ?
|
|
|
|
|
I have read the identity map pattern in the book "Patterns of enterprise application architecture".
But I have one question as below,
1. for the "Identity map" pattern in P.198 example,
it add the created object onto the map, but how it is removed when the object usage
is completed ? And if there are more than one consumer using the object, how do we
know it is right to remove the object in the map ?
Thanks for you help
|
|
|
|
|
let's say, Clients are installed in some remote locations (windows based application). all clients are connecting the same RDBMS data store via some component/serivice . but, instead of using tcp/ip protocal. Is there a way to notify the clients that the data changed in RDBMS data store .
Regards
Narayan
|
|
|
|
|
Have a server/service running on the same machine as the database, have clients talk through the server to send/receive data. Thus the server application can notify clients of changes via remoting or sockets.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Below is the sample xml analgous to mine,
"=============
<code><INVENTORY>
<BRANCH CODE='BC1'...>
<DEPTS>
<DEPT CODE='DC1'>
<EMP NAME='A' ...>
<EMP NAME='B' ...>
</DEPT>
<DEPT CODE='DC2'>
<EMP NAME='E' ...>
<EMP NAME='F' ...>
</DEPT>
</DEPTS>
</BRANCH>
<BRANCH CODE='BC2'>
...
</BRANCH>
</INVENTORY>
</code>==========="
Now, I am trying write a function which says an employee with name xxx belongs to Dept xxx or not? taking two parameters, <code>DEPT_NODE</code> and <code>EMPNAME</code> as parameters. I can not change the signature as its from top.
how to write an Xpath query for that?
Thanks for anticipation.
Regards.
MaulikCE
<pre></pre>
|
|
|
|
|
Try this:
<code>
//DEPT[@CODE="DC1"]/EMP[@NAME="A"]
</code>
----------------------
~hamster1
|
|
|
|
|
Hi everybody,
I actually work on a big application (VC6, MFC), and I need working with the Viamichelin Web Service through SOAP (http://ws.viamichelin.com/wswebsite/fra/jsp/tec/MaDocumentationGeo.jsp).
My first idea is the development of a VSNET 2005 dll, in C++, to do the bridge between the 2 worlds. Some try are ok, with very simple WSDL (input string -> output string). Unfortunally, Viamichelin WSDL are too complex (or I don't understand something...) to be used from C++ (error SDL1030 when adding Web Reference).
WSDL example is here...
http://www.viamichelin.com/ws/services/GenerateMap?wsdl
JScript cannot be a solution too, there is an error in the MSSoapInit.
Other try is a C# project. The web reference is ok, but how can I do :
- a 'true' dll from the C# project ?
- export some functions which are accessibles from my VC6 project ?
Do you have an idea to do what I need ? The answer "do all the portage of VC6 to VSNET 2005" is not a solution, we cannot have such time to redo our non-regressions tests...
Thanks in advance
Thierry Maurel
Isotools Project Manager
|
|
|
|
|
You can host the CLR in your app. You will then be able to load and call into managed dlls. Try searching for hosting and CLR. If you don't find what you're looking for, post back and I'll try to hook you up with an example.
--
Joel Lucsy
|
|
|
|
|
In the C# DLL do something like
using System;
using System.Windows.Forms;
using System.Data;
using System.Collections;
namespace TestDotNet
{
///
/// Summary description for Class1.
///
[Guid("43A8EB80-A566-4985-BEDE-58312478029D")]
public interface ISearch
{
string ShowAdvancedSearch();
string[] GetSearchData(string inputXml);
string GetXmlSearch();
}
}
Implement the interface. When you build it, the DLL is automatically registered. It uses tlbexp.exe internally.
Hope this helps.
Live Life King Size
Alomgir Miah
Live Life King Size
Alomgir Miah
|
|
|
|
|
Hi,
I have written a cutsom TypeConverter which derives ExpandableObjectConverter which is used for a custom type descriptor. The custom type descriptor overrides the GetProperties function to return a dynamically created PropertyDescriptorCollection.
This call works great in that when I set my custom object into a property grid it all displays dynamically as expected, except for one little annoyance: Even if I return an empy PropertyDescriptorCollection in the GetProperties function of my derived ICustomTypeDescriptor class, I still get the little plus sign next to the property! So in other words, I just can't seem to get the plus sign to disappear on types which have no properties.
Can anyone please shed any light on this for me?
Shane
|
|
|
|