I am assuming, the class car had array object color. When you try tp pass Array of color to the method CarData, because carCollection is a type of List, you need to past the index of the car collection which means:
There was a project on here that would fix the problem of seeing controls paint after calling .ShowDialog(). I believe it was just a trick where the form was painted into memory and then displayed - but it did make for a more pleasant user experience. I tried searching and cannot locate it.
Does anyone know the article, or know how I might go about doing this?
I've got a 16-bit Windows application that I'm trying to run from within a C# WinForms application, but it throws "Win32Exception was unhandled - the parameter is incorrect".
How do you call a 16-bit app from C#?
Here's what I've got. Apologies if this is too much information, but I figured I should err on the side of too much rather than too little.
System.Diagnostics.Process p = new System.Diagnostics.Process();<br />
p.StartInfo.FileName = "c:\\My16BitApp.exe";<br />
p.StartInfo.UseShellExecute = true;<br />
I can run my 16-bit app successfully by going to Start > Run and typing in "c:\My16BitApp.exe" so I know XP can handle it. As a sanity check, I also created a batfile (RunMy16BitApp.bat) that contains the following:
When I run that bat file from the command line (or Run dialog) it works fine. If I run the bat file from C# using Process.Start(), the following message is displayed in the cmd window:
The system cannot execute the specified program.<br />
Press any key to continue
What am I missing? Thanks for your help!
MSDN has the following information, which brings me back to where I am (trying to run a 16-bit program from a 32-bit program):
Failure to Start
If the Shell function cannot start the named program, a FileNotFoundException error occurs. This can happen, for example, when you attempt to run a 16-bit program, such as command.com, from an application using System.Windows.Forms. For a workaround, you can run a 32-bit program that calls the desired 16-bit program. In the case of command.com, you can run cmd.exe as an alternative.
As far as I can tell, if the Visual Studio hosting process is enabled, then when Start Debugging is selected, no new process is added. If you look at the Task Manager Processes tab, you see xxx.vshost.exe when the IDE is open and still only see that when the application is being run (debugged). The place where you _can_ tell a difference is the Applications tab of the Task Manager. I know how to get the list of processes that show up in the task manager Processes tab. How do I get the list of applications that show up in the Applications tab?
Thanks for the suggestions - don't think they will solve this problem. Yes, both cases are "debugging" but I specified I was interested in the case where vshosting is enabled because I can detect what I need to know in the case where it isn't. Environment.CommandLine won't tell me because it is another instance of the application that needs to know. I do not need to determine between debug and release versions. What will tell me what I need to know sits in the Applications tab of the Task Manager - do you know how to access that info? The other way I see is if there is some property of the vshost process which indicates whether it is running the application currently or not. Seemed easier to me if I could access the Applications tab of the task manager.
getting the list of items shown by "app" tab in Task Manager is complex; it entails
finding the right window (i.e. knowing the names of the windows in its hierarchy),
then sending some LVM_... messages to the listview. It must be similar to enumerating
the notify icons in the system tray, and the icons on the desktop. Each of these
can be found in several CodeProject articles.
I dont think reading that list is a very good idea; it is complex and the names you would
get are Window titles, which does not necessarily correlate well with the process names...
Using TaskInfo I noticed the vshost.exe process has quite different characteristics
(CPU time, working set, number of windows, ...) when comparing an idle state with
an active debug state.
So if what you want to figure out is whether something is being handled by vshost,
I suggest you get hold of its PID (using Process class), then do a P/Invoke to
either get its main window title, or to enumerate all its windows (zero when not active).
The window title would work fine - doesn't need to correlate with the process name. I was searching for task manager before - I'll try your system tray idea - do seem to remember seeing some items on that. Will also look into your idea of vshost characteristics - thanks.
some additional thoughts regarding Task Manager:
- it is not always running; so you cant enumerate its apps when it does not run
- when running, another tab may be visible; dont know whether it keeps updating tabs
that are not visible...
So I strongly suggest you go for the process characteristics...
Evidently, there is no easy way to access the same information as that in the applications tab of the task manager the way one can easily access the same information as that in the processes tab. Or, if there is, it isn't obvious to any of us. Instead, I used the method below (resulted from suggestion by Luc Pattyn) to determine whether the IDE simply had the application open or was running it.
Note - non-relevant portions of code omitted (the ...'s).
conststring IDE_INDICATOR = ".vshost";
Process current = Process.GetCurrentProcess();
IDE_Name = current.ProcessName;
IDE_Name = current.ProcessName + IDE_INDICATOR;
... (looping through all processes)
if (process.ProcessName == IDE_Name)
IntPtr WindowHandle = process.MainWindowHandle;
if (WindowHandle != IntPtr.Zero)
// then application is being run by the IDE
// IDE is open with the application loaded, but not currently running it - at least not in debug mode,// and non-debug mode can be detected because it has its own process
I need to pass a command line argument containing a database connection string to the registry.
I pass it to a windows installer exe made with VS2005. I can obtain the string from inside the installer. But if i try to manually insert it, for example in
T Add<T>(T x, T y) where T: int, double, float
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
Last Visit: 31-Dec-99 18:00 Last Update: 28-Sep-23 15:48