|
Heath Stewart wrote:
There are not many free ones, though, since this isn't just something you throw together in a day.
As a sample of this, Linux, Mozilla, Mono, Gnome, KDE, OpenOffice and Bochs were all coded by a single guy who was bored on a single rainny afternoon.
Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski
|
|
|
|
|
See my article, Using XML Digital Signatures for Application Licensing[^] for a conceptual overview of using XML Digital Signatures (though you could just as well use a binary signed file, but then you need to write a parser if you need one) to license your application.
As far as generating the numbers, you should probably come up with some kind of sequence for your serial numbers (hence "serial"). You won't have to come up with an algorithm and unique validation algorithm then. Just start with some number and increment, handing out each iteration as you go.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Why are you worried about the character length of the serial number after signing? Signing doesn't change the content that's signed (although you can envelope the signature, but the digest is not changed). If you sign your serial number, the serial number is not changed. You merely verify that the serial number hasn't changed by checking the signature, which uses a digest.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
In order to decrypt the data, you would have to store the private key in the application! You might as well give it to your competition, especially if this is a managed application in which all they have to do is use ildasm.exe to extract absolutely everything. My article mentioned something along these lines.
You private key must remain private. You can't decrypt without it, so you shouldn't include it in your application. This is the concept my article talks about - something pretty common in application licensing - signing a document with personal information keeps it unique to a person or machine. You verify that the file exists, verify the file hasn't changed (hence the digest and signature), then verify that the signed information is correct (like the computer name or MAC address is the same). None of this requires a private key, so your private key is kept secret (as it should be).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
We've looked into their product and it is very good. Why not use it?
In any case, they use the same concepts that my article discusses. In this case, however, the serial number is used as the validation key or the IV (initialization vector), not sure exactly which. You still have a private key such that you're the only one that can created signed files.
I recommend you at least download their trial and try it out. As I mentioned before, even signing a serial number isn't enough; you must also collect some sort of identity information to tie that serial number to a particular persona, machine, or domain. Otherwise, nothing is stopping someone from giving just the license file to someone else and it will still work without such identifying information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi All,
.net doesn't has common dialog box for functionality "Open With"
How do I display it in the application if the file type is not registered to open by default with any application?
Can anybody give me any pointers
Thanks & Regards
Shailaja
|
|
|
|
|
Use the ProcessStartInfo and Process classes like so:
ProcessStartInfo info = new ProcessStartInfo("filename");
info.ErrorDialog = true;
info.UseShellExecute = true;
Process.Start(info);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi All,
How do i maximize my form to full screen on click of button and bring it back to normal when i press ESC.
Like what we see in word application on clicking view-FullScreen or pressing F11 key on IE.
Catch is that when full screen is invoked all the menus and toll bars get hidden.This is the effect i want.
Any help/suggestion would be appreciated.
Thanks
God Is Great
|
|
|
|
|
Hi!
Try this:
Add this lines of code to your EventHandler (e.g. your button for switching to fullscreen):
<br />
OldPosition=new Point(Left,Top);<br />
OldSize=new Size(Width,Height);<br />
Left=0;<br />
Top=0;<br />
TopMost=true;<br />
FormBorderStyle=FormBorderStyle.None;<br />
Width=Screen.PrimaryScreen.Bounds.Width;<br />
Height=Screen.PrimaryScreen.Bounds.Height;<br />
When you click on your button, your window becomes topmost and gets maximized.
To switch to normal view of your window, restore OldPosition and OldSize .
|
|
|
|
|
Hi,
PLz refer the way IE or word application maximize to full screen ..
All the menus and toolbars are hidden..
how is this done..
do we explicitly need to enumerate all the windows and get thier handles and hide all the control!!!
Plz suggest..
God Is Great
|
|
|
|
|
I've got an interface i've constructed in C# for a COM object, IShellFolder. Now I need to construct a pointer to an address that will be used to store the IShellFolder interface.
The problem is, that i have not got a clue how to do this. If it was a structure or base type, i would construct a new one and marshal it, but I don't know how this works for Interfaces. I've looked through the Marshal methods, but not found any that look like they can help.
I've added the attributes of COMInterface.IUnknown, and also the GUID number, to the interface, but i'm uncertain as to where to go from here.
Any help appreciated
Cheers
Cata
EDIT: Solved this one, see problem 2
|
|
|
|
|
Was using an In where i should have been using an Out.
My bad.
Next problem: Now I have an IntPtr to an interface, how do I marshal it to the interface I have constructed? I'm currently looking at: GetObjectForIUnknown, but i don't think that is what I'm looking for.
I get the impression from what I have read so far that I need to construct some kind of COM object and tie the interface too it, but I don't know what object IShellFolder is attatched to, and it's not in the documentation. Or I could be way off the mark.
As always, help appreciated.
Cata
|
|
|
|
|
You want Marshal.GetTypedObjectForIUnknown , for which you provide a Type parameter. Just look at all the methods on the Marshal class so you have some idea of what's there.
Since you've posted so many questions about COM with .NET, you really should read a book if you're having trouble understanding this. As I mentioned before, having a COM background helps. If you don't, try this: COM and .NET Component Services[^] from O'Reilly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath,
I'm getting there using the Help File. Here was the line of code I've strugging to figure out what to do with. (It's nice to know I was on the right track as well)
<br />
thing = new IntPtr();<br />
COMStuff.SHGetDesktopFolder(out thing);<br />
<br />
object Folder = Marshal.GetTypedObjectForIUnknown(thing, COMStuff.IShellFolder);<br />
To be honest, I'm not entirely sure what I am trying to achieve with this method. I mean, I get a pointer to an interface, and then I'd like to use the interface.
But i'm missing a milestoned somewhere along that path, and I don't know what it is. I need an object? Of what Type?
Cata
|
|
|
|
|
Instead of
object Folder = Marshal.GetTypedObjectForIUnknown(thing, COMStuff.IShellFolder); use
COMStuff.IShellFolder folder = (COMStuff.ISHellFolder)
Marshal.GetTypedObjectForIUnknown(thing, typeof(COMStuff.IShellFolder)); Also, instead of using out IntPtr as the param type to SHGetDesktopFolder that you seemed to have defined yourself, just use IShellFolder as the param (no out or ref ) and it should work just fine. Marshaling done by the CLR will take care of most of this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks mate, figured it out on my own just as you posted
I'm just going through the Platform SDK documentation and converting anything I come across to C# COM. No particular purpose really, just learning about it. Very interesting, and i'm getting to grips with it quite nicely bar this small hickup.
Thanks
Cata
|
|
|
|
|
I'm using a load of flag values i've found in one of the Shell32 header files, however, when I try and compile it I get the error:
Cannot implicitly convery int to Uint.
This is for the two values:
SFGAO_HASSUBFOLDER = 0x80000000, // may contain children with SFGAO_FOLDER
SFGAO_CONTENTSMASK = 0x80000000,
I guess it's because the number is too large, but what can I do about it?
Cheers
Cata
|
|
|
|
|
Does this work out for you?
SFGAO_HASSUBFOLDER = (UInt32)0x80000000, // may contain children with SFGAO_FOLDER
SFGAO_CONTENTSMASK = (UInt32)0x80000000,
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
|
|
|
|
|
I've converted the flag enum to uint... though i'm not sure how that's going to affect the COM object i'm going to be using it with.
Thanks for the idea though
Cata
|
|
|
|
|
It won't, so long as you don't cause an overflow. While the -1 (Int32) is 4,294,967,295 (UInt32), the number is still 0xffffffff. It's not uncommon to use ing instead of uint for parameter types like DWORD s. Even Microsoft does it when manually declaring COM interfaces that they use internally (or those few in System.Runtime.InteropServices that you can use).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have two classes:
abstract public class BasicClass
{
public string name;
public BasicClass(string name)
{
this.name = name;
}
abstract public void TestMethod(...);
}
... and ...
public class TestClass: BasicClass
{
public override void TestMethod(...)
{
...
}
}
Why do I get an error at public class TestClass that says:
"No overload for method 'BasicClass' takes '0' arguments".
I don't get it ...
Regards, Desmond
|
|
|
|
|
You have to overwrite the constructor.
The constructor 'BasicClass' takes one argument, so one constructor for 'TestClass' should be:
public TestClass(String name):base(name){...}
|
|
|
|
|
Your TestClass has no constructor, so the framework makes a default one for you. It has to call the base contructor. The BasicClass has no default constructor because you defined a constructor with an argument.
Some suggestions:
public class TestClass: BasicClass
{
public TestClass() : base("")
{
}
public override void TestMethod(...)
{
...
}
}
or
abstract public class BasicClass
{
public string name;
public BasicClass()
{
this.name = "";
}
public BasicClass(string name)
{
this.name = name;
}
abstract public void TestMethod(...);
}
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
|
|
|
|
|
Maybe somebody could help me?..
I've build in .NET C# kind of wrapper object to my old COM server (it simply contains that COM server interface pointer inside and exports almost the same properties/methods outside redirecting all calls to that COM interface). Definitely, in order to use COM server in .NET I've generated interop for it. My wrapper resides in its own assembly which uses in runntime (as I supposed) that interop but, the problem appears when I compile module which uses my wrapper: C# compiler asks to add to reference that COM interop also because it can't find definition of that internal COM interface!?. My question is why in compile time C# compiler has to know about internal implementation of my assembly ? I do not export any interface or type from that COM interop, moreover the purpose of this wrapper is to hide COM implementation !.. Is it any way to include that interop in my assembly?.
Thanks in advance, Vlad.
|
|
|
|
|
Because the interop assembly is a dependency of the assembly containing your wrapper, which is a dependency of the assembly using the wrapper. Because the wrapper uses the interop assembly internally, it must be able to reference it in order to compile. Even if both of these assemblies are compiled and added as .NET references (as opposed to project references when using all of them in a single solution), the interop assembly is required in order to load the wrapper assembly. It's also possible that you might be using a Type from the interop assembly as a publicly exposed param, return type, interface, or struct so that would force a dependency resolution.
Basically, any dependencies - whether direct or indirect - must be resolvable when compiling and when running, so long as the Type is access (which foces a JIT compilation).
Microsoft MVP, Visual C#
My Articles
|
|
|
|