xpher
asked on
Browser - View Source
When viewing source in Internet Explorer (or other browsers) is there any way to change the application that the source is viewed in (using code). I'd like to use my own text editor rather than Notepad.
I know how to add my own application for adding to 'Edit with' for IE5, by adding to registry, but I can't seem to find anything for view source.
I know how to add my own application for adding to 'Edit with' for IE5, by adding to registry, but I can't seem to find anything for view source.
listening..
Isn't it funny how things come together sometimes :-)) ? We just discussed this stuff in at least one other question...
Ciao, Mike
Ciao, Mike
Look also on https://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=10239730 discussion.
(It is very expensive though :)
This is extract from my comment from those discussion:
First IE5 query for HKLM\Software\Microsoft\In ternet Explorer\View Source Editor\Editor Name value from registry.
Then it uses this value to query HKLM\Software\Microsoft\Wi ndows\Curr entVersion \AppPaths\ YourEditor Name value
If it found your viewer program then it run it. First parameter is html file.
If it cannot found your viewer program it run default viewer (notepad).
Please note that there is error in IE. When IE pass parameter to your program it does not quoted it with " char. This is error obviously, becouse your program will treat ONLY part of (before first space) file name as html file name.
So you should treat all parameters as one, i.e.
RealFileName := Param(1) + ' ' + Param(2) + ' ' + .. ;// this is just pseudo code
(It is very expensive though :)
This is extract from my comment from those discussion:
First IE5 query for HKLM\Software\Microsoft\In
Then it uses this value to query HKLM\Software\Microsoft\Wi
If it found your viewer program then it run it. First parameter is html file.
If it cannot found your viewer program it run default viewer (notepad).
Please note that there is error in IE. When IE pass parameter to your program it does not quoted it with " char. This is error obviously, becouse your program will treat ONLY part of (before first space) file name as html file name.
So you should treat all parameters as one, i.e.
RealFileName := Param(1) + ' ' + Param(2) + ' ' + .. ;// this is just pseudo code
Yes, the only thing is that the question
lacks about 950 points ;)
lacks about 950 points ;)
:-))
I know xpher does not offer me points.
But... Just in case... I received completely from previous question and I don't want more :)
But... Just in case... I received completely from previous question and I don't want more :)
ASKER
jeurk
I've done that, that is how I got the edit with using file/Edit with but it has no effect when right clicking and viewing source from popup
xpher
I've done that, that is how I got the edit with using file/Edit with but it has no effect when right clicking and viewing source from popup
xpher
You are talking about the registry stuff
I suppose.
It's not working because it has not much to do with that. It's working
with shell hooks for the right click
button. I don't know how to override
the standard one.
that's why I came out with the solution of replacing notepad with your own exe.
it's the easyest solution. And
if you want to replace it. You'll probably
no longer use it ?
I suppose.
It's not working because it has not much to do with that. It's working
with shell hooks for the right click
button. I don't know how to override
the standard one.
that's why I came out with the solution of replacing notepad with your own exe.
it's the easyest solution. And
if you want to replace it. You'll probably
no longer use it ?
ASKER
Well thanks for your time. If you don't mind I'll delete this question cos it was really the right click view source idea I was after, I allready knew the registry bit.
Regards
xpher
Regards
xpher
Strange but I can't find any reference
to a right click stuff problem in your
question. Really strange.
to a right click stuff problem in your
question. Really strange.
ASKER
you right click to view source
I meaned in the initial question.
Do you try my idea?
ASKER
jeurk
Right click to view source is same as viewing source. The registry idea which I knew allready works for if you go File - Edit with whatever is selected to edit with. This registry idea does not provide means of viewing source, try it in IE3.
vladika
Do I actually have to create the key 'View Source Editor', as I have no entry like that in my registry. I tried creating myself but still got nowhere.
cheers
xpher
Right click to view source is same as viewing source. The registry idea which I knew allready works for if you go File - Edit with whatever is selected to edit with. This registry idea does not provide means of viewing source, try it in IE3.
vladika
Do I actually have to create the key 'View Source Editor', as I have no entry like that in my registry. I tried creating myself but still got nowhere.
cheers
xpher
What type of browser do you use? I use IE5.
You can use RegMon utility from www.sysinternals.com to watch all registry-related activity. I used it to monitor IE5 activity.
You should create 'View Source Editor' key under HKLM\Software\Microsoft\In ternet Explorer key. Then you should create 'Editor Name' key under 'View Source Editor' key. Then you should set 'Default' value under 'Editor Name' key equal your program name. For example 'WORDPAD.EXE'.
Then you should create HKLM\Software\Microsoft\Wi ndows\Curr entVersion \AppPaths\ YourEditor Name key and set 'Default' value equal to path to your program. For example on my computer 'Default' value for 'WORDPAD.EXE' key equal to 'C:\Progra~1\Access~1\WORD PAD.EXE'.
After that if you select 'View Source' from menu WordPad will be started. But since there is error in IE5 (description see in previous comment) it will not show html.
In any case try to use RegMon utility to monitor registry-related activity of your browser.
You can use RegMon utility from www.sysinternals.com to watch all registry-related activity. I used it to monitor IE5 activity.
You should create 'View Source Editor' key under HKLM\Software\Microsoft\In
Then you should create HKLM\Software\Microsoft\Wi
After that if you select 'View Source' from menu WordPad will be started. But since there is error in IE5 (description see in previous comment) it will not show html.
In any case try to use RegMon utility to monitor registry-related activity of your browser.
ASKER
Thanks I'll give it another try. I personally use IE5, but I would like idea to work with IE3 and up.
cheers
Chris
cheers
Chris
ASKER
Hi vladika
Tried that again, got it to work. I see what you mean about it loading the application but not the file. Strange thing is that if I view source on a file saved to my hard drive it does actually open my app and show the source, yet when online it doesn't. Weird.
The comments you made about parameters is that something that should be added in my programme or something that should be added with registry changes?
Or is that explained in more detail in the other question you mentioned?
Thanks
xpher
Tried that again, got it to work. I see what you mean about it loading the application but not the file. Strange thing is that if I view source on a file saved to my hard drive it does actually open my app and show the source, yet when online it doesn't. Weird.
The comments you made about parameters is that something that should be added in my programme or something that should be added with registry changes?
Or is that explained in more detail in the other question you mentioned?
Thanks
xpher
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for delay in replying but not been able to surf etc.
cheers
xpher
cheers
xpher
You can find the right occurence in the registry at
HKEY_CLASSES_ROOT\.htm\Ope
the key there is C:\WINNT\Notepad.exe %1
change it.
or replace notepad with you own exe like
taht :
This is the source of a program
I created to load ultraedit instead of
notepad, it is working perfectly.
If you want handle more things like
printing you have to know that notepad
can be called with params like /p
for printing a file.
under NT notepad stays in \winnt\
and \winnt\system32\
so remember to change the two occurence.
CU
this is only a project. No form.
--------------------------
PROGRAM Notepad;
USES
windows, shellapi, registry;
VAR
ini: tregistry;
nimpo: STRING;
tutu : STRING;
c:integer;
{$R *.RES}
BEGIN
ini := tregistry.Create;
ini.RootKey := HKEY_CLASSES_ROOT;
ini.OpenKey('', FALSE);
ini.OpenKey('UltraEdit-32 Document\shell\open\comman
nimpo := ini.readString('');
nimpo:=copy(nimpo, 2, length(nimpo)-7);
for c:= 1 to ParamCount do
begin
tutu:=tutu+' '+pchar(paramstr(c))
end;
// MessageDlg(tutu,mtError,[m
shellExecute(0, pchar('open'), PChar(nimpo), Pchar(tutu), NIL, SW_SHOWNORMAL);
ini.Free;
END.