Cience
Cience
CC#
Created by Cience on 8/15/2023 in #help
❔ Webview2 showing nothing just blank
5 replies
CC#
Created by Cience on 7/25/2023 in #help
✅ console.writeline not working on Winforms application
I attempted to use this post to help me https://stackoverflow.com/questions/4362111/how-do-i-show-a-console-output-window-in-a-forms-application use a console on a WinForms application but the output will not show, I have read over the "Duplicate questions" page and they all don't answer my question I've tried using Debug. WriteLine but it doesn't work either. I'm assuming I'm missing a setting of some sort but they all say "use Managed Compatibility Mode" but its been gone for years, I'm having it open the console on a button press, and it opens the console it just won't output anything I've also tried "FreeConsole()" but it doesn't even open.
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();

private void button1_Click(object sender, EventArgs e)
{
AllocConsole();
string message1 = "test123";
Console.WriteLine(message1);
}
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();

private void button1_Click(object sender, EventArgs e)
{
AllocConsole();
string message1 = "test123";
Console.WriteLine(message1);
}
78 replies
CC#
Created by Cience on 7/10/2023 in #help
❔ not all code paths return a value
this code im like 99% sure i need a return statement and without Mouse Hook says "not all code paths return a value" but when i add the return statement the error goes away with a new one on the "return;" an object of type convertible to "IntPtr" is required, can someone show me how to fix this? public IntPtr MouseHook(int left, int top) { SetCursorPos(left, top); hookId = Hook(process); return; }
6 replies
CC#
Created by Cience on 7/9/2023 in #help
✅ Detect holding mouse from in and outside the form
this here https://stackoverflow.com/questions/49068445/c-sharp-detect-mouse-clicks-anywhere-inside-and-outside-the-form is the general concept but it only works on singular mouse clicks, here is a base example and if the mouse button is released the code stops i cant really explain stuff well so if you need to know more please ask using WPF, Visual studio 2022. ```csharp if(Mouse button is held down anywhere) { Runcode(); } if(mouse button is released) { StopRuncode(); }
40 replies
CC#
Created by Cience on 9/3/2022 in #help
Windows Visual studio 2022 designer bugging out
21 replies