Ace
Ace
CC#
Created by Ace on 1/2/2025 in #help
Executing explorer.exe into virtualdesktop
First of all, Happy New Year! I'm working on a project in C#, I'm using the CreateDesktop API to create a desktop and draw it to a PictureBox. However, there's an issue: the explorer.exe is not loading into the virtual desktop it spawns into the default desktop, and nothing is being drawn into the PictureBox. The process is running in admin mode. I believe the flow is as follows: Admin process -> CreateProcessW (using startup info to select the desktop) Admin explorer (but it doesn't run in admin mode due to security restrictions, so it relaunches) CreateProcessW (forcing the relaunch into the default desktop) User explorer (now running on the default desktop instead of the hidden one) This is my failed method code to fix issue: https://www.codebin.cc/code/cm5ee6tm50001mq03bb882yhv:2Z9hkuSY94ZEhCGgAm5i9yFCnaJ5qnyqDsKScZAhG9Ax
1 replies
CC#
Created by Ace on 1/11/2024 in #help
Sending text from ChatForm.cs to chathandler.cs to server does not work
server button code:
private void Sendpacket_Click(object sender, EventArgs e)
{
try
{
if (txtMessage.Text.Trim() != "")
{
ChatHandler.ClientToServer(txtMessage.Text);
AddMessage("Me", txtMessage.Text.Trim());
txtMessage.Text = "";
txtMessage.Focus();
}
}
private void Sendpacket_Click(object sender, EventArgs e)
{
try
{
if (txtMessage.Text.Trim() != "")
{
ChatHandler.ClientToServer(txtMessage.Text);
AddMessage("Me", txtMessage.Text.Trim());
txtMessage.Text = "";
txtMessage.Focus();
}
}
ChatHandler.cs
public class ChatHandler : IMessageProcessor
{


ISender sender;

public bool CanExecute(IMessage message) => message is DoChat || message is DoKillChatForm || message is DoStartChatForm;

public bool CanExecuteFrom(ISender sender) => true;

public void Execute(ISender sender, IMessage message)
{
switch (message)
{
case DoKillChatForm Msg:
closechat();
break;
case DoStartChatForm Msg:
startchat();
break;
case DoChat Msg:
OnDataReceived(Msg.PacketDms);
break;
}
}
public void ClientToServer(string message)
{
try
{
sender.Send(new GetChat { Message = message.ToString() });
}
catch (Exception ex)
{
MessageBox.Show($"Error sending message: {ex.Message}");
}
}
public class ChatHandler : IMessageProcessor
{


ISender sender;

public bool CanExecute(IMessage message) => message is DoChat || message is DoKillChatForm || message is DoStartChatForm;

public bool CanExecuteFrom(ISender sender) => true;

public void Execute(ISender sender, IMessage message)
{
switch (message)
{
case DoKillChatForm Msg:
closechat();
break;
case DoStartChatForm Msg:
startchat();
break;
case DoChat Msg:
OnDataReceived(Msg.PacketDms);
break;
}
}
public void ClientToServer(string message)
{
try
{
sender.Send(new GetChat { Message = message.ToString() });
}
catch (Exception ex)
{
MessageBox.Show($"Error sending message: {ex.Message}");
}
}
i have also skill issue with english ;-;
2 replies