|
Luc's looks promising. Thanks.
I think I tried one of the automated online converters once...and it came up with line after line of "ya gotta do this part by hand".
|
|
|
|
|
Have a look at x86 calling conventions[^]
I assume that header file is for C++ Builder, and the delphi dll will use what the article calls 'Borland fastcall' which is different from 'Microsoft fastcall' - so you're probably going to need to wrap the functions and expose them using the __stdcall calling convention.
GenJerDan wrote: everything I don't want to know?
Not the most promising attitude for a developer - and calling conventions is something I would think you need to understand.
Best regards
Espen Harlinn
|
|
|
|
|
I've never had to deal directly with DLLs, or at least not to try to use one that wasn't friendly with the rest of the program....and I started I started in 1992 or so.
Push comes to shove, I don't even have have to do this now. I've got Delphi sitting here, too.
I just think it might be a good idea if I didn't have to keep running a virtual machine to write these things. (Delphi 5 won't install on 64bit Windows.)(Yes, I said Delphi 5)
The __stdcall is already there in the header, so I assume the DLL was written to work with it.
|
|
|
|
|
GenJerDan wrote: I've got Delphi sitting here, too
Delphi has always been one of my favourite development tools, I've been using it since version 1 - but, seriously, Delphi 5, that makes me nostalgic.
GenJerDan wrote: I started in 1992
I believe I was working on a C++ IDE for IBM and OS/2 at that time.
GenJerDan wrote: __stdcall is already there in the header
I assumed the code above was from the header file, and I only saw __stdcall in one place.
Go for Delphi XE3[^], assuming you haven't done any magic related to getting notified on object destruction, which was something many Delphi developers did, porting the code should be pretty easy.
Good luck
|
|
|
|
|
Read up on Marshalling and unmanaged code. Normally C# can handle unmanaged code pretty well.
Although it might take some fiddling (searching) .
[EDIT]
Take in account that older code still takes ASCII strings or worse (1 byte vs 2 bytes) and even C# integers can be C++ longs, ...
[/EDIT]
|
|
|
|
|
Since you have the .h and .hpp files for your DLL, you might want to give this a shot. I have used it extensively to help me generate pinvoke signatures. The link for the generator is included on the page.
pinvoke signature generator[^]
|
|
|
|
|
I am a newbie to C#, my development environment is:
Visual Studio 2010 Ultimate Edition
Sql Server 2005
Programming Language C# 2010
I've a form with Unbound Datagridview, from which data is save to Sql Server 2005 by looping through For..Each and pass SQL INSERT Statement when user clicks Save button without any problem.
Now what I need is a way that for same Save button, if data is saved in Sql Server then DataGridView will bind to that records so that if user want to Update/Delete/Add data he/she just need to edit the data and again press Save button. All records will share the same unique ID. It's a products database, and when user click save it will generate a transaction Id same for all products user enter when saving. So I think I need to generate a Select statement and retrieve all those records user save through that Unique ID, but then how to bind it to DataGridView datasource and how to Update/Delete through SqlAdapter or other?
Thanks and best regards
Ahmed
|
|
|
|
|
I'm trying to add Microsoft IObjectSafety Interface to my code. I send string "MyParam" from JavaScript and catch it in my C# code like this:
private string myParam = "Empty";
public string MyParam
{
get
{
return myParam;
}
set
{
myParam = value;
}
}
After I add the IObjectSafety interface this doesnt work anymore, I get error interfaces cannot contain fields. How do I get the MyParam without using fields?
This is the code:
public interface IObject
{
[DispId(1)]
string MyParam; <--- error
};
public class WMC.PlayerLoader : IObjectSafetyImpl, IObject
{
#region [IObject implementation]
private string myParam = "Empty";
public string MyParam
{
get
{
return myParam;
}
set
{
myParam = value;
}
}
#endregion
|
|
|
|
|
Are you sure that an interface[^] is the correct mechanism for your problem?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I need to add the IOBjectsafety interface to get rid of the message ActiveX might not be safe message when using it locally, I don't think there is any other way around that except verisign. All the methods on the interface work fine except getting that string.
|
|
|
|
|
Joni_78 wrote: string MyParam; <--- error
Your implementation of MyParam is a property, not a field. You should declare this as string MyParam { get; set; } in the interface definition (which overcomes the interface containing fields error as well).
|
|
|
|
|
I've newer done this like that before. Do I need to change anything in this, or should it work as it was?
public class WMC.PlayerLoader : IObjectSafetyImpl, IObject
{
#region [IObject implementation]
private string myParam = "Empty";
public string MyParam
{
get
{
return myParam;
}
set
{
myParam = value;
}
}
#endregion
|
|
|
|
|
Nm, I got it now. Thank you 
|
|
|
|
|
You're welcome. I'm glad you got it sorted.
|
|
|
|
|
Hi, i am new to asp.net. i need to display complete URL of my website in web browser. if user navigate to some other page the url must include address of that page too. plz do help..
|
|
|
|
|
Varsha R wrote: Hi, i am new to asp.net
Fair enough, but isn't that a great big hint as to which forum you should post this question in instead?
|
|
|
|
|
|
How do you programmatically expand a url link to its true location?
Do you know about tinyurl.com and baidu.com? Baidu.com is a search engine that tries to discourage people from using their web site to make metasearch engines by hiding their links in a way that is a lot like how tinyurl.com works. TinyUrl.com is a web site where, if you want to present someone with a link to something and that link is long, you can use tinyurl to produce a tiny url for presentation purposes.
Anyway, what I want to do is to find a way to programmatically take the link http://www.baidu.com/link?url=mW91GJqjJ4zBBpC8yDF8xDhiqDSn1JZjFWsHhEoSNd85PkV8Xil7qccoOX3rynaE (the first link in a search for Jessica Alba using baidu.com) and have it return the actual link, http://baike.baidu.com/view/270790.htm . That is just one example. What I want to do is not specific to Jessica but for using Baidu.com as part of my group of search engines in my meta search engine project.
Maybe there is a way of using the WebBrowser class but I did not see a member that was the URL.
Maybe there is a way of using WebRequest and WebResponse.
|
|
|
|
|
By requesting the URL shown on Baidu. Then analyse the response. Somewhere there you'll find the redirection information, either in the HTTP header (e.g. a REDIRECT response code plus the correct URL) or a JavaScript in the HTML document, or something similar.
Do not forget that Baidu could find out that you do too many surch requests, and just stop responding to your requests (e.g. block your IP address).
|
|
|
|
|
I am a VB.NET Programmer learning C#. One of my applications I transfered over to C# via an online converion tool. I am receiving an error which I do not see why it's causing an error.
What I have now is:
try {
if (System.IO.File.Exists(srcedest) == false) {
My.Computer.FileSystem.RenameFile((dest), newName) sheet.Cells(row, 1).value;
}
} catch (Exception ex) {
txtLog3.AppendText(sheet.Cells(row, 1).value);
}
With the error of "expecting ;" at the "sheet" in My.Computer.FileSystem.RenameFile((dest), newName) sheet.Cells(row, 1).value;
Why would this cause an error since you don't put a ";" until the end of a statement?
Thanks in advanced.
daveofgv
modified 27-Nov-12 16:52pm.
|
|
|
|
|
Dunno, maybe remove the newName) and stick a ) just before the ; ?
|
|
|
|
|
Apparently, I can only report you. Spam or Abusive.
The new UI must be a huge success, if it's causing the hamsters so much overtime.
|
|
|
|
|
My.Computer.FileSystem.RenameFile((dest), newName) sheet.Cells(row, 1).value; Your second line isn't the same as the first one. The reason is down to the fact that in the VB line, it's attempting to put sheet.Cells(row,1).value into the optional parameter newName. In your version, you don't do that - so the statement ends after the call to RenameFile.
|
|
|
|
|
Using a parameter name followed by a := means that you create that variable on the fly and assign the value to it. Just think of two statements:
string newName = sheet.Cells(row, 14).value + "_" + sheet.Cells(row, 15).value);
My.Computer.FileSystem.RenameFile(dest, newName);
|
|
|
|
|
Try to change to this line
My.Computer.FileSystem.RenameFile((dest), newName = sheet.Cells[row, 14].value + "_" + sheet.Cells[row, 15].value)
|
|
|
|