我有一个隐藏的表单,这个加载一个子表单,2e表单也应该被隐藏
请注意:我最不习惯
ShowInTaskbar = false; // should be hidden too
Run Code Online (Sandbox Code Playgroud)
如果我使用(隐藏/可见),我最能够在表单之间进行通信,直到它的可见=真;
this.SetParameterValueCallback += new SetParameterValueDelegate(ShowMain.SetParamValueCallbackFn);
ShowMain.AddItemCallback = new AddItemDelegate(this.AddItemCallbackFn);
//Showsub.Show();
Showsub.Hide(); // not working
Run Code Online (Sandbox Code Playgroud)
到目前为止我已经尝试过
this.Visible = false; // didnt work
BeginInvoke(new MethodInvoker(delegate
{
Hide();
})); // didnt work
base.SetVisibleCore(false); // didnt work, Im not able communicate between form
Run Code Online (Sandbox Code Playgroud) 请回答问题, 否则不回答这个问题.
让我重新开始.我如何使用这个扩展内部Environment.GetSpecialFolder的类?
我不想要特别的根
root = Environment.GetFolderPath(Environment.SpecialFolder)
Run Code Online (Sandbox Code Playgroud)
因为我想将此用于其他目的而不是.net.
例如,如何通过单击按钮调用(Favorites = 6)位置?
public class EnvironmentFolders
{
public enum SpecialFolder
{
AdministrativeTools = 48,
//{user name}\Start Menu\Programs\Administrative Tools
ApplicationData = 26,
//{user name}\Application Data
CommonAdministrativeTools = 47,
//All Users\Start Menu\Programs\Administrative Tools
CommonApplicationData = 35,
//All Users\Application Data
CommonDesktopDirectory = 25,
//All Users\Desktop
CommonDocuments = 46,
//All Users\Documents
CommonFavorites = 31,
CommonNonLocalizedStartup = 30,
//non localized common startup
CommonPrograms = 23,
//All Users\Programs
CommonStartMenu = 22,
//All Users\Start Menu
CommonStartup = 24,
//All …Run Code Online (Sandbox Code Playgroud) 如何获得一个整数的值x,表示为x!,它是数字1到x的乘积.
例: 5! 1x2x3x4x5 = 120.
int a , b = 1, c = 1, d = 1;
printf("geheel getal x = ");
scanf("%d", &a);
printf("%d! = ", a);
for(b = 1; b <= a; b++)
{
printf("%d x ", c);
c++;
d = d*a;
}
printf(" = %d", d);
Run Code Online (Sandbox Code Playgroud) 我试图找出使用下面的类锁定文件的进程.这里出了什么问题?
呼叫:
private void button1_Click(object sender, EventArgs e)
{
Console.WriteLine(Win32Processes.GetProcessesLockingFile("locked_file.dll").ToString());
}
Run Code Online (Sandbox Code Playgroud)
输出:
System.Collections.Generic.List`1 [的System.Diagnostics.Process]
使用此电话:
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Text;
using System.Threading;
namespace FileLockInfo {
public class Win32Processes {
/// <summary>
/// Return a list of processes that hold on the given file.
/// </summary>
public static List<Process> GetProcessesLockingFile (string filePath) {
var procs = new List<Process>();
foreach (var process in Process.GetProcesses()) {
var files = GetFilesLockedBy(process);
if (files.Contains(filePath)) procs.Add(process);
}
return procs;
}
/// …Run Code Online (Sandbox Code Playgroud) 如何将包含1000行的单个文本文件拆分为多个较小的文件,例如每行300行?请记住,原始文件可能有多于或少于一千行.
file1.txt 300 lines -> rest
file2.txt 300 lines -> rest
file3.txt 300 lines -> rest
file4.txt 100 lines
Run Code Online (Sandbox Code Playgroud)
我试过以下但是没有用.
int counter = 0;
string line;
string lineoutput = (current_dir + "\\" + DateTime.Now.ToString("HHmmss") + ".txt");
System.IO.StreamReader inputfile;
inputfile = new System.IO.StreamReader(new_path);
while ((line = inputfile.ReadLine()) != null)
{
System.IO.StreamWriter file = new System.IO.StreamWriter(current_dir + "\\" + DateTime.Now.ToString("HHmmss") + ".txt", true);
string _replaceBackspace = ReplaceBackspace(read_file.ReadLine().ToLower());
using (StreamWriter writer = new StreamWriter(lineoutput, true))
{
if (counter == 5000)
{
counter = …Run Code Online (Sandbox Code Playgroud) 我是ARM微控制器编程的初学者,但我确实有AVR和PIC微控制器的经验.
几天前我从ebay.com购买了(STM32 STM32F103VET6开发).我现在正在尝试编写这个板,但我不知道从哪里开始.我还收到了一张CD,其中包含一些数据表和一些文件(全部用中文).
谁能告诉我如何开始?或者有一些源样本......
我已经安装了Keil uVision4.我也有一个J-link调试器.
谢谢.
如何从进程ID获取FullName(路径)
例如,如果int id = 234
如何找到id的位置;
int Id = Convert.ToInt32(lvprocesslist.SelectedItems[0].SubItems[1].Text);
string s = Process.GetProcessById(Id).MainModule.FileName;
Console.WriteLine(Path.GetFullPath(s));
Run Code Online (Sandbox Code Playgroud)
它不能在Windows PID下运行(记事本3704)无法正常工作
谢谢.
我正在尝试使用以下代码获取组合框项目数.它不会给出错误,也不会给出正确的计数.我想我必须将int转换为字符串,但是如何?
ComboBox1->ItemIndex = 1;
int count = ComboBox1->Items->Count;
Edit1->Text = "Count: " + count;
Run Code Online (Sandbox Code Playgroud) 我在这做错了什么?
呼叫
printf(filename(exename));
Run Code Online (Sandbox Code Playgroud)
我的函数应该返回文件名
const char* filename(const string& str)
{
const char* path;
size_t found;
found=str.find_last_of("/\\");
path = (str.substr(found+1)).c_str();
cout << str.substr(found+1); // ------------> is name ok
printf("\n\n");
printf(path); // ------------> is name not ok random numbers
printf("\n\n");
return path; // ------------> is not ok random numbers
}
Run Code Online (Sandbox Code Playgroud) 如何使这个工作.javascript应该通过返回读取php值并显示它.
谢谢,
<html>
<body>
<script type="text/javascript">
var _date = "<?=
$xml = new DOMDocument();
$xml->load( 'http://web.com/public.xml' );
$elements = $xml->getElementsByTagName( "data" );
$dates = $xml->getElementsByTagName( "i_data" );
$_date = $dates->item(0)->nodeValue;
return $_date;
?>";
alert(_date)
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 如何在Windows XP和7(.net2)上以大多数工作的百分比来显示总内存使用量
我尝试了以下解决方案没有成功(崩溃或冻结)
http://www.pinvoke.net/default.aspx/kernel32/GlobalMemoryStatusEx.html
和使用
System.GC.GetTotalMemory(true);
Run Code Online (Sandbox Code Playgroud)
工作样本感谢达林,
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
public class MEMORYSTATUSEX
{
public uint dwLength = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(MEMORYSTATUSEX));
public uint dwMemoryLoad;
public ulong ullTotalPhys;
public ulong ullAvailPhys;
public ulong ullTotalPageFile;
public ulong ullAvailPageFile;
public ulong ullTotalVirtual;
public ulong ullAvailVirtual;
public ulong ullAvailExtendedVirtual;
}
[System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
static extern bool GlobalMemoryStatusEx(MEMORYSTATUSEX lpBuffer);
private void timer1_Tick(object sender, EventArgs e)
{
var result = new MEMORYSTATUSEX();
if (GlobalMemoryStatusEx(result))
getpercentage(((double)result.ullTotalPhys - result.ullAvailPhys) / result.ullTotalPhys);
}
static void getpercentage(double …Run Code Online (Sandbox Code Playgroud) 如何从c ++控制台应用程序执行.exe.我尝试了以下方法没有工作.
我想运行一个我创建了一段时间"Radio.exe"的应用程序.此应用程序在启动时读取xml文件,如果我手动运行此应用程序它工作正常,但如果通过控制台应用程序"Radio.exe"运行它无法找到xml文件?
void execute( char* path)
{
// cant find xml ?
ShellExecuteA( NULL, NULL, path, NULL, NULL, SW_SHOW );
// cant find xml ?
ShellExecute(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL);
// and also cant find xml ?
SHELLEXECUTEINFO rSEI ={0};
rSEI.cbSize=sizeof( rSEI );
rSEI.lpVerb= NULL;
rSEI.lpFile= "C:\\Users\\me\\Documents\\Radio.exe"; // = path
rSEI.lpParameters= 0;
rSEI.nShow = SW_NORMAL;
rSEI.fMask = SEE_MASK_NOCLOSEPROCESS;
ShellExecuteEx( &rSEI );
}
Run Code Online (Sandbox Code Playgroud)