|
In my application I show some dialog box.
Particularly there is an auto-save dialog box (i.e. a SaveFileDialog) , which is shown with a timer.
Of course it's modal (shown with ShowDialog())
I should also say that my Application is using multiple Form, i.e. I start with Application.Run() (without the form argument) and I could have many document windows.
Now the problem is, if the auto-save of my program start when the user is using an other aplpication (say Paint.NET for example), when the user click back on my app, sometimes the modal SaveFileDialog is behing the app's other form. Clicking on the form just beep, and the user have to use ALT+TAB to show the SaveFileDialog, but some people might think my app is just buggy.
What can I do to avoid this behavior?
|
|
|
|
|
Make sure the SaveFileDialog specifies your main form as it's Parent/Owner.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
There is no single "Main Form".
In fact there are many "Main Form" and the autosave...
Ho.. never mind. The save file is to save a single document which is attached to a single window.
At least the save panel will be above this one!
Let's try....
Thanks for reminding me!
|
|
|
|
|
isn't there a topmost property for dialogs?
V.
No hurries, no worries
|
|
|
|
|
Hello,
is it possible to return a generic type from a method in C#?
Something like:
public <T> GetData()
{
T myReturnData;
//
// Code to fetch the data goes here..
//
return myReturnData;
}
Obviously, this example doesn't compile, but is there a way to accomplish this?
Thanks,
Michal
|
|
|
|
|
private T GetObject<T>(T t)<br />
{<br />
return t;<br />
}
only two letters away from being an asset
|
|
|
|
|
Great, thank you very much.
Michal
|
|
|
|
|
please,I need code for the Interactive Algorithm for Image Smoothing and Segmentation
thanks,
|
|
|
|
|
If you want the code, Google for it! Here, it's this[^] easy.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thanks very mutch... but i cann't find IMPLEMENTATION CODE for this algorithm
|
|
|
|
|
Well, it looks like you're going to have to write your own code! (Gasp!)
You didn't happen to see the pseudo-code at the end of a few of those PDF documents, did you?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Tell Explorer to Reload Display Registry Settings?
I have been looking everywhere for a simple example on how to make a change to the HKCU\Control Panel\Desktop registry keys and then have Explorer or Desk.cpl or whatever, reload it back into memory.
I've found stuff that looked promising, but I could never make it work.
I thought that this would be it but it's not but I know it's the right track:
[DllImport("user32.dll",<br />
CharSet=CharSet.Auto, SetLastError=true)]<br />
[return:MarshalAs(UnmanagedType.Bool)]<br />
public static extern bool<br />
SendMessageTimeout(<br />
IntPtr hWnd,<br />
int Msg,<br />
int wParam,<br />
string lParam,<br />
int fuFlags,<br />
int uTimeout,<br />
int lpdwResult<br />
);<br />
<br />
public const int HWND_BROADCAST = 0xffff;<br />
public const int WM_SETTINGCHANGE = 0x001A;<br />
public const int SMTO_NORMAL = 0x0000;<br />
public const int SMTO_BLOCK = 0x0001;<br />
public const int SMTO_ABORTIFHUNG = 0x0002;<br />
public const int SMTO_NOTIMEOUTIFNOTHUNG = 0x0008;<br />
<br />
<br />
int result;<br />
SendMessageTimeout( (System.IntPtr)HWND_BROADCAST,<br />
WM_SETTINGCHANGE,0,"Environment",SMTO_BLOCK | SMTO_ABORTIFHUNG |<br />
SMTO_NOTIMEOUTIFNOTHUNG, SomeTimeoutValue, out result);
I just want to broadcast to all Windows that a registry change was made and that they need to reload their section.
|
|
|
|
|
I am trying to find a way to run a java program from within a C# program using the following;
java -Xmx1000M -jar odljava.jar
Followed by a filename that may or may not contain wildcards e.g. filename*
I have tried using myProcec= Process.Start(java -Xmx1000M -jar odljava.jar) but with no luck.
Anyone know how to do this?
David Wilkes
|
|
|
|
|
instead of passing all the arguments in process.Start, have you tried created a new Process instance, then setting the process' .StartInfo.Arguments property to the "-Xmx1000M -jar odljava.jar" arguments?
|
|
|
|
|
hi friends
what is the difference between
console.readline();
vs
console.read();
regards
saravanan
|
|
|
|
|
Console.Read Method[^]
Reads the next character from the standard input stream.
Console.ReadLine Method [^]
Reads the next line of characters from the standard input stream.
Difference:
"line of ... ers"
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Im trying to write a utility that opens an excel file using C#.net Visual Studio 2005. One of the first things I have to do is add a reference to the Microsoft Excel 11 Object Library. After I add this I have to add the "using" statement to use Microsoft.Office.Interop.Excel. However, I cant seem to be able to find the Interop class. Intellisense only picks up Microsoft.Office.Core ...has anyone else experienced this? How did you add this class?
Thanks
|
|
|
|
|
Your using statement will be
using Microsoft.Office.Core;
Just because I've been through this pain before and the documentation for automatation is awful, I thought I'd paste an old demo I had lying around...
private void ReadExcelValue()
{
object o = System.Reflection.Missing.Value;
Excel.Application objE = new Excel.Application();
Excel.Workbooks objBooks = null;
Excel.Workbook objB = null;
Excel.Worksheet objS = null;
objE.Workbooks.Open(Server.MapPath("spreadsheet.xls"), o, o, o, o, o, o, o, o, o, o, o, o, o, o);
objBooks = objE.Workbooks;
objB = objBooks[(object)1];
objS = (Excel.Worksheet)objB.Worksheets[(object)1];
Response.Write(((Excel.Range)objS.Cells[1, 1]).Text);
Release(objS);
if (objB != null)
objB.Close(false, o, o);
Release(objB);
if (objBooks != null)
objBooks.Close();
Release(objBooks);
if (objE != null)
objE.Quit();
Release(objE);
GC.Collect();
System.Diagnostics.Process[] objPr = System.Diagnostics.Process.GetProcessesByName("Excel");
foreach (System.Diagnostics.Process pr in objPr)
pr.Kill();
}
private void Release(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
}
catch { }
finally
{
obj = null;
}
}
Note: It's rather ugly stuff and there's a cheesy hack to make sure that the excel process doesn't persist on the server after execution (yes it's pretty easy to end up with thousands of Excel.exe processes if you don't kill them).
HTH
|
|
|
|
|
am i still missing any namespaces apart from the Microsoft.Office.Core library? cause I dont have the Application or Workbook classes in the Excel library (maybe im not stating that correctly). When I type Excel. intellisense does not pick up Application or Workbook...do I need any thing else?
Thanks
|
|
|
|
|
I only had two references I added to get that code working were:
Microsoft Office 11.0 Object Library
Microsoft Excel 11.0 Object Library
Obviously those will vary dependant on which version of office you are developing against.
Intellisense partially works in web developer express, and vs 2005. I do seem to remember that it pretty much didn't work at all in older versions of visual studio (but not 100% sure on that). It's all part of the pain of doing office automation I'm afraid
HTH
|
|
|
|
|
i cant even compile the project let alone get intellisense to work. i think im missing some namespace...the pain with VS 2005.
im waiving the white flag..help.
|
|
|
|
|
Have you included the Microsoft Interop Assemblies as references in your project?
|
|
|
|
|
I did do an add reference, and the on the COM tab chose Microsoft Excel 10 Object Library.
Does this suffice? Do you have to manually install any other interop libraries?
|
|
|
|
|
I believe that should be sufficient. You might, however, need the Excel 11 libraries, which are included on the install disk for excel if you have 2003 or 2003 Pro (But NOT 2003 basic).
Once you have the right one included, you should be able to access the correct namespaces/methods.
|
|
|
|
|
I have a user control with a ListView on the top and two buttons on the lower left. As the control is resized, I want the list to "grow" and the buttons to stay at the lower right. The ListView is anchored to top, bottom, left, right and the buttons are anchored to bottom and right. I can change the size at design time and everything works as planned. When I drop this on a form and drag the size to the size I want, it works fine. But when I close the designer and reopen it, it appears the ListView has expanded to the full size of the control like it is docked to each edge. Any idea what may be wrong?
I also tried setting the size in code but same issue at runtime.
Thanks. -- Bud
|
|
|
|