0

Possible Duplicate:
Embedding an external executable inside a C# program

i have 2 projects which names are login and ado.net projects and i have their .exe

scenario one

lets say that i only have the .exe file of login project not the code and If i have embedded login.exe in my ado.net project.

Question 1 : when I press the button (which is in login.exe file) I want to close that login.exe and open my ado.net project form... How can I do it ?

Question 2 : How can i understand which button is pressed if i have lets say 3 buttons in my login.exe screen ?

scenario two

Question 1 : what if this time i have the "ado.net.exe" (not the codes only the exe) which is taking data from sql server so i embedded it into the login project. How can i see the data (data shows when ado.net.exe is run) when i embed the ado.net.exe into my login project?

( by the way i managed to add the ado.net.exe into my login project but no data shows but it shows when i run the ado.net.exe file separately)

thanks

Community
  • 1
  • 1
modest and cute girl
  • 785
  • 4
  • 13
  • 24
  • 2
    It does not sounds like embedding, but actually referencing executables (in contrast to DLL's). Is this understanding correct? – leppie Jul 16 '12 at 11:34
  • 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? – modest and cute girl Jul 16 '12 at 11:41
  • Does this .exe file has output that you need in you code ( for clicking as example ) or you are just having an UNKNOWN .exe ? – Ahmed Ghoneim Jul 16 '12 at 11:49
  • this is just and exercise i made up. in reality i wrote the login project code and ado.net project codes. i just came up with this example to push me one step beyon. and since i don't have the answer i wanted to ask in here. – modest and cute girl Jul 16 '12 at 11:54
  • Dear Ahmed can u look at my comments on "John Mitchell" 's answer. i tried to explain. and if it makes sense to you can you enlighten me too. thanks. – modest and cute girl Jul 17 '12 at 06:55

1 Answers1

1

Since you don't have the source of your login.exe your very limited in your options.

You could try and decompile the original file using one of many decompilation tools, but making changes is a pain since you loose variable naming and comments.

Alternatively you can use a UI remote control API in windows to try and automate the process of clicking in windows, but this is a dirty dirty hack and really you'd be best trying to source a copy of the source code. Ways of doing this include manipulating the message pump or using MAA

John Mitchell
  • 9,653
  • 9
  • 57
  • 91
  • Dear John, actually in reality i have the login project codes and ado.net project codes. i don't need the decompiling tools. i'm just a beginner and i just wrote two simple application. and i wondered about embedding one compiled project (.exe file) to and another project and made this scenario. because its possible that i can have an .exe file from somewhere and want to use it in my project. can you read my question again please. and sorry if i couldn't be more clearer. thank you. – modest and cute girl Jul 16 '12 at 12:04
  • You probably don't want to have a .exe embedded, you should make your forms into a .dll file (Classlibrary) and then you can include that class library in both applications so you don't need two different executables. Generally speaking having lots of applications to do one applictions job is a no no, you can accomplish most (if not all things) in one application with the use of class libraries or plugins. – John Mitchell Jul 16 '12 at 13:30
  • thank you for giving informations and i agree with you about the .dll file but i don't want this. i am aware of my question. and there can be situations like that lets say i made a program and and put it to web and you see that it does a great job then u decided to use it in your project (maybe you use the outputs of my program) and there is nothing but the executable file .exe file. so that question came that way. i just made up these scenarios that way im finding chance to exercise and learn more. – modest and cute girl Jul 16 '12 at 14:03
  • does it made sense John? if so can you enlighten me? thanks – modest and cute girl Jul 17 '12 at 06:23