|
yes the path is correct...I add some details:
Basically from assembly main.exe I call myquery.exe.
It returns the error:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005)during myquery.exe execution (myquery.exe starts, so the path is ok, but after some line of code, it stops during a LINQ query on en excel file).
The strange thing is that if I run myquery.exe directly, everything work fine (the query is ok)
Is it possible something linked to db connection, called not directly??
|
|
|
|
|
have you tried to debug your application? since you said the error is while executing LINQ query on a excel file. was the file is located in the right folder the application is referring? can you log the full exception stack so that we may able to find the reason for the error.
Jibesh V P
|
|
|
|
|
you get the point.. the file is in the myquery.exe base directory.
From my main project main.exe is possible to include a path for searcing the excel file?
Basically in myquery.exe I'm opening the file using no path reference. But I can't change myquery.exe
I should include the path (in relative reference) in main.exe. I tried in Proprierties-ReferencePath but here is not possible tu include relative path (I'm not able)
My be in pre event command line?
|
|
|
|
|
If you run an child exe from other exe, the working directory of child exe will be same as that of parent. but you can force the working directory of the child to use its own by setting the working directory as below.
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"childExepath\myquery.exe";
start.WorkingDirectory = @"childExepath\";
Process p = new Process();
p.StartInfo = start;
p.Start();
p.WaitForExit();
Jibesh V P
|
|
|
|
|
I would suggest you debug the LINQ query, or add some logging information to the application.
|
|
|
|
|
TheGermoz wrote: while if i call it using
Meaning that the code you posted is running from a console application that does NOTHING else?
Or you are running it from an application that does do something else. If so then create a console application that does nothing else and run it from there.
|
|
|
|
|
Doing a general search, 0x80004005 means "unable to open registry key"; http://support.microsoft.com/kb/295297[^]
The child program may be running under restricted permissions. If run manually, you may be running as and administrator.
|
|
|
|
|
the strange thing is that if in the child program I indicate the full excel file name on which run the code, then I can call and work. Some cases
case 1 (the one I need)
Father program F1 call child C1 where (I mean in C1 code) excel file is indicate as
string myFile ="db.xls" : doesn't work.
case 2
F1 calls C1 where file is indicate as full path
string myFile =@"c:\db.xls" : works.
case 3
if I directly click on C1 where file is indicate as full path
string myFile ="db.xls" : works.
my problem is that I should keep string myFile ="db.xls"
|
|
|
|
|
can you paste the code how you construct the file path. i.e the code you used to open/load the file.
As I said earlier, when you start a child exe, by default the child exe's working directory is parent exe's path.
eg:
C:\Applicaiton\Bin1\Parent.exe
C:\Application\Bin2\Child.exe
C:\Application\Bin2\somefile.xls
If you start Child.exe from Parent.exe, the Working directory of Child.exe you are expecting to be 'C:\Application\Bin2\somefile.xls' but its not true. when you start Child.exe from Parent.exe the working dir of Child.exe is same as Parent.exe ie.'C:\Applicaiton\Bin1\Parent.exe' hence the application tries to find a file in Bin1 folder so throws exception.
You can force the Child.exe to use Bin2\ as its working directory by setting the ProcessStartInfo.WorkingDirectory = "Bin\..";
Jibesh V P
|
|
|
|
|
thank you very much!! You have completely solved my problem!!!
|
|
|
|
|
Happy to hear that. Thank You
Jibesh V P
|
|
|
|
|
Hi All,
I have a ListView with 3 groups.
I drag an item from TreeView to ListView:
private void listViewDemo_DragDrop(object sender, DragEventArgs e)
{
if (!is_listview)
{
string str = e.Data.GetData(DataFormats.Text).ToString();
ListViewHitTestInfo hit_info = listViewDemo.HitTest(listViewDemo.PointToClient(new Point(e.X, e.Y)));
if (hit_info.Location == ListViewHitTestLocations.None) return;
ListViewItem prev_item = hit_info.Item;
ListViewGroup group = prev_item.Group;
int idx = prev_item.Index;
Guid key = Guid.NewGuid();
string item_key = key.ToString();
group.Items.Add(listViewDemo.Items.Insert(idx,item_key, str, ""));
}
}
I expect to add an item in place of pointed item, but any option adds element in the end of the group.
How can i add the item in the spot where mouse hover?
|
|
|
|
|
The coordinates in the event handler are probably relative to the object you're dragging off. You might need to use ClientToPoint or whatever it's called to get it in global space before calling PointToClient.
|
|
|
|
|
Hi everybody,
+ I's 02 application:
- application A : a windows service
- application B : a windows form program (a .exe file)
and my problem's: when call app B within A's code then B unable get window title of windows although it's working when run B alone.
anybody resolve it?
|
|
|
|
|
Please don't do that. What are you really trying to accomplish?
|
|
|
|
|
You can't do that. There is no way to resolve it because a Windows Service runs under a completely seperate Desktop from the users desktop. UI applications do not ever get to show any windows so there is no window for your service code to find!
|
|
|
|
|
|
thank everybody... I'm sad...
anybody's other solution?
|
|
|
|
|
Think about the features you need, not how to implement it.
|
|
|
|
|
I found other solution:
I created a Task Scheduler for app B (B recreate task in 10').
when app A can't find process of B it's call Task to run B.
all done. thank everybody.
|
|
|
|
|
Hi All
I am pretty new on C# and I do have a question.
I have created a little Program which will move to the tray if it is started. Now I wan't do the following. If I select a text in any program (word, excel, webbrowser....) I will that the text is copied by my program, maybe to clipboard or a textfile.
How can I do that, a little working codesample will be very nice.
Regards
Martin
modified 23-Jan-13 6:58am.
|
|
|
|
|
You probably need to investigate Windows hooks[^] to capture messages and other activities not normally sent to your application.
|
|
|
|
|
Right click and select the copy option??
You can't possibly every single situation to do it yourself.
|
|
|
|
|
msickel wrote: If I select a text in any program (word, excel, webbrowser....) I will that the text is copied by my program, maybe to clipboard My Talking Clipboard[^] utility does exactly that.
/ravi
|
|
|
|
|
Thank's a lot, I think it is exactly what I am seraching for.
Regards
Martin
|
|
|
|