Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Embedded C#
Hello to everybody I want to tell my problem with an examples :
 
There is no code I have just exe(For example: an exe includes all Products informations) and I want to see that informations when I click button1 (which is in other project).And Can I do this without writing codes .I mean just want to embed the exe into other project and when press button1 I want to see data.İs this possible ?
 
Same but other example :
 
I have program and I want to use calculator and someone made a calculator program and I got it's exe and there is no source code. At this point I may not want to write my own calculator program.So I add this calculator.exe that I found into my program.
And in my program there is button1 and when I clicked the button1 I want to show calculator.
Maybe you guys can offer better way to do?
 
thanks
Posted 16-Jul-12 2:01am
y.baris676
Edited 17-Jul-12 21:24pm
v8
Comments
Wes Aday at 16-Jul-12 9:12am
   
It's going to be very difficult to answer any of this. First thing is that "Embedded" has very specific meaning in software and I am 99% sure that you are not using the term correctly. For example you say you "embedded login.exe in my ado.net project" which does not make any sense and then you go on to say "ado.net.exe" (not the codes only the exe) which make even less sense. Question 2 does not make any sense. You would know which button was clicked because you coded it.
y.baris at 16-Jul-12 9:20am
   
for your question2 answer : if I have just login.exe what can I do ?and how can I use button click event without any source code
Wes Aday at 16-Jul-12 9:23am
   
If you do not have the code then you would need to go back to whomever the author is and ask them. How are we to know what "login.exe" even does?
y.baris at 16-Jul-12 9:21am
   
ok I am explaining what I do : I add .exe file as a resource in visual studio IDE. i followed these steps i right click on my main project and then "properties" and then "Resources" and then "Add resource" isn't it how we embed an .exe file? isn't it embedding?
Wes Aday at 16-Jul-12 9:23am
   
No that is "adding a reference", hence the action "add a reference"
y.baris at 16-Jul-12 9:31am
   
ok thanks.
then what is the differences between simply add a reference and my style..
or how can I embed .exe files in my ado.net project
Wes Aday at 16-Jul-12 11:19am
   
By your own words you do not have an "ado.net" project. You have an exe. Which is why I said that this would be very difficult to answer. Most of what you are saying does not make sense or you contradict yourself. I sounds like you are trying to use one exe, that you did not write, inside another exe, that you also did not write.
Dave Kreskowiak at 16-Jul-12 11:15am
   
No it's not. He added the file to Resources, not References.
Dave Kreskowiak at 16-Jul-12 11:18am
   
So you added the file to the Resources of your project. To what end? You can't run it from resources and you really can't send it to the client because the browser doesn't know what to do with an .EXE besides save it (default security config in just about all browsers).
 
Resources are just internally stored files, strings, text, images, icons, ... that are used in some way by code. You usually don't ever add an .EXE to Resources because it's useless there.
 
So, what do you expect to happen if you added it to resources??
 
BTW: There is no such thing as "embedding" an .EXE inside another .EXE. So your use of the term "embedding" doesn't make any sense.
y.baris at 17-Jul-12 2:23am
   
thanks for understanding it is not adding a reference.
Maybe it will easier to understand.I'm telling what I want to do.For example : I made a program which does a great job and you want to use my exe(there is no source code) in your project.When you press button(which is in my exe) you want to show your projects Form1 screen.How do I do this ?
(or how can I know that specific button(which is in exe) is clicked)
Dave Kreskowiak at 17-Jul-12 7:39am
   
That is just about never done. You can launch a sperate .EXE file from your app (provided it's actually on disk and not in Resources!) but it runs as a completely seperate process with no knowledge at all of your application.
 
The only way around this is if the other .EXE is written specifically to expose an interface for other processes to use. This is very rare in the situations that you are trying to do this.
 
Basically, you can't do what you want without extensive modification of the .EXE you're trying to "embed". If you don't have the source, you're out of luck.
y.baris at 17-Jul-12 8:12am
   
Ok thanks for your help.
Then I understood that I am looking impossible problem,am I right ?
but I thought that is easy problem
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Attach a method to the button's Click event:
private void Button1_Click( object sender, EventArgs e)
{
    Form1 newForm1Instance = new Form1();
    newForm1Instance.Show();
    this.Close();
}
 
That should create a new instance of class Form1, show it and close the form that contained the button.
  Permalink  
Comments
y.baris at 16-Jul-12 7:14am
   
thanks for answer but I think you misunderstand me. I have embedded login.exe in my project and I can't see Button1 or another components.
lukeer at 16-Jul-12 7:40am
   
In this case, refer to login.exe's documentation to learn how to get knowledge of a button press.
y.baris at 16-Jul-12 7:48am
   
this is an example and I don't have documentation of them ...my question is can I do without any source code of login.exe
aspnet_regiis at 16-Jul-12 8:31am
   
Yes
y.baris at 16-Jul-12 8:46am
   
aspnet_regiis can you explain how to do ?
aspnet_regiis at 17-Jul-12 0:41am
   
I will give you two options
1. Download the redgate reflector and you can possibly get the code for the .exe files you have
2. Create a new winforms app and design the UI with buttons on the click of which your .exe files can be called
y.baris at 17-Jul-12 2:33am
   
Maybe it will easier to understand.I'm telling what I want to do.For example : I made a program which does a great job and you want to use my exe in your project.When you press button(which is in my exe) you want to show your projects Form1 screen.How do I do this ?
lukeer at 17-Jul-12 4:14am
   
That's just not the way "common" software works. The software containing the button would have to expose some interface for other software to process its button clicks.
y.baris at 16-Jul-12 7:52am
   
And also look my 3.question please(or scenario 2 question 1)
 
I added the ado.net.exe into my login project but when I press button (login.exe button) ado.net.exe form is coming but no data shows
Richard MacCutchan at 16-Jul-12 10:12am
   
As has already been suggested, if you do not have the source code then there is very little you can do. It would be far easier to start from scratch and write the programs that you need.
Deepu Chintu at 19-Feb-13 15:30pm
   
hy..can u clear my doubt??
 
i give with example:
i did graphical pasword project and its seems like mini proj so i want to combine it with some other aplication like banking,super market and it shood conect exe file.i mean if what code i give and where if i give that then after making my password project worksand next step when i give login it should navigate to that banking(or)super market project using its exe file by giving some code..can u pls help anyone how to?
lukeer at 25-Feb-13 15:21pm
   
You achieve this by
1 making your password project work
2 compiling your password project into a dll instead of a standalone application
3 include password dll in whatever other application
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you do not have the source code for this program then there is very little you can do. If you do have it then you need to modify it to do the following. Program1 (login.exe) will need to run independently and on press of a button should call System.Diagnostics.Process.Start()[^], to load whatever program you want loaded, and then terminate. The login.exe program will need to use some parameter or config file to get the name of the application that it wishes to run.
  Permalink  
Comments
y.baris at 17-Jul-12 5:05am
   
Thanks for answer.but I managed to add the ado.exe into my login project using System.Diagnostics.Process.Start()but no data shows (when I pressed the button1 (which is in login project).
How can I see all my data ?
Richard MacCutchan at 17-Jul-12 5:38am
   
No idea, you really need to explain in more detail what is happening and show some of your code to demonstrate the problem. Please use the Improve question link above and add to your query.
y.baris at 17-Jul-12 6:20am
   
ok I am explaining what I did : I add .exe file as a resource in visual studio IDE. i followed these steps i right click on my main project and then "properties" and then "Resources" and then "Add resource" isn't it how we embed an .exe file? isn't it embedding.then I want to run when I pressed the button1 which is in my project.
now a little clear ?or not ?
Richard MacCutchan at 17-Jul-12 6:32am
   
You cannot add exe files as resources and somehow expect to be able to run them. As I said previously please go to your question, click on the "Improve Question" link, and explain there exactly what you are trying to do.
y.baris at 17-Jul-12 6:56am
   
For example this example can explain what I want to do :
I have program and I want to use calculator and someone made a calculator program and I got it's exe and there is no source code. At this point I may not want to write my own calculator program.So I add this calculator.exe that I found into my program.
And in my program there is button1 and when I clicked the button1 I want to show calculator.
Maybe you can offer better way to do?
Richard MacCutchan at 17-Jul-12 7:03am
   
I showed you how to do it in the suggested solution above. Let me say for the last time "you cannot embed an exe file into your program to achieve what you want"; you can only do it the way I have explained.
y.baris at 17-Jul-12 7:17am
   
I managed to add the ado.exe into my login project (as you said) but no data shows.
But it shows all data when I run the ado.exe file separately.
Richard MacCutchan at 17-Jul-12 8:35am
   
Sorry, but I really have no idea what you are doing. The statement "I managed to add the ado.exe into my login project" does not tell us anything. Please do as has been suggested and add some code to your original question to show what your program is doing. Remember we cannot see what is showing on your screen.
y.baris at 18-Jul-12 1:51am
   
Hello Richard there is no code I have just exe(For example:
an exe includes all Products informations) and I want to see that informations when I click button1 (which is in other project).And Can I do this without writing codes .I mean just want to embed the exe into other project and when press button1 I want to see data.İs this possible ?
Richard MacCutchan at 18-Jul-12 3:31am
   
No, it is not possible. You cannot embed an exe into your program to run it; it will not work.
y.baris at 18-Jul-12 3:45am
   
Maybe I am not right but I did it.Both of project is running(I mean exe and my project) in Form Load.
I embed exe in other project but my problem is : I want to see just one of them when I pressed the button.
Richard MacCutchan at 18-Jul-12 3:56am
   
There really is no point in repeatedly making this statement; it is meaningless. If you have a specific technical problem then please show us the technical details, i.e. some of the code you are using. And I doubt that you have 'embedded' one exe into another, but what you are actually doing is anyone's guess.
 
y.baris at 18-Jul-12 4:27am
   
Can you look at this ?
http://speedy.sh/BhsQz/Embedding.rar
y.baris at 18-Jul-12 6:28am
   
what is your comment for this ?I made it ,isn't it?
Richard MacCutchan at 18-Jul-12 9:10am
   
OK, I have taken a look and your project is not running an embedded application. This can be tested quite simply by removing the exe from your resources and running the program again and it will still start calc.exe, as that is an application in the system folder and will always be found. As I have tried to explain many times: you cannot run a program as an embedded resource.
Richard MacCutchan at 18-Jul-12 8:59am
   
No, I do not have the facilities for unpacking .rar files. Please use the "Improve Question" link above to provide the details you have been asked for, so everyone can see and try to help.
y.baris at 18-Jul-12 9:11am
   
Thanks for yor interest.Ok then I did .zip link.
http://speedy.sh/EsktA/Embedding.zip
I dont want to ask other question cause it can be nonsense.And I have to write all my code in there.İf you can help me I will be appreciate.
y.baris at 23-Jul-12 3:22am
   
you looked it ??
Richard MacCutchan at 23-Jul-12 3:43am
   
Yes, and I told you 4 days ago that what you are trying to do will not work. Your program is not running the embedded exe but starting the Windows calc program.
y.baris at 23-Jul-12 4:01am
   
yes I embed calc.exe into my project isn't it ?
it can be other exe too..not necessary for calculator ..
Richard MacCutchan at 23-Jul-12 4:33am
   
No you didn't, I wonder how many more times I need to say : This will not work!.
y.baris at 23-Jul-12 4:17am
   
Or you are saying me you are in trouble with this embedding issue ?then what is embedding ? can you tell me about it ? or can you show me real emdedded example ?İf I asked more sorry but I want to learn this :)
Richard MacCutchan at 23-Jul-12 4:34am
   
There is nothing to learn, you cannot do this. Forget about it and move on to something that will work.
y.baris at 23-Jul-12 6:09am
   
ok for C Sharp there is no embedding. understood :)
but I am curious how do we call in my project.
What is name which I've done?
Thanks for all your patience.Thanks
Richard MacCutchan at 23-Jul-12 9:01am
   
You have the following in your program:

ProcessStartInfo psi = new ProcessStartInfo("calc.exe");
Process.Start(psi);

When you call the Start() method, the system looks for the program calc.exe in the current directory, and any directories specified in the PATH environment variable. For complete details of how this works, please see the MSDN documentation on the Process.Start() method, and the StartInfo Property.
y.baris at 23-Jul-12 10:00am
   
Thanks for your patience .really I am glad to discuss with you :)
Richard MacCutchan at 23-Jul-12 10:39am
   
No problem, sometimes it's a matter of terminology as much as technicality. :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

i have 2 diffrent project on c# windows form i want to merge in single platform in c# form how can i do thos? please tell me fast
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 230
2 BillWoodruff 205
3 Sergey Alexandrovich Kryukov 195
4 DamithSL 165
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 31 Oct 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100