|
This looked like it should work and it does if you are dealing with doubles. Unfortunately I'm dealing with matrices and the Matrix.ToString() does not take any arguments. So I'm still looking.
Linda
|
|
|
|
|
Hi there,
Thanks for taking interest in my question. Actually, I wanted to know the process of creating a Gel Button (Stylish, glowing, shining and colourful button control) in Visual C#. I went through many tutorials in both google and MSDN, but all of them mentioned WPF in them and the code was in XAML. I have not started programming in XAML or WPF yet, but I know that they can be used to create graphically rich UI applications. However, is there any way I can create Gel buttons in Visual C# for my Windows form? Please help.
Thank you,
Rajdeep.NET
|
|
|
|
|
|
Hello,
I have been struggling for the past 3 days to do this but I simply can't find any good info on how to do it.
Please let me explain what I want.
I have a compiled software. I want users to be able to brand this software with their own ICON, ABOUT IMAGE and DETAILS.
How can I do this ?
In my oppinion, there are 2 ways to do this :
add the image and details file in to the exe and also, change the exe icon. I don't think this is possible.
create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software.
How can I do that ? Is there any other way ? Did I explain correctly what I want ?
PS: I am programming in VS 2008 c# with .net 3.5
Thank you
|
|
|
|
|
sodevrom wrote: create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software.
How can I do that ? Is there any other way ? Did I explain correctly what I want ?
Hello Sodevrom,
Generating an .exe (executable) file from within your application is an impossible task! But yes, other executable files can make your way, like files with .vbs and .bat extensions (which are also executable). The source files are written in Notepad as usual and then are saved with a name and a required executable extension. You can use the FileStream property of .NET to create a notepad file and write the code to it. Then, you can use the File.Move(); function to rename the file to any execuatble extension you want, but not any .exe. Hope this information helps. For more information, search Google or MSDN.
Happy Programming,
Rajdeep.NET
|
|
|
|
|
|
Hello,
This is not exactly what I need. A friend of mine made me a DLL a while back, that had 3 functions :
start_exe(string exe name)
add_file(string file path,string source path)
create_exe(icon path,string file_of_the_file_to_run_when_oppening_exe)
And it worked perfectly in C++, but it does not work very good in c#.
Any other ideeas ?
|
|
|
|
|
You want to replace resources in an existing .exe file?
If the .exe file is a .NET assembly, that's pretty easy. Take a look at Mono.Cecil[^].
|
|
|
|
|
Hello,
This is pretty difficult. Are you sure this will modify the resources from a .exe from another .exe file.
So if I have APP1 that controls APP2, can I modify the resources of APP2 from APP1 ?
Thank you
|
|
|
|
|
Yes, Cecil can open .exe files, modify them, and save back the changes.
Use something like this:
AssemblyDefinition asm = AssemblyFactory.GetAssembly("myassembly.exe");
asm.MainModule.Resources.Add(new EmbeddedResource(
"ResourceName", ManifestResourceAttributes.Public,
File.ReadAllBytes("image.png")
));
AssemblyFactory.SaveAssembly(asm, "myassembly.branded.exe");
|
|
|
|
|
Hi,
Cecil is great, actualy it's perfect.
I have only one last request. Can you please tell me what would I have to do to change the default icon of the exe ?
I am not lazy, but I am finding Cecil pretty difficult.
Thank you again very much
|
|
|
|
|
Hi,
Create a DLL trigger for your application. Thats the easiest way. And by the way, C# enables you to create DLL the much better way, than any other language!
|
|
|
|
|
Hello,
I was wondering if anyone could tell me if what I'm trying to accomplish is possible.
I am using C# in VS 2008.
I have two project templates and another template which links the two projects and calls their templates. The first project is a user control and the second is a test app that needs to reference the user control. I also have a custom wizard that is called from the template. After the projects are created the wizard compiles the user control and gets the path to its dll. I then need to add a reference to the user control from the dll path to my test app. It is not possible for me to add the reference before this as I don't know what the name of the dll will be until the user creates the new user control project giving it whatever name they want. Does anyone know how this could be done?
|
|
|
|
|
Maybe Reflection is what you want, google it.
|
|
|
|
|
Thank you for the reply.
I've been googling for about a week and tried many different things including reflection. I tried Assembly.LoadFrom(dllPath) in the wizard but that just adds the reference to the project that the code is in. I checked out reflection where you can get the type and instantiate an object of that type and call methods from it, but that object is already created. I don't want a new one. When I set an assembly variable in the wizard equal to the assembly of the object needing the reference, the LoadFrom function doesn't exist.
|
|
|
|
|
I found the answer on another forum.
// Provide the information about project1 to project2
VSProject projectWithReferences = project2.Object as VSProject;
if (projectWithReferences != null)
{
Reference reference = projectWithReferences.References.AddProject(project1);
}
|
|
|
|
|
|
It is remote, i don't think so.
|
|
|
|
|
So I assume that the way I am currently doing it is the only way? Any other ideas?
Thanks
|
|
|
|
|
You are right, the only way is to check with a timer because it is remote. Since remote server doesn't let you know when anything changes, it is not possible. Your app should check.
|
|
|
|
|
Hi
In my program I call a win32 API function which returns a function pointer as its result. How can I store and 'call' this pointer in C#?
The API function in question is LRESULT SendMessage(...) , which I map as IntPtr SendMessage(...) . The function whose pointer is returned by SendMessage has the form
int fn(void*, int);
so I created a delegate
delegate int RemoteFunction(IntPtr a, int b)
and I try to convert the IntPtr (originally LRESULT ) returned by SendMessage to an 'instance' of this delegate, like
RemoteFunction x = (RemoteFunction) SendMessage(...); // compiler error
So far I wasn't able to come up with a code that would at least compile, not to mention work.
Do you have any suggestions?
Any help appreciated, H.
|
|
|
|
|
maybe this helps:
using System;
using System.Runtime.InteropServices;
namespace com_example
{
class Program
{
[DllImport("user32.dll")]
private static extern int MessageBox(IntPtr hWnd, String
text, String caption, uint type);
static void Main(string[] args)
{
MessageBox(
new IntPtr(0), "Hello, world!", "My box", 0);
}
}
}
|
|
|
|
|
Thanks for you effort but this actually explains how to call an API function whose exact name I know at the design time. My question was rather how to call an external function that is returned dynamically (at runtime) in form of a function pointer.
The post bellow explains this perfectly.
Thanks anyway, H.
|
|
|
|
|
Not tried it myself, but you could look into:
System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer.
Supposedly converts an unmanaged fp into a delegate.
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
Cool, I am sure this is it. Thank you very much!
H.
|
|
|
|