|
Dear Sirs,
I have a program that takes command-line arguments. The ordinary method of ingestion is drag-n-drop. So, you drag a (DICOM|*.dcm) file (or more) onto my program, it reads them and processes them without showing a form. No problem. A coworker pointed out today that the program doesn't work with "twelve or so" files. I tried it and can get 23 items to work, but adding the 24th screws it up. The error message is a simple msgbox saying:
"Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item." With the full path to the application in the title-bar.
My guess is that he was using rather deeply-nested or long-named files. I'm thinking what's happenning is that the shell is somehow not getting the program path correct with lots of parameters?? the parameters somehow obstructing the filename?? I checked it out and when I get the twenty-three items to work, the command-line length (with full program path) is 2,075 characters. Raymond[^] has lots to say about it, but my length isn't close to what he talks about: Nowhere near 32767, over 2048, and not near 8192, and well over the dos limit of 127.
I could do something creative if my program would just run, but it never gets to sub Main().
If anyone has had this problem before, please give me sympathy. Even better, if someone knows how to work around or fix this problem, please let me know!! I've searched the web for a while and nothing came up. I was sure to check this forum to avoid double-posting. Thanks!
Aaron
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Raymond wrote: If you are using the ShellExecute/Ex function, then you become subject to the INTERNET_MAX_URL_LENGTH (around 2048) command line length limit imposed by the ShellExecute/Ex functions.
Think about it, dragging files from Explorer and dropping them onto your application requires something to start the application. I would venture to suggest that Explorer uses ShellExecute/Ex to do just that, hence the 2048 character limit.
It's time for a new signature.
|
|
|
|
|
Dear Mr. MacCutchan,
Good catch. This doesn't exactly explain the fact that I was able to get 2,075 characters into the command line. Well, either way, I still have a limit, even if it's not the 2048 limit, that I'm hitting. Thanks for your comment.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
you should not take 20 or more RX'es for a single patient, medical costs are skyrocketing as it is, nor mix pictures from different patients in a single run of some app, to avoid mix-ups.
|
|
|
|
|
Dear Mr. Pattyn,
Thanks! I'm anonymizing.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Not sure if there is a way around that limitation. That is, I'm not sure there is a way to drag-drop a virtually unlimited number of files and have them processed via command line. Instead, however, you could modify the context menu that pops up when you select mutliple files and right click them. You could add an extra item that say something like "Process With MyApp". That command would then add all those paths to a text file and then you'd pass that text file (as a command-line argument) to MyApp.exe (it would then read all the paths from that text file). Never tried that myself though, so I'm not sure if there would be any problems with doing it that way.
|
|
|
|
|
Dear Mr. aspdotnetdev,
Thanks for your suggestion. I'd hate to have to modify that menu.... I was hoping for a stand-alone app that didn't require a setup of any sort. Maybe I can make an alternate version... oh well.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Hi everybody!
Need a little help here...
http://yfrog.com/jx63488581j[^]
At the image u see a dialog window from ms access before and after u click "Objects" button.
I want to make something similar to this in a C# application, but dunno if there is actual control for that purpose, or I have to make it myself.
The idea is to have a number of buttons and when you click ONE of them you reveal a group of other "things".. buttons or other controls.. dunno, hope u got the idea
Thank you for the attention,
best regards Peter.
modified on Thursday, April 1, 2010 3:18 PM
|
|
|
|
|
First, no one is going to follow this link to look at your image.
Myzrael wrote: The idea is to have a number of buttons and when you click ONE of them you reveal a group of other "things".
Very easily accomplished, handle the button click event and show/hide the controls necessary.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: First, no one is going to follow this link to look at your image.
Because it doesn't work in the first place?
|
|
|
|
|
Now it works i hope.. sry
|
|
|
|
|
Mark Nischalke wrote: no one is going to follow this link to look at your image.
you're absolutely correct, the link does not work. 404
|
|
|
|
|
Mark Nischalke wrote: handle the button lick event
But I don't know where that button's been!!
|
|
|
|
|
Mark Nischalke wrote: First, no one is going to follow this link to look at your image.
Why not? I appreciate when people post links to images to help convey their question more clearly. Now, when they post links to zip files and such that contain code, that's an entirely different matter.
|
|
|
|
|
It's called a slide menu. It isn't used that much any more, mostly replaced by the ribbon control.
|
|
|
|
|
I have a Windows application in Visual Studio 2008. This application has data which I want to store in a database. I went into SQL Server Management Studio 2008 and created data tables which I want to access from Visual Studio.
I have clicked on Project, Add new item, Linq to SQL. I have a window open that's labelled DataClasses1.dbml. I clicked on Data and add new data source. In that tab I clicked on Add New Data Source. I clicked on Database and next. I clicked on New Connection and have a window open "Add Connection". I don't know what to do here. Can anybody help me?
Thanks.
Darrall
|
|
|
|
|
Choose the ConnectionType (OleDb, SQL, SQLCompact....)
Then choose the server or type it (if express edition then defult it is
something like .\SQLEXPRESS), then choose the DB, Test the Connection clikc
OK or Add foollowed by some Next(s).
Then in order to use LINQ to SQL you need to "add new file" to your project,
choose LINQ to SQL DBML follow and follow the setps.
NOTE: IN Visual Studio Express(C# lets say) you can't do it.
At least not in the 2008 version. You add the DBML. You need to manually
create the DataContext/Mapping.
But a much better source will be Gingle.
Search for videos of LINQ to SQL.
|
|
|
|
|
Thanks for your answer. What I still need to know is what to put under Database:
I created a database called ConstructionSurveyLayout in Management Studio but when I Browse my computer I can't find it. What am I supposed to put in that textbox?
|
|
|
|
|
normally the DBs on a local/personal computer not Server/Network should be in a folder like:
C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA
|
|
|
|
|
Ok. Thanks
|
|
|
|
|
Hello,
I'm attempting to have a console program take a path as an argument.
I have the following code executing:
static void Main(string[] args)
{
HandleArgs(args);
}
public static void HandleArgs(string[] args)
{
foreach (string arg in args)
{
if (arg.Contains("/path:"))
{
string execpath = arg.Substring(6, arg.Length - 6);
}
}
}
What i'd like to do is to take the string[] args as it is passed to Main() as a verbatim string.
The problem arises when the argument /path: is input as /path:"c:\documents and settings\" . The string arg in args is not verbatim, and execpath is then c:\documents and settings\" not c:\documents and settings\ as desired.
Another foreseeable situation is the the /path: argument is /path:""c:\documents and settings\" , as I am attempting a condition to determine if the last character is a \
How can I take the string into string[] args passed to Main() as a a verbatim string.
Thanks,
Matt
|
|
|
|
|
I'm not sure what you're asking; the term "verbatim string" makes no sense in this context.
If you want the command line as it appears on the command line, and not split into a string array, then try System.Environment.CommandLine
P.S. If you mean that you are looking at the string in the debugger and seeing \" rather than " -- please remember that the \ is not really there, it's only displayed for your convenience -- write it to the console and see for yourself.
modified on Thursday, April 1, 2010 12:54 PM
|
|
|
|
|
The following are the command line arguments:
/path:"c:\Documents and Settings\mbrown\Desktop\securable.exe" /save:"c:\Documents and Settings\mbrown\Desktop\"
The following code:
try
{
Console.WriteLine(savepath + "~scrublbdy.tmp");
streamer = File.CreateText(savepath + "~scrublbdy.tmp");
streamer.WriteLine("All work and no play makes Jack a null toy.");
streamer.Close();
File.Delete(savepath + "~scrublbdy.tmp");
}
catch (Exception err)
{
Console.WriteLine(err);
Environment.Exit(1);
}
Produces the following error:
C:\Documents and Settings\mbrown\My Documents\Visual Studio 2008\Projects\securable_buddy\Securable_Buddy\Securable_Budd
y\bin\Release\Securable_Buddy.exe /path:"c:\Documents and Settings\mbrown\Desktop\securable.exe" /save:"c:\Documents and Settings\"
c:\Documents and Settings"\~scrublbdy.tmp
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.GetFileName(String path)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileO
ptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.CreateText(String path)
at Securable_Buddy.Program.HandleArgs(String[] args) in C:\Documents and Settings\mbrown\My Documents\Visual Studio 2
008\Projects\securable_buddy\Securable_Buddy\Securable_Buddy\Program.cs:line 117
Note c:\Documents and Settings"\~scrublbdy.tmp .
The trailing \ is being treated as an escape character in the argument. So the "best" solution I can think of is making the arguments that are passed to the main() function be verbatim strings.
Any idea how to modify the incoming args to the Main() function static void Main(string[] args) to make them literal?
Thanks,
Matt
|
|
|
|
|
bbranded wrote: Any idea how to modify the incoming args to the Main() function static void Main(string[] args) to make them literal?
You cannot modify them. The .NET command line parser doesn't have any options.
The only solution I see is the same as PIEBALDconsult suggested: take Environment.CommandLine and parse it yourself.
|
|
|
|
|