Hack Forums
[Help] C# Opening a Resource File - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Help] C# Opening a Resource File (/showthread.php?tid=6273328)



C# Opening a Resource File - john ronaldsad - Jun 14, 2024

Hello, I am getting the following error

Code
Argument 1: cannot convert from 'byte[]' to 'string[]'

and the code causing that error is

Code
Process.Start(Properties.Resources.telephone);

Any and all help to resolve this issue will be much appreciated



RE: C# Opening a Resource File - Lookdadon - Aug 18, 2024

Properties.Resources.xxx is embedded resources you stored in your app.
-string, images, etc

the process.start cant start something that is not a process(application) ex: chrome, notepad.

here is an example:
Code
Process.Start("cmd.exe");
Process.Start("notepad.exe");
its basic.

better way:
Code
foreach(var p in Process.GetProcessesByName("chrome"))
{//do your logic}
foreach(var p in Process.GetProcesses)
{//do your logic}
and so on

to send data to console to console on diff app you can use Process.StartInfo and adding arguments(args) so the console that gonna run from the process call with receive string data in
Main(args)

Same logic to pass data from a winform app the start console app.

Also process class can use eventhandler to receive information on process closing.

Useful class when used correctly!