Skip to content

Commit

Permalink
Moved the OutputDebugString P/Invoke signature to a separate “Kernel3…
Browse files Browse the repository at this point in the history
…2” class.
  • Loading branch information
perlun committed Nov 6, 2013
1 parent 2e0a73e commit d6284f4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<ItemGroup>
<Compile Include="JavascriptProxy.cs" />
<Compile Include="JavascriptServiceHost.cs" />
<Compile Include="Kernel32.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SubprocessCefApp.cs" />
Expand Down
10 changes: 10 additions & 0 deletions CefSharp.BrowserSubprocess/Kernel32.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Runtime.InteropServices;

namespace CefSharp.BrowserSubprocess
{
internal class Kernel32
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern void OutputDebugString(string message);
}
}
11 changes: 4 additions & 7 deletions CefSharp.BrowserSubprocess/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,18 @@ namespace CefSharp.BrowserSubprocess
{
public class Program
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern void OutputDebugString(string message);

static int Main(string[] args)
{
var hInstance = Process.GetCurrentProcess().Handle;
var hInstance = Process.GetCurrentProcess().Handle;
LogCommandLine(args);
MessageBox.Show("Please attach debugger now", null, MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("Please attach debugger now", null, MessageBoxButtons.OK, MessageBoxIcon.Information);

return ExecuteCefRenderProcess(hInstance);
return ExecuteCefRenderProcess(hInstance);
}

private static void LogCommandLine(string[] args)
{
OutputDebugString("BrowserSubprocess starting up with command line: " + String.Join("\n", args));
Kernel32.OutputDebugString("BrowserSubprocess starting up with command line: " + String.Join("\n", args));
}

private static int ExecuteCefRenderProcess(IntPtr hInstance)
Expand Down

0 comments on commit d6284f4

Please sign in to comment.