logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ty_moore  
#1 Posted : Tuesday, March 7, 2006 7:34:50 PM(UTC)
ty_moore

Rank: Newbie

Groups: Registered, Registered Users
Joined: 2/7/2006(UTC)
Posts: 3

Anyone know where I can get a sample C# DLL that uses MDK?
StorkBite  
#2 Posted : Wednesday, March 8, 2006 5:07:47 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
If you mean a sample MS function that uses C++, there are samples here on the forum and also an abundance in the MDK User's Manual. As far as C# goes, it is very similar to VB. Unfortunately, there is not much documentation that goes with that; however, there are a few simple code samples on the disk written in VB. It sort of depends on what you are wanting to do... Addendum- Someone asked about the similarities. I'm not a programmer, but I've been working with BASIC since the late 1970's... IMO, it is very close; much easier to interpret than C++... to me! There are about a million comparative samples in the MSDN, but here is one: [code:1:095491451e][Visual Basic] Private Sub FindAllOfMyString(ByVal searchString As String) ' Set the SelectionMode property of the ListBox to select multiple items. listBox1.SelectionMode = SelectionMode.MultiExtended ' Set our intial index variable to -1. Dim x As Integer = -1 ' If the search string is empty exit. If searchString.Length <> 0 Then ' Loop through and find each item that matches the search string. Do ' Retrieve the item based on the previous index found. Starts with -1 which searches start. x = listBox1.FindString(searchString, x) ' If no item is found that matches exit. If x <> -1 Then ' Since the FindString loops infinitely, determine if we found first item again and exit. If ListBox1.SelectedIndices.Count > 0 Then If x = ListBox1.SelectedIndices(0) Then Return End If End If ' Select the item in the ListBox once it is found. ListBox1.SetSelected(x, True) End If Loop While x <> -1 End If End Sub[/code:1:095491451e][code:1:095491451e][C#] private void FindAllOfMyString(string searchString) { // Set the SelectionMode property of the ListBox to select multiple items. listBox1.SelectionMode = SelectionMode.MultiExtended; // Set our intial index variable to -1. int x =-1; // If the search string is empty exit. if (searchString.Length != 0) { // Loop through and find each item that matches the search string. do { // Retrieve the item based on the previous index found. Starts with -1 which searches start. x = listBox1.FindString(searchString, x); // If no item is found that matches exit. if (x != -1) { // Since the FindString loops infinitely, determine if we found first item again and exit. if (listBox1.SelectedIndices.Count > 0) { if(x == listBox1.SelectedIndices[0]) return; } // Select the item in the ListBox once it is found. listBox1.SetSelected(x,true); } }while(x != -1); } }[/code:1:095491451e]
Branden Russell  
#3 Posted : Monday, March 13, 2006 10:44:10 PM(UTC)
Branden Russell

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/28/2005(UTC)
Posts: 276
Location: Salt Lake City, UT

C# doesn't compile Win32 DLLs that are required for MetaStock MSX. We(Equis) don't officially support C# for this reason (and it wasn't around when the Developer's Kit was written). That being said, you may still be just fine getting it to work in C#. I have written C# MSX DLLs, but they cause problems. With the way MetaStock and .NET are, you can't unload a .NET DLL in MetaStock once it has started. So, you can't upgrade, export, import, etc, your MSX DLLs once you get a .NET MSX DLL running. I don't believe I have tried a C# MSFL program. C# may be better suited for that task.
Patrick  
#4 Posted : Tuesday, March 14, 2006 2:07:50 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Sorry Branden, not trying to bust your chops but I'm interrested in this too ... What you said is contradictary:
Quote:
C# doesn't compile Win32 DLLs that are required for MetaStock MSX.
K fair enough, I could find it either so I figured it is impossible to write a MSX dll with C#
Quote:
I have written C# MSX DLLs
Why if you already know it is not possible? :eek: How did you try to do it? I'm interrested to see the Project or the code if you are willing to share it ...
Quote:
That being said, you may still be just fine getting it to work in C#.
Which is it then? Should we just say you can't do MSX dll with C# and stay with that? Again I don't know so I'm asking you ... Patrick :mrgreen:
Branden Russell  
#5 Posted : Tuesday, March 14, 2006 3:09:15 PM(UTC)
Branden Russell

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/28/2005(UTC)
Posts: 276
Location: Salt Lake City, UT

Nothing I said is contradictory, but I understand your confusion. C# doesn't compile the required Win32 DLL. It compiles down to .NET DLLs. Which, while they mostly work, will have the problems I mentioned in my last post. Why did I write a DLL in C#? Because I was trying to write one of our plugin DLLs that we recently released in C#. It didn't work out for a few reasons, including the ones I mentioned about the problems with C#, so it ended up being written in C++. At the time, we wanted to use some features of .NET and hoped that it would end up working and when it wouldn't, Microsoft confirmed it for us that it wasn't going to work right. Unfortunatly, the sample I have is code I started for a plugin we released. So, if I have the code still, I can't release it as is. I'll look if I still have the code, since I may have thrown it out when it ended up not working, and clean out everything except a basic shell for you guys to see.
Patrick  
#6 Posted : Tuesday, March 14, 2006 3:19:21 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Thank you for clearing it up :) I have more questions now then :lol: So you can write a .NET dll that will load/unload with Metastock. And you did one that mostly worked ...
Quote:
With the way MetaStock and .NET are, you can't unload a .NET DLL in MetaStock once it has started. So, you can't upgrade, export, import, etc, your MSX DLLs once you get a .NET MSX DLL running.
So is that the only problem ... Does not seem that bad ... Or am I missing so extented issues that arise because of this? ( besides import and exporting MSX dlls) I would love to get the shell, to help me get started with C# Thanks Branden. Patrick :mrgreen:
Branden Russell  
#7 Posted : Tuesday, March 14, 2006 3:30:00 PM(UTC)
Branden Russell

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/28/2005(UTC)
Posts: 276
Location: Salt Lake City, UT

Yes, you can write a .NET DLL in C# that will (un)load with MetaStock, but not any other time while MetaStock is running. For a user writing their own DLL, no, that might not be that big of a deal. For someone writing a DLL to sell or give out to people, that is a very big deal. The idea has always been that you could upgrade, export, import DLLs with MetaStock working and a .NET DLL breaks that since it won't shut down while MetaStock is running. There may have been other problems, but I can't remember if I found a way to fix them. I do remember it being quite a hassle to get C# to work because of the problems. I think it was that I couldn't debug the DLL by walking through the code while it ran. It crashed if I did that. So with that, it may be that the .NET DLLs aren't stable being used as if they were Win32 DLLs.
Branden Russell  
#8 Posted : Tuesday, March 14, 2006 3:38:21 PM(UTC)
Branden Russell

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/28/2005(UTC)
Posts: 276
Location: Salt Lake City, UT

I found the code. Darn. I'm sorry. It wasn't a C# DLL that I wrote. It was C++.NET. So, it was still a .NET DLL and not a Win32 DLL, but it was written in C++, not C#. I thought I had done a C# one.
nobel_1101  
#9 Posted : Friday, June 16, 2006 8:56:05 AM(UTC)
nobel_1101

Rank: Member

Groups: Registered, Registered Users
Joined: 5/17/2005(UTC)
Posts: 24
Location: London

Branden Russell wrote:
I think it was that I couldn't debug the DLL by walking through the code while it ran.
Hi Branden I was wondering if you could help me. You mention that you can debug your Win32 DLL by walking through the code while it runs, how are you able to do this? At the moment I only know how to test my DLLs in a compiled form, with MSXTest or Metastock, so I'm unable to walk through the code while its processing. Cheers Craig
nobel_1101  
#10 Posted : Monday, July 3, 2006 12:56:13 PM(UTC)
nobel_1101

Rank: Member

Groups: Registered, Registered Users
Joined: 5/17/2005(UTC)
Posts: 24
Location: London

Don't worry I've figured out how to use the debug tool now. Thanks Craig
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.