|
Can anyone point me in the direction of some examples of the implementation of the Intel UPnP SDK. According to a post I found Intel haven't released any documentation about it because they consider it to be a support DLL and nothing more.
Freedom is the right to say that 2+2=5 if this is so everything else will follow.
|
|
|
|
|
Hi,
I need to create and Ms-Word addin that will add a footer to all the pages of an open document. I have browsed and got some code.
I have referred MS knowledgebase article and have created an addin, but that code is not adding any button to the commandbar of Word. It did one for outlook. When I made some changes to the code to make it word specific, it still didn't do anything. I have written the following code in OnStartupComplete method:
object oMissing=System.Reflection.Missing.Value;
CommandBars cmdBar = wordApp.ActiveDocument.CommandBars;
try
{
this.myButton = (CommandBarButton)cmdBar["Tools"].Controls.Add(1, oMissing, oMissing, oMissing, oMissing);
}
catch
{
this.myButton = (CommandBarButton)cmdBar["Tools"].Controls.Add(MsoControlType.msoControlButton, oMissing, oMissing, oMissing, oMissing);
this.myButton.Caption ="Hello";
this.myButton.Style=MsoButtonStyle.msoButtonCaption;
}
this.myButton.Tag ="Hello Butom";
this.myButton.OnAction="MyAddin1.Connect";
this.myButton.Visible =true;
this.myButton.Click += new _CommandBarButtonEvents_ClickEventHandler(this.myButton_Click);
But this is not working. I am also not able to debug it.
Please help!!!!
|
|
|
|
|
I have been reading a lot lately about how Interfaces and abstract classes are hallmarks of good C# programming. I admit, they are interesting, but my understanding is very limited as to why one would use either instead of simply creating a reusable class.
I have been programming for a long time, but have never needed either, but I will be the first to admit that much of my code in the past could have been done better.
SoI guess my question is, what circumstances would I use either an interface or an abstract class, and why would this benefit me?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
1) A class in c# can derive from one class and can implement as many interfaces as it wants.
2) an abstract class contains abstract methods and normally at least one non-abstract method. They are used if there exists a common behaviour (non-abstract methods) and methods that can only be implemented by derived classes (abstract methods).
3) interfaces are used to define an Interface that means it describes what some object can do.
4) you can look at an interface as a class containing only abstract methods
5) because you can not have multiple inheritance in c#, interfaces are used instead.
A good object oriented base idea is that you always program against an interface and never against a class. This simplifies loose coupling of components a lot as well as it allows the replacement of an instance implementing a certain interface with another (good in testing with mocks for example) or if your code has several strategies to handle something that can be exchanged (strategy pattern).
I'm stopping now, it's going loooong.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
So, essentially, they are there to make things easier and cleaner (kind of like XHTML), it isnt really ever necesarry, but is, as a rulle, good practice. Right?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
If you want, then yes.
But necessary is only machine code, everything else is to make things easier and cleaner:
- assembler
- IL
- C#
- interface, classes
- patterns
-- modified at 9:36 Wednesday 5th September, 2007
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
There's also the benefits of using Interfaces as contracts for communication through .NET Remoting.
If the server exposes an Interface, the clients don't have to know the inner workings that's going on on the serverside.
-Larantz-
|
|
|
|
|
Hi friends,
I have some code in C which I need to convert in C#. The very first line of C code is an Include file. So how can I convert this line in C# code or what is the equivalent of this in C#? I have already tried system.math class but I want to convert this particular in C#.
#include <math.h>
max dev
|
|
|
|
|
u can't use .h file
i think u have to convert it into class library then u can use it
|
|
|
|
|
Thanks so much for your reply. Can you tell me how can I convert it in system library ? or can you suggest any source or converter where I can convert my C Code into C# ?
max dev
|
|
|
|
|
You'll have to use the corresponding methods of System.Math and do some manual labor to adapt your C code.
|
|
|
|
|
hi all,
following is a structure that i hv define
[StructLayout(LayoutKind.Sequential, Size = 16)]
public struct MESSAGE_INFO
{
public UInt16 _MessageCode;
public UInt16 _ChannelNo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=6)]
public UInt16[] _Parameter;
}
Now when i declare pointer to this structure, It throws the error "Cannot take the address or size of a variable of a managed type"
MESSAGE_INFO* ptrMsgInfo
But if i declare "public UInt16[] _Parameter" as only "public UInt16 _Parameter" then it compiles perfectly.
Any light on this would be highly appreciated...
Thanx in advance
Vikas Salvi
Programmer Analyst
|
|
|
|
|
Hello Vikas,
MSDN[^] says (at the top of the page) that the pointer can point to "Any user-defined struct type that contains fields of unmanaged types only". When you define the field as an array, then it's considered a managed type. When you define it as just a UInt16, then it's considered an unmanaged type (sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, or bool).
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
How can we create a new file in a selected folder.
also is there any kind of limitation on file type( file format) which we can create.
I want to create a new file in whichever folder a user chooses?
|
|
|
|
|
|
Sometimes its not what you search, for but how. Not knowing how to word a proper search is pretty common, even among professionals.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
WHich is worrying ... they should atleast be able to do "c# a few keywords" X(
|
|
|
|
|
Welcome to the Human Race
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
but how do you send two arguments to be put in one string array when the called function has one string array defined in its header..
private void SayHi(string[] str_In)
{
MessageBox.Show(<blink>str_In[0]</blink>+" "+<blink>str_In[1]</blink>);
}
...
SayHi(<blink>"Hi"</blink>,<blink>"Cpian!"</blink>);
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
private void SayHi(params string[] s)
{
// ...
}
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
If you want to send an array, you have to create an array:
SayHi(new string[] { "Hi","Cpian!" } );
If you use the params keyword, the parameters sent to the method will become an array:
private void SayHi(params string[] str_In)<br />
<br />
SayHi("Hi","Cpian!");<br />
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
I'm new to C# and the whole server/client thing, as an exercise I've made a simple board game for two players, now I'd like to make it playable on the net which is obviously not a trivial task (for me anywayz). I was looking for SIMPLE tutorials or articles about creating a web servers and clients, but havnt found anything basic enough - I need an example of client and server passing very basic pieces of data (strings?) on simple events between them, but the articles I've seen deal with more complex project. A point in the right directon would be very appreciated, thanx.
|
|
|
|
|
Remoting is an easy way of getting data flowing between the server and the clients.
Take a look at MSDN http://msdn2.microsoft.com/en-us/library/ms973857.aspx[^] or CodeProject http://www.codeproject.com/csharp/dotnetremotingbasictutor.asp[^]
Try creating two custom objects that you use as communication channels.
Let the server expose it's serverchannel object through remoting, and when client contacts the server through the channel, it can register the client and set up a remoting connection back to the clientchannel object, which the client exposes through remoting aswell.
You can put appropriate communication and game methods in these channels aswell as events which you can monitor.
-Larantz-
-- Modified --
If you choose to go for a remoting solution where both sides expose a marshalled (remoting) object, remember to have each side set up their own remoting servers before they try and contact the other side. Otherwise the attemt at setting up local remoting server will fail as the remoting proxy from the otherside blocks the local server from being set up correctly.
|
|
|
|
|
Thanx will try that tomorrow when I can have both my eyes looking in one direction btw, gotta love your signature
|
|
|
|
|
sqlite[^] is very good it's 1 dll (well in its pure native form) and then 1 db file per user if thats the way you want it
not sure how it'd handle that much data but it's worth a look.
You still use ado.net to "connect" to it but it local and file based rather than network based.
|
|
|
|