|
You need to use relative paths in your HTML file that you're writing. I suggest using the Microsoft way of doing it, which is what happens when you save a page from Internet Explorer using the default settings: the HTML page is saved to disk and a folder is created with the same name and "_files" appended. In that directory are all the files that can be resolved (images, script files, etc.). When the HTML file is saved the path to those linked files are changed to a relative path - relative to the document, like so:
filename_files/img1.gif
filename_files/img2.jpg
Try it. Save a document with images to disk and examine both the file and the folder with the same name.
Using the same convention is consistent with other applications that use MSHTML (including IE, Word, FrontPage, and more), as well as other third-party libraries that want to provide a consistent user interface. Windows XP and newer platforms also allow users to manage both the HTML file and related folder as a single unit.
How you alter it is by parsing the text as you write it and changing what gets written, then skipping that portion of the text you're writing. You could also modify it before saving. It really just depends on your requirements and if you can modify the in-memory document.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I would like to know the best approach for sending information or a message from a DLL file back to the EXE file. Right now, the way I do it is pretty lame. I want to either pass a function pointer (I guess they are called delegates in C#) that I can pass to the dll upon linking. Or set up some sort of message system. Its easy to call functions from a dll, but how to I do it the other way around (cleanly)
Right now, I have some pointer to some object which has some event --its really fugly.
Thanks
|
|
|
|
|
|
|
Actually, I have a kind of similar problem. I really want to put a .dll into a process so that I can send it an object. I need it in a process because for whatever reason it does not behave properly in a thread. I don't know why this is.
When i put something like
Process testthis.StartInfo.FileName = "C:\\somefolder\\mydll.dll";
I got an exception on
testthis.Start();
saying its not a valid win32 application. I haven't had ANY luck using threads, so I have to do it like this. I was under the impression processes could handle .dlls, am i wrong?
Thanks a lot,
Jim
|
|
|
|
|
[...]
I was under the impression processes could handle .dlls, am i wrong?
Yes.
I suggest you do some basic reading on what is:
- a DLL
- an application
- a process
- a thread
mav
|
|
|
|
|
A DLL is not an EXE - you cannot launch it like an application. If you've ever written a managed application that actually compiles and runs, then you're only loading DLLs. All those types you use from the .NET Base Class Library - they're all defined in other DLLs (known as assemblies in the .NET world) and you load and use the types defined in them. So, if your DLL is managed just add a reference to it for your project (and I know I've been through that with you already) and use one of its types. Make sure the DLL and the EXE are in the same directory or the DLL is resolvable in other ways.
Read How the Runtime Locates Assemblies[^] in the .NET Framework SDK.
And mav.northwind is right - you really should read about the basics of computer software. Since you're in the .NET world, start by reading the Assemblies Overview[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi guys im currently in the process of struggling with my first web application using C# and ASP.NET and im having a little trouble removing a collection(of around 20) of tickets from my database table it keeps crashing and givin me the following error message
[CODE]Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
I have included the problem code and I would really appreciate it if you would take a few mins to look at it thanks in advance
Tadhg88
[CODE]sqlDataAdapter3.Fill(concertDataSet1);
// declare a new DataTable called tickets and fill it with the data in the Ticket table
DataTable tickets = concertDataSet1.Tables["Ticket"];
//***work throught the list of tickets and find the selected one
foreach(DataRow myRow2 in tickets.Rows)
{
//*** check if the selected concert name matches
if(ConcertsListBox.SelectedItem.ToString() == myRow2[0].ToString())
{
//*** check if the selected performance name matches
if(PerformancesListBox.SelectedItem.ToString() == myRow2[1].ToString())
{
//*** delete the selected row
myRow2.Delete();
//*** break out of the foreach loop
//break;
}
}
}[/CODE]
|
|
|
|
|
|
Does anybody know if it is possible to write software that works across multiple monitors? and if so, is it possible to program one so it is private to the user / administrator and the other public. i.e they both show different things. Or even better- the private one shows both screens and the public one shows just what is meant to be seen.
If anybody could point me in the right direction of where to find out this info I would be very grateful
|
|
|
|
|
I think (and I'm not positive on this) that it is indeed very possible.
Just trying to recollect how to go about this (because i did read something about it at one point) I think your going to be dealing a lot with the adapters to the screens.
When you have a video card that supports multiple monitors, it refers to each device seperately *I think*. When you want to talk about one screen then you would ouptut to that screen, and vice versa. That data would not appear on the other screen. So, if you have one screen that you want to be private you just have to output all your graphics to that adapter.
Would this be a business app or something like a full screen app? When I talk about this stuff this was coming from a DirectX background, but I imagine its all very similar now.
I hope my convolution has helped at least a bit!
Jim
|
|
|
|
|
Thanks for your response, I had thought about DirectX after reading something similar. Do you recommend any articles about beginning using DirectX? It is a business application I am writing - a kind of waiting notification like the one Argos have.
Thanks for your help
|
|
|
|
|
I'm not 100% sure if I understand what you want, but there's explicit support in the framework for multiple monitors/screens.
Take a look at the Screen class. You can query the number of displays, for example, or retrieve the available desktop space.
How many displays are reported here should depend on the graphic drivers. They can tell Windows that there are two separate screens or that there's only one screen with twice the resolution.
mav
|
|
|
|
|
Hello,
I have a data grid, and l want to added some records some text boxes into the grid. I have 3 text boxes and the user might want to add the contents 1, 2, 3, or 4 times.
Example:
Enter data in the text boxes, and enter the number of rows you want added. So if the user enters 3 and then click a button, than the data in the text boxes will be entered on 3 different rows. The data will be repeated on 3 rows.
Is there a way to do this using the datagrid?
Many thanks in advance,
Steve
|
|
|
|
|
Don't try to manipulate the grid itself, instead, add the rows to your bound dataset.
- DougW48
|
|
|
|
|
Hi!
I need a good method to remove multiple blanks from a string and replace them with a single blank. For example: "This is a string" -> "This is a string". The method I am using now works fine but is a bit resource demanding (about 80% of the thread).
public static string RemoveMb (string strIn) // Remove multiple blanks
{
string search = @"\s+";
string replace = @" ";
strIn = Regex.Replace(strIn, search, replace);
return strIn;
}
Anyone know of a better method?
Best regards,
Daniel
|
|
|
|
|
public string st(string st)
{
for(string st1="";st!=st1;st1=st,st=st1.Replace(" "," "));
return st;
}
Sorry ...
|
|
|
|
|
Hmm, I took a quick look at and even tested that code. Does it do anything good at all?
Doesn't it just replace all blanks (even the multiple ones) with a "new" blank?
Best regards,
Daniel
|
|
|
|
|
Come on, take a look at the proposal and use your brain.
It's not so hard to find out that the first string in Replace has to consist of two blanks and that they're rendered as one blank because lainoo didn't quote his code in <pre>.
mav
|
|
|
|
|
Well, I guess it wasn't that hard to find out so I'll accept the heat for that one.
But it still doesn't work since the "multiple blanks" in my strings can consist of more than just two blanks.
Best regards,
Daniel
|
|
|
|
|
Did you try the code after correcting it?
It's supposed to replace double spaces with single spaces until the string doesn't change anymore.
Each run should halve the double spaces in your input string until there are only single spaces.
mav
|
|
|
|
|
Ahh! Tested it again now more thoroughly. My deepest apologies to both lainoo and You mav, the code works it just don't apply to tabs (\t) which the regexp "\s" seem to do. I got confused when I saw the big gaps in my string but when looked at closely they are mixed blanks and tabs. The method works way faster than the regular expression I used, now I need to find a way to include tabs.
I guess I'll have to go with a double run to first remove all tabs?
Thanks a lot!
Best regards,
Daniel
|
|
|
|
|
Nice to see you were persistent enough to actually try
I think a simple call to
st = st.Replace("\t"," "); before the loop does the trick.
You don't have to care about double (or more) tabs, since the resulting double (or more) blanks are taken care of in the loop anyway.
mav
|
|
|
|
|
String[] parts = strIn.split(' ');
StringBuilder newString = new StringBuilder();
for(int n=0; n<parts.Length; n++){
if(parts[n].Length > 0){
newString.Append(parts[n]);
newString.Append(" ");
}
}
newString.Remove(newString.Length-1, 1);
return newString.ToString();
_________________________________
Vote '1' if you're too lazy for a discussion
|
|
|
|
|
Can't get that to work since it seems to split directly after the first blank found and leaving the remaining blanks in the string-array items
Best regards,
Daniel
|
|
|
|