|
how run application(program) in task(background)
and how how close process program
|
|
|
|
|
I think if you search on the Process object and process.Start(program) You will find all the info you need.
Hope that helps.
Ben
|
|
|
|
|
I doing add reference to some TLB file and i see that in the C# project i have the tlb lib wrapped in some interop.
The problem is that the TLB does not show me all the interface that are in the TLB file.
Someone have solution ?
Thanks
|
|
|
|
|
Hi,
Can Anybody help me which API should i use to disable double clicking on window border.When ever we double click on the windows form header it will maximises the window at the top left corner of the desktop.I want to disable this Property for my window.
Any help will be greatly appreciated.
|
|
|
|
|
Hello,
kyreddy wrote: which API should i use to disable double clicking on window border
No API needed!
Just override WndProc method like this:
const int WM_SYSCOMMAND = 0x112;
const int SC_MAXIMIZE2 = 0xF032;
protected override void WndProc( ref Message m )
{
if( m.Msg == WM_SYSCOMMAND )
{
if( m.WParam.ToInt32() == SC_MAXIMIZE2 )
{
return;
}
}
base.WndProc( ref m );
}
Hope it helps!
-- modified at 7:09 Wednesday 1st August, 2007
All the best,
Martin
|
|
|
|
|
Thank you very much Martin its working.
|
|
|
|
|
You are wellcome!
All the best,
Martin
|
|
|
|
|
If you talking about C# you do not need API for this, just set to false the MaximizeBox property for the Form object.
|
|
|
|
|
I've a simple function:
<code>
private void BuildTree()
{
TreeNode rootNode = new TreeNode("Root");
TreeNode node1 = new TreeNode("Child 1");
TreeNode node11 = new TreeNode("Child 11");
TreeNode node12 = new TreeNode("Child 12");
node1.Nodes.Add(node11);
node1.Nodes.Add(node12);
rootNode.Nodes.Add(node1);
TreeNode node2 = new TreeNode("Child 2");
rootNode.Nodes.Add(node2);
TreeNode node3 = new TreeNode("Child 3");
rootNode.Nodes.Add(node3);
treeView1.Nodes.Add(rootNode);
if (!rootNode.IsExpanded)
{
rootNode.Expand();
}
}
</code>
My problem is:
If I create a new Winforms application, the expand function does its work, but if the same function is written into a .dll where the treeview is on a usercontrol, expand does nothing. I mean the node doesn't expands so I have to click on '+' to do it.
I use the same function at each time.
Any guess?
Peter Kovacs
collapo
|
|
|
|
|
Just a guess but the difference may be at what point you call this function. Probably your test app already shows the treeview when calling the function while your usercontrol calls the function before the tree is visible.
I don't think it has anything to do with the user control as I already used Expand on TreeViews within user controls.
Robert
|
|
|
|
|
The treeview is shown in initializecomponents in both project, if I'm not mistaken, therefore that can not be the problem. The function is called right after Initializecomponents(), so it is called "at the same time".
But anyway thanks, I'm waiting for others.
And the winform application is not a test, but a paralell application.
Peter
|
|
|
|
|
Hi,
I am using MSACCESS database which is belonged with password. and I need to know that how do I create connection string?
Thanks in Advance
|
|
|
|
|
|
Thank you Mr. il_masacratore
|
|
|
|
|
Hi,
The following is the code i used to create, write to and save an excel file. Everything goes fine except there is a delay in releasing the object. Yes it persists till the application is closed. Sometimes i'm able still see the excel.exe in the task manager even after the application is closed. Is there any way to overcome this.
I've added a reference to excel 11.0 com component.
private void CreateExcel()
{
Excel.Application ExcelApp = null;
Excel._Workbook ExcelWorkbook = null;
Excel._Worksheet ExcelWorkSheet = null;
string strSavePath = "";
try
{
ExcelApp = new Excel.Application();
ExcelApp.Visible = false;
ExcelWorkbook = (Excel._Workbook)(ExcelApp.Workbooks.Add(Type.Missing));
ExcelWorkSheet = (Excel._Worksheet)ExcelWorkbook.Sheets["Sheet1"];
// ExcelWorkSheet.Name = "My Sheet";
//Make sure Excel is visible and give the user control
//of Microsoft Excel's lifetime.
ExcelApp.Visible = false;
ExcelApp.UserControl = false;
/*********************/
DataSet dsData = MyDataLayer.GetDataSet("Select top(3) from XXXX");
if (dsData != null && dsData.Tables.Count > 0)
{
// the writing process
ExcelWorkSheet.Cells[iRowIndex, iColumnIndex] = data;
}
/*********************/
//ExcelWorkSheet.get_Range("A3", "F3").HorizontalAlignment =
//Excel.XlHAlign.xlHAlignCenter;
//ExcelWorkSheet.get_Range("A1", "A1").Font.Bold = true;
ExcelWorkSheet.Visible = Excel.XlSheetVisibility.xlSheetVisible;
ExcelWorkSheet.Activate();
ExcelWorkSheet.get_Range("A3", "F3").EntireColumn.AutoFit();
//ExcelWorkSheet.get_Range("E1","E1").Columns.EntireColumn.NumberFormat = "£###,###,##0.00";
strSavePath = Application.ExecutablePath.ToString();
strSavePath = strSavePath.Substring(0, strSavePath.LastIndexOf("\\"));
strSavePath = strSavePath + "\\TestExcelFile.xls";
ExcelWorkbook.SaveAs(strSavePath, Excel.XlFileFormat.xlExcel7, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
// ExcelWorkbook.Close(false, strSavePath, null);
// return;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
if (ExcelWorkSheet != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelWorkSheet);
ExcelWorkSheet = null;
}
if (ExcelWorkbook != null)
{
ExcelWorkbook.Close(false, strSavePath, null);
System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelWorkbook);
ExcelWorkbook = null;
}
if (ExcelApp != null)
{
ExcelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelApp);
ExcelApp = null;
}
}
finally
{
if (ExcelWorkSheet != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelWorkSheet);
ExcelWorkSheet = null;
}
if (ExcelWorkbook != null)
{
ExcelWorkbook.Close(false, strSavePath, null);
System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelWorkbook);
ExcelWorkbook = null;
}
if (ExcelApp != null)
{
ExcelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelApp);
ExcelApp = null;
}
//GC.WaitForPendingFinalizers();
}
GC.Collect();
}
Thanks,
PLS
|
|
|
|
|
I have also run into this problem some time ago. The only solution (workaround) I found was to get a list of all running processes (Process.GetProcesses) before creating the Excel.Application instance and then again after the creation to fetch the corresponding process. I then killed this process after being done.
I know this is completely insane but as said I didn't find any other solution.
Robert
|
|
|
|
|
Hi All,
I am using FolderBrowserDialog in my application. FolderBrowserDialog have RootFolder Property, where it gets or sets the root folder where the browsing starts from. But we can assign only SpecialFolder to RootFolder.
Is it possible to assign user specified folders other than special folders?
Is there any other dialog where we can achieve this?
Thanks in advance.
|
|
|
|
|
The SelectedPath property is what you're looking for.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thank You. Thank You. Thank You.
|
|
|
|
|
Hi!
I want to dial a number by my modem and play a voice after a person response to the call.
|
|
|
|
|
why?
Check out this thread....(not a CP thread though)
http://www.velocityreviews.com[^]
Just type dial number modem C# into google. It's quicker than posting here believe it or not.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
Hi,
(thanks for all the help in the past)
I'm trying to sort a column in a DataGridView. I know it does this automatically, but I'm trying to sort the column so that the cell containing a specific text (Exception) is always at the top.
'Exception' is does not come first alphabetically in the grid.
Is there any way of getting around this?
God Bless
Deji
|
|
|
|
|
Hi,
When i tried to serialize WinForms, i got SerializationException, Though i
the attribute [Serializable()] is added .
Please help me to serialize a form object.
With Thanks,
Sakthi.
|
|
|
|
|
Hello,
You really have to provide more information.
The exception message would be of great help.
Maybe one of the public fields in your class is not serializable.
Have you looked at the articles (like this[^]) here on the forum?
Hope it helps!
-- modified at 7:31 Wednesday 1st August, 2007
Here, an article for serializing WinForms[^]
All the best,
Martin
|
|
|
|
|
You can't serialize a winform in it's entirety because several of the Form members are not serializable.
Deja View - the feeling that you've seen this post before.
|
|
|
|