|
I'm by no means a COM expert, but did you call regasm so that COM knows where to find your code?
If that doesn't work, I'd suggest asking on the microsoft.public.dotnet.frameworks.interop newsgroup.
|
|
|
|
|
Bog wrote:
I then called a com method, IPersistMoniker.Load, and passed it my IMoniker object. I get a generic error, System.ExecutionEngineException
If I remember correctly, MS reps have said that if you *ever* get an ExecutionEngineException it is considered a bug in the framework. Hopefully our resident MS dev will come by again soon
I'm not a COM guru so I'll just leave it at that then waste your time.
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
thank you, you didn't waste my time at all- knowing that this might not be my fault and could be a bug in the framework is VERY helpful. it means i can go do other stuff rather than banging my head on the screen.
thanks
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
how can i close a application from within a seperate .exe when the seperate .exe is done doing its tasks.
(exsample: a update program is what im shooting for. it is a compiled .exe but when the downloads are complete i want to close the program it is going too update from within the update program itself. does System.Diagnostics have a close funtion or something?)
|
|
|
|
|
Do not know if the C# libs have such a command but you could use the Windows API to do the same. Sending a WM_CLOSE to the window of the other application is one way.
This could be of help. If C# does have a function, It will probably be calling some Windows API. Just a hunch.
http://support.microsoft.com/default.aspx?scid=KB;en-us;q178893
|
|
|
|
|
so i need to get the proccess id of the application i want to shut down ? then what... is that in the System.Diagnostics class. i found ProcessModule.EntryPointAddress could i find the process id from that? or is it in ProccesModule.EntryPointAdress
|
|
|
|
|
See this example on CP
http://www.codeproject.com/csharp/runninginstanceie.asp
It will show you how to enumerate through windows and then how to close them. The example talks about IE windows, you will need to search for the window with your processID rather than a module name of IEXPLORE. Hope this helps.
|
|
|
|
|
I think you can use the System.Diagnostics.Process class. It has a method that will allow you to get the process id of an application based on its window caption. Then you can shut down that process.
|
|
|
|
|
Ranjan Banerji wrote:
This could be of help. If C# does have a function, I will probably be calling some Windows API. Just a hunch.
You would need to use P/Invoke to send the WM_CLOSE message in C#. You will need the handle to the current running executable for this as well.
public const int WM_CLOSE = 0x0010;
[DllImport("user32.dll",CharSet=CharSet.Auto)]
static public extern long SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
I have a property in a class, lets pretend that its called Foo.Message . Now i only want the class [or classes derived from] Bar to be able to get/set the property, but i want all other classes to be able to get the property. can this be done?
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Nnamdi Onyeyiri wrote:
Now i only want the class [or classes derived from] Bar to be able to get/set the property, but i want all other classes to be able to get the property. can this be done?
Nope
For some reason MS decided not to let the get/set methods have different visibility modifiers.
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Damn. I think im gonna pay a visit to Redmond
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
i created a class that i use as a display when errors occure in my program (in place of the messageboxclass). my question is how can import let alone play the standard messagebox sounds (like for question,asterisk,error,ect).
thanks alot.
jesse m
|
|
|
|
|
You can get the wave files configured on the system by looking at the following registry branch:
HKCU - AppEvents - Schemes - Apps
Under there you will see a series of 'System' settings:
SystemAsterisk
SystemExclamation
SystemHand
SystemQuestion
As far as playing them, I belive that you are stuck using the windows MM APIs or some other method. I am not sure if the .NET framework has a set of methods to play waves or not.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
Could you maybe derive your class from the MessageBox class?
Why waste time learning when ignorance in instantaneous
-Hobbes
|
|
|
|
|
Hi All,
I'm stuck with a problem serializing and de-serializing an array. I'm hoping somebody will be able to help me with. I'm trying to serialize an array of my custom class Query to a file. But when I check the file, I can only see one query in there. And when I try to de-serialize it I get an error saying Object doesn't implement IConvertable.
Does anyone have any idea what I am doing wrong? I've put the code below, maybe yee'd like to compile it and check what’s going wrong?
Thanks,
Donal
using System;<br />
using System.IO;<br />
using System.Runtime.Serialization;<br />
using System.Runtime.Serialization.Formatters.Soap;<br />
using System.Collections;<br />
<br />
<br />
<br />
namespace ProjQueryManager<br />
{<br />
class QueryManager<br />
{<br />
public QueryList qList;<br />
string sourceFile = @"C:\source1.dta";<br />
<br />
public QueryManager()<br />
{<br />
qList = new QueryList();<br />
}<br />
<br />
public bool CheckQuerySourceFile()<br />
{<br />
return true;<br />
}<br />
<br />
public void addQuery(Query QueryInfo)<br />
{<br />
qList.Add(QueryInfo);<br />
}<br />
<br />
public bool LoadFile()<br />
{<br />
FileStream inStream = new FileStream(sourceFile, FileMode.Open, FileAccess.Read);<br />
StreamReader sReader = new StreamReader(inStream);<br />
SoapFormatter soapReader = new SoapFormatter();<br />
if(qList != null)<br />
qList = null;<br />
qList = (QueryList) soapReader.Deserialize(inStream);<br />
inStream.Close();<br />
<br />
foreach(Query q in qList)<br />
q.PrintInfo();<br />
return true;<br />
}<br />
<br />
<br />
public bool SaveQuerys()<br />
{<br />
FileStream outStream = new FileStream(sourceFile, FileMode.OpenOrCreate, FileAccess.Write);<br />
try<br />
{<br />
SoapFormatter soapWriter = new SoapFormatter();<br />
soapWriter.Serialize(outStream, qList);<br />
outStream.Close();<br />
}<br />
catch(SerializationException sem)<br />
{<br />
outStream.Close();<br />
Console.WriteLine(sem.ToString());<br />
}<br />
<br />
return true;<br />
}<br />
<br />
public bool SaveQuerys2()<br />
{<br />
try<br />
{<br />
ArrayList temp = new ArrayList();<br />
temp.Add("howdy");<br />
temp.Add("partner");<br />
<br />
FileStream outStream = new FileStream(sourceFile, FileMode.OpenOrCreate, FileAccess.Write);<br />
SoapFormatter soapWriter = new SoapFormatter();<br />
soapWriter.Serialize(outStream, temp);<br />
}<br />
catch(SerializationException sem)<br />
{<br />
Console.WriteLine(sem.ToString());<br />
}<br />
<br />
return true;<br />
}<br />
<br />
<br />
<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
QueryManager myQM = new QueryManager();<br />
Query qi = new Query();<br />
<br />
qi.name = "Query 1";<br />
qi.description = "The first Query";<br />
qi.SQL = "Selecr dfg dfg fdsfdsg gfds";<br />
myQM.addQuery(qi);<br />
<br />
qi.name = "Query 2";<br />
qi.description = "The second Query";<br />
qi.SQL = "Selecr dfg dfg fdsfdsg gfds";<br />
myQM.addQuery(qi);<br />
<br />
qi.name = "Query 3";<br />
qi.description = "The third Query";<br />
qi.SQL = "Selecr dfg dfg fdsfdsg gfds";<br />
myQM.addQuery(qi);<br />
<br />
<br />
<br />
<br />
myQM.SaveQuerys();<br />
<br />
}<br />
}<br />
}<br />
<br />
<br />
<br />
<br />
<br />
[Serializable]<br />
public class Query : ISerializable<br />
{<br />
public string name;<br />
public string description;<br />
public string SQL;<br />
<br />
public Query()<br />
{<br />
}<br />
<br />
public Query(string qname, string qdesc, string qSQL)<br />
{<br />
name = qname;<br />
description = qdesc;<br />
SQL = qSQL;<br />
}<br />
<br />
public Query(SerializationInfo serInfo, StreamingContext streamContext)<br />
{<br />
name = serInfo.GetString("name");<br />
description = serInfo.GetString("description");<br />
SQL = serInfo.GetString("SQL");<br />
}<br />
<br />
public void PrintInfo()<br />
{<br />
Console.WriteLine("name: " + name);<br />
Console.WriteLine("description: " + description);<br />
Console.WriteLine("SQL: " + SQL);<br />
}<br />
<br />
public void GetObjectData(SerializationInfo serInfo, StreamingContext streamContext)<br />
{<br />
serInfo.AddValue("name", name);<br />
serInfo.AddValue("description", description);<br />
serInfo.AddValue("SQL", SQL);<br />
}<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
[Serializable()]<br />
public class QueryList : IEnumerable, ICollection, ISerializable<br />
{<br />
protected ArrayList TheQueryList;<br />
<br />
public QueryList()<br />
{<br />
TheQueryList = new ArrayList();<br />
}<br />
<br />
public QueryList(SerializationInfo serInfo, StreamingContext streamContext)<br />
{<br />
try<br />
{<br />
<br />
ArrayList aL = new ArrayList();<br />
TheQueryList = (ArrayList)serInfo.GetValue("TheQueryList", aL.GetType());<br />
}<br />
catch(InvalidCastException e)<br />
{<br />
Console.WriteLine("Line 265: " + e.Message + "\n \n \n");<br />
}<br />
}<br />
<br />
public int Add(Query QueryInfo)<br />
{<br />
return TheQueryList.Add(QueryInfo);<br />
}<br />
<br />
public void GetObjectData(SerializationInfo serInfo, StreamingContext streamContext)<br />
{<br />
serInfo.AddValue("TheQueryList", TheQueryList.GetType());<br />
}<br />
<br />
public Query getQueryAt(int index)<br />
{<br />
if(TheQueryList.Count < index)<br />
return (Query) TheQueryList[index];<br />
else<br />
{<br />
Query temp = new Query("Index out of range", "null", "null");<br />
return temp;<br />
}<br />
}<br />
<br />
<br />
public int Add(string name, string description, string statement)<br />
{<br />
Query sQI = new Query(name, description, statement);<br />
return TheQueryList.Add(sQI);<br />
}<br />
<br />
<br />
<br />
public int Count<br />
{<br />
get<br />
{<br />
return TheQueryList.Count;<br />
}<br />
}<br />
<br />
public bool IsSynchronized<br />
{<br />
get<br />
{<br />
return TheQueryList.IsSynchronized;<br />
}<br />
}<br />
<br />
public object SyncRoot<br />
{<br />
get<br />
{<br />
return TheQueryList.SyncRoot;<br />
}<br />
}<br />
<br />
public void CopyTo(Array dest, int index)<br />
{<br />
TheQueryList.CopyTo(dest, index);<br />
}<br />
<br />
public void Clear()<br />
{<br />
TheQueryList.Clear();<br />
}<br />
<br />
<br />
public IEnumerator GetEnumerator()<br />
{<br />
return new QueryListEnumerator(TheQueryList);<br />
}<br />
<br />
public class QueryListEnumerator : IEnumerator<br />
{<br />
ArrayList TheQueryList;<br />
IEnumerator TheEnumerator;<br />
<br />
public QueryListEnumerator(ArrayList QLT)<br />
{<br />
this.TheQueryList = QLT;<br />
TheEnumerator = QLT.GetEnumerator();<br />
}<br />
<br />
public object Current<br />
{<br />
get<br />
{<br />
return TheEnumerator.Current;<br />
}<br />
}<br />
<br />
public bool MoveNext()<br />
{<br />
return TheEnumerator.MoveNext();<br />
}<br />
<br />
public void Reset()<br />
{<br />
}<br />
}<br />
<br />
}
|
|
|
|
|
Hello all, I'm fairly new to the C# and windows programming world, been stuck in the console too long..but anyways, im trying to write a collabseable groupbox type control, with a +/- in the top left of the groupbox, then allowing it to expand/collapse like a treenode..can anyone point me in the direction of where i need to start at? Thanks alot! ..i've read through alot of the tutorials but im still not sure on how i would make the list collapse and re-expand ..using OnPaint() i did have the +/- working with the MouseDown() event so that it changed from a + to a - correctly, but that was inheriting from System.Windows.Forms.GroupBox and using OnPaint() and OnMouseDown() ..thanks for any help you might be able to give me!
|
|
|
|
|
|
Yep that's actually what I've ended up doing so far..Using a panel is there any reason i shouldn't be able to draw a borderline around the whole thing and then encase the text in the middle of that borderline, to pretty much emulate a groupbox? Thanks alot for your help!!
|
|
|
|
|
I'm developing an application that charts data from an online real-time data vendor. I'd like to split the program into two main parts: 1) a server part that logs into and maintains the connection to the data feed, and 2) a charting/analysis part that charts and applies algorithms to the data.
The minimum requirement is once the server part is developed, I want to be able to: 1) login, 2) open a chart, 3) close the chart, 4) edit and recompile the charting code in visual studio without having to logoff. 4) open the chart again with the new edits operational.
The ideal senerio would be to not only stay logged on while editing and recompiling the charting code, but also not have to close the chart first. On recompile the edits would automatically be updated into the open chart.
It would seem that the server will need to be an exe and the charting a dll. In C# it looks like to accomplish dynamic loading and unloading of the charting dll, the charting dll will need to be in its own application domain.
I've studied Eric Gunnerson's MSDN article "AppDomains and Dynamic Loading" and this seems to be close to what I'm after. However his approach seems overly complex. I'm hoping to find a simpler way and hopefully some examples to implement my above stated minimum requirement and/or the ideal senerio.
Mark Clifton's Application Automation Layer also looks interesting.
Any thoughts/sugestions/examples would be greatly appreciated.
thanks,
Brian Dalby
|
|
|
|
|
If you need to unload and reload to the same type, the only way of doing it is with app domains.
You can sometimes get away with serializing the name of the type (chart1, chart2, chart3) when you modify it, and only load the new type. It's a bit ugly, however, and has more memory usage.
|
|
|
|
|
|
Hello,
For work I need to make a web based application.
I know JAVA applets will do what I want (this needs to be more like a windows prog and less like a web page)... does C# have anything like a JAVA applet???
Thanks,
Brian Hudson
|
|
|
|
|
|
Look up embedding .NET controls in a web page. It only works in IE 6, maybe in 5.x but I'm not sure.
Deploying a Runtime Application Using Internet Explorer[^]
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|