|
|
Hello everyone,
I am using Visual Studio 2005 to develop a C# COM Class Library project. There is a setting in Build --> Output, called *Register for COM Interop*. What is the usage of this setting? In my situation, do I need to set this option?
thanks in advance,
George
|
|
|
|
|
Indicates that your managed application will expose a COM object (a COM callable wrapper) that allows a COM object to interact with your managed application. The Output type property in the Application page of the Project Designer for this application must be set to Class Library in order for the Register for COM interop property to be available. For an example class that you might include in your Visual C# application and expose as a COM object, see Example COM Class (C# Programming Guide).
using System.Runtime.InteropServices;
namespace project_name
{
[Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")]
public interface ComClass1Interface
{
}
[Guid("7BD20046-DF8C-44A6-8F6B-687FAA26FA71"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ComClass1Events
{
}
[Guid("0D53A3E8-E51A-49C7-944E-E72A2064F938"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(ComClass1Events))]
public class ComClass1 : ComClass1Interface
{
}
|
|
|
|
|
Thanks Yanshof,
I am wondering what detailed operations is Visual Studio 2005 doing if this option is selected in your sample.
I am wondering what is the differences between using this Visual Studio 2005 option and do the following work by myself,
1. regasm /codebase <assembly name="">;
2. regasm /tlb <assembly name="">.
regards,
George
|
|
|
|
|
George_George wrote: Register for COM Interop
It would, I guess, automatically create necessary type libraries and called regsvr32 also for you.
|
|
|
|
|
Hi Vasudevan,
For C# managed COM, it should be mscoree.dll other than regsvr32 which is acting as the host for all COM components, right?
regards,
George
|
|
|
|
|
Hello
This is the code of save data in the SQLDataBase:
con.Open();
str3 = "INSERT INTO [CreditCard].[dbo].[CreditCardInfo] ([CreditTypeID],[CreditcardNumber],[Name],[BankID],[ExpiryDate],[EntryDate],[MachineTypeID]) VALUES((" & crId & "),(" & crNum & "),('" & Name & "'),(" & bnkId & "),('" & dtm & "'),('" & now & "'),(" & mId & "))";
cmd = new SqlCommand(str3, con);
adap.SelectCommand = cmd;
Thanks in advance
Assaf
|
|
|
|
|
hi Assaf :
what is the problem in this code?
Rami Abdalhalim
|
|
|
|
|
the problem is this line of the insert statment is always blue
the tool tip that appearis:
"operator '&' cannot be applied to operands of type 'string'and 'int'"
i don't what the problem and this not usually that i have this problem.
Thanks in advance
Assaf
|
|
|
|
|
A neater stored procedure would have been more easier to debug. Can you see the formed SQL statement in Quick Watch window in the Query Analyser? That should be easier to identify and isolate the malady.
|
|
|
|
|
The problem is not in the SQL statement. He's using the & operator from VB in C# code...
---
single minded; short sighted; long gone;
|
|
|
|
|
Yep. Alongside with that, the vulnerability might play havoc for him in the long run. Wouldn't it?
|
|
|
|
|
Yes, it definitely will.
But not as long as he can't even compiler the code.
---
single minded; short sighted; long gone;
|
|
|
|
|
Vasudevan Deepak Kumar wrote: A neater stored procedure would have been more easier to debug
I agree. Just have the parameters be the fields that are being updated.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
You can't use the & operator to concatenate strings in C#. Use the + operator.
---
single minded; short sighted; long gone;
|
|
|
|
|
I have the following function, but I am trying to have the application wait until the thread completes before it moves on but the application just appears to lock. can someone tell me what I might be doing wrong?
private void UploadTicketChnges(bool WaitForThreadToFinish)
{
TicketChanges TixChanges = new TicketChanges(mysql, mysqlcmd);
TixChanges.AppEventID = AppEventID;
TixChanges.AppMemberEmail = AppMemberEmail;
TixChanges.AppMemberPassword = AppMemberPassword;
TixChanges.configAPIURL = configAPIURL;
TixChanges.configDatabaseTable = configDatabaseTable;
new Thread(new ThreadStart(TixChanges.ProcessChanges)).Start();
if (WaitForThreadToFinish)
{
// wait for all the threads to finish
Thread.CurrentThread.Join();
}
}
|
|
|
|
|
Brad Wick wrote: Thread.CurrentThread.Join();
"Thread.Join() blocks the calling thread until a thread terminates."
you want the current thread to wait until the current thread has finished
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Yes I would like the main application that calls the thread to wait until its finished. I know this is not what threading is all about, but when I call the thread for the very first time I want it to wait until its completed. The other time's it is called is inside a timer which I don't care about it waiting until it's finished.
|
|
|
|
|
The only Join that makes sense is someOtherThread.Join() which makes the
current thread wait on someOtherThread.
As I said before
Thread.CurrentThread.Join() makes no sense, it makes the current<br />
thread wait until the current thread is finished, which is never since it is waiting...<br />
<br />
:) <br />
<br />
<div class="ForumSig">Luc Pattyn <a href="http://www.codeproject.com/scrapbook/ForumGuidelines.asp">[Forum Guidelines]</a> <a href="http://www.codeproject.com/script/articles/list_articles.asp?userid=648011">[My Articles]</a><br />
<br />
<hr>this weeks tips:<br />
- make Visual display line numbers: Tools/Options/TextEditor/...<br />
- show exceptions with ToString() to see all information<br />
- before you ask a question here, search CodeProject, then Google<br />
<hr></div>
|
|
|
|
|
Thread processThread = new Thread(new ThreadStart(TixChanges.ProcessChanges));
processThread.Start();
if (WaitForThreadToFinish)
{
processThread.Join();
}
|
|
|
|
|
I was looking for some examples and couldnt find any.
Anyone know of a C# example of a guitar tuner?
I would like to build one that have the same options as the tuner
on www.get-tuned.com/guitar_tuner.php
this is a flash example shown here.
Any help or direction would be appreciated.
Steve Welborn
Software Engineer
Inrange Consulting
|
|
|
|
|
I don't think C# can play a tone without using p/invoke, although I could be wrong. Playing a wav file is very easy, that may be the other way to do it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
As of .net 2 there is System.Console.Beep which can play tones.
|
|
|
|
|
PIEBALDconsult wrote: System.Console.Beep which can play tones.
I was actually searching for something equivalent to the classic PLAY command in QBasic. Would this be matching that requirement too?
|
|
|
|
|
Vasudevan Deepak Kumar wrote: QBasic
I remember that from the old days :-> I actually still have the QuickBasic 4.5 compiler on this machine, though I haven't used it in some time
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|