RE: Automate Microsoft Office from Delphi
Jerry, The last part of Francois's pasted URL was cut off by the line wrap. Try this one: http://francois-piette.blogspot.be/2013/01/automat e-microsoft-office-from-delphi.html -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com 9 4 9 \ 5 2 5 - 5 7 1 2 -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Jerry Clancy Sent: Thursday, January 24, 2013 7:52 AM To: Moderated List for the Discussion of Delphi Programming excludingDatabase-related topics Subject: RE: Automate Microsoft Office from Delphi François, Your blog page says this is not found. Jerry -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of François Piette Sent: Wednesday, January 23, 2013 11:49 AM To: Moderated List for the Discussion of Delphi Programming excluding Database-related topics Subject: Automate Microsoft Office from Delphi Microsoft Office (Word, Excel and others) are applications which can be fully automated from another application. Everything you can do by hand can also be done programmatically from another application and of course from your Delphi application. To ease the automation, Delphi is delivered with non-visual components which are wrapper around the underlying COM objects and exposes the same properties, methods and events as the COM interface. Read the full article at: http://francois-piette.blogspot.be/2013/01/automat e-microsoft-office-from-de lphi.html -- François Piette ___ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/d elphi ___ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/d elphi ___ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: How to generate PDFs with tables...
Thanks Bart, I figured out how to generate an HTML document from the rich edit cells, and put a font .. ... /font around it to make the highlighting work. It takes up a lot of space, probably more than the PDF will take, but I am also able to open it with Word, and then save it as a *.doc file. That takes care of the basic issues, so I can drop the PDF since it seems much harder to work with. I appreciate the suggestions, -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com 9 4 9 \ 5 2 5 - 5 7 1 2 -Original Message- From: delphi-talk-boun...@elists.org [mailto:delphi-talk-boun...@elists.org] On Behalf Of Barton Bresnik Sent: Saturday, February 26, 2011 5:48 PM To: delphi-talk@elists.org Subject: Re: How to generate PDFs with tables... Rich, You might try a two-step process: 1. Copy tables and other text to a MS Word COM object. Word has many VBA methods to help do so. Perhaps Open Office or Libre Office offer similar options. 2. Print the Word document as PDF using a tool such as PDF Creator (but beware malware browser add-ins in the installation dialogs). Bart --- On Fri, 2/25/11, Rich Cooper wrote: Hi Delphians, Using D7, I once found a tutorial on the web re using Adobe PDF component TAdobePDF to generate a document. Now, with all the ads on Google, I can only find the ads, not the good stuff like that old tutorial I once found. I iterate through a table, with each cell presently represented in TRichEdits. There are several fonts used, including various colors of text, in the table I want to create as a PDF. Does anyone have a good link for tutorials on how to generate a PDF document with the text from a TRichEdit, and to create tables, like in Word, to hold the cells, each containing a TRichEdit text blob? TIA, -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com 9 4 9 \ 5 2 5 - 5 7 1 2 __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
RE: TWebBrowser doing Ctrl-A or Select All to get text
After some googling and goggling, I got: {initialization} OleInitialize(nil); Application.ProcessMessages; wbDocument.ExecWB(OLECMDID_SELECTALL, OLECMDEXECOPT_PROMPTUSER); Application.ProcessMessages; wbDocument.ExecWB(OLECMDID_COPY, OLECMDEXECOPT_PROMPTUSER); {finalization} Application.ProcessMessages; OleUninitialize; Application.ProcessMessages; reText.PasteFromClipboard; But unfortunately, right after the OLECMDID_SELECTALL, I get a message about ... not registered as drop target which thoroughly confuses me. The TWebBrowser property RegisterAsDropTarget is set at the default True and never changes. Also, the RegisterAsBrowser is set False by default, and my program never changes it. Can I do the OleInitialize .. OleUnInitialize in pairs like that? Can anyone shed some insight into this situation? I just want to do a SelectAll and then a CopyToClipBoard in sequence for a TWebBrowser. That's it. Then I will do a PasteFromClipBoard in a TRichEdit in its Text property and all will be well. At least, it works when I do it myself with key sequences. Thanks, -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Rich Cooper Sent: Wednesday, February 03, 2010 11:46 AM To: 'Moderated List for the Discussion of Delphi ProgrammingexcludingDatabase-related topics' Subject: TWebBrowser doing Ctrl-A or Select All to get text Hi Everybody, Using D7, TWebBrowser, as the program runs, I can hit the key chord Ctrl-A, Ctrl-A to select and then copy the text and other stuff displayed inside a TWebBrowser. Then I select the target and hit a Ctrl-V to paste it into a TMemo or a TRichEdit. But I want the PROGRAM to do that! How can I get my running TWebBrowser based program to copy the displayed text as though I had done Ctrl-A, Ctrl-C, then select and Ctrl-V? I tried the obvious approach of reading the TWebBrowser docs, the Indy docs, and so on. When the extension of the URL is a text-type file (htm, html, txt, rtf, ...) the following works: reText.Text := HTTP.Get(URLpart); But when the extension is non-text (pdf, none, ...) the program goes into a never ending loop looking for text among the binary ruins. So I need a way to do the [ Select-All | Copy | select target | Paste ] sequence programmatically when the extension is non textual. The last part, I can do. It's the first part that I haven't figured out: Does anyone have a suggestion on how to [ Select-All | Copy ] in a TWebBrowser, or TIdHTTP or some such component? D7, Vista XP targets. Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com ___ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
TWebBrowser doing Ctrl-A or Select All to get text
Hi Everybody, Using D7, TWebBrowser, as the program runs, I can hit the key chord Ctrl-A, Ctrl-A to select and then copy the text and other stuff displayed inside a TWebBrowser. Then I select the target and hit a Ctrl-V to paste it into a TMemo or a TRichEdit. But I want the PROGRAM to do that! How can I get my running TWebBrowser based program to copy the displayed text as though I had done Ctrl-A, Ctrl-C, then select and Ctrl-V? I tried the obvious approach of reading the TWebBrowser docs, the Indy docs, and so on. When the extension of the URL is a text-type file (htm, html, txt, rtf, ...) the following works: reText.Text := HTTP.Get(URLpart); But when the extension is non-text (pdf, none, ...) the program goes into a never ending loop looking for text among the binary ruins. So I need a way to do the [ Select-All | Copy | select target | Paste ] sequence programmatically when the extension is non textual. The last part, I can do. It's the first part that I haven't figured out: Does anyone have a suggestion on how to [ Select-All | Copy ] in a TWebBrowser, or TIdHTTP or some such component? D7, Vista XP targets. Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com ___ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
Loading text versions of files
There are text versions of files like PDFs, HTMLs, DOCs, and other kinds of files. That text is used in search engines. I would like to use a D7 TMemo or rich text that can be loaded with the text version of any file on a WinNT/VISTA system (PPT, DOC, RTF, whatever common formats are available). Does anyone have a suggestion on how to get started with an existing TMemo instance in D7 on Vista? Component suggestions especially appreciated, -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-talk-boun...@elists.org [mailto:delphi-talk-boun...@elists.org] On Behalf Of Wilfried Mestdagh Sent: Thursday, August 20, 2009 1:58 AM To: Delphi-Talk Discussion List Subject: Re[2]: WM_ACTIVATE Hello Andre, I used GetForeGroundWindow() to do this. Seems I have different results. I create following message handler wich is called on activate and also on deactivate: procedure TForm1.WMActivate(var Msg: TMessage); var PrevWnd, NextWnd, ForegroundWnd: THandle; Title: array[0..255] of char; begin ForegroundWnd := GetForeGroundWindow; GetWindowText(ForegroundWnd, Title, SizeOf(Title)); WriteLn('GetForeGroundWindow ', Title); NextWnd := GetNextWindow(ForegroundWnd, GW_HWNDNEXT); GetWindowText(NextWnd, Title, SizeOf(Title)); WriteLn('GetNextWindow ', Title); PrevWnd := GetNextWindow(ForegroundWnd, GW_HWNDPREV); GetWindowText(PrevWnd, Title, SizeOf(Title)); WriteLn('GetPrevWindow ', Title); end; When I click from Form1 to an explorer 'Tapi' I get: GetForeGroundWindow Tapi GetNextWindow M GetPrevWindow Seems ok, but then I click again on Form1: GetForeGroundWindow Form1 GetNextWindow Project2 GetPrevWindow Default IME I think 'Project2' is the button on the taskbar. What 'Default IME' is that I don't know. Clicking on the console window gives me this: GetForeGroundWindow C:\Program Files\Borland\Delphi7\Projects\Project2.exe GetNextWindow M GetPrevWindow So until now I cannot find the real previous window. If I set the form to fsStayOnTop the result is here and there different, but I never get to the previous window :( Same if I remove button on taskbar. --- Rgds, Wilfried http://www.mestdagh.biz __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
RE: Loading text versions of files
Yet with every file type, if I run the program, I can select text and Ctl/C a copy of the text, then paste it into my TMemo. There has to be a better way to move it, at least. The TMemo has a windows level paste that does that part of the job. But that is the part I want to automate as much as possible. Any ideas on components? I read an article about the IFilter spec which makes text available to Windows search engines through DLLs that meet IFilter interface specs. It would be lovely to get a D7 component that applies the IFilter spec to an arbitrary file to see what text comes bubbling up to the clipboard. Or does anyone have another approach to getting content text (not markup text, but content) and only content text, from an arbitrary file type? Thanks, -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-talk-boun...@elists.org [mailto:delphi-talk-boun...@elists.org] On Behalf Of Rory Daulton Sent: Thursday, August 20, 2009 11:59 AM To: Delphi-Talk Discussion List Subject: Re: Loading text versions of files Rich, There are text versions of files like PDFs, HTMLs, DOCs, and other kinds of files. That text is used in search engines. I would like to use a D7 TMemo or rich text that can be loaded with the text version of any file on a WinNT/VISTA system (PPT, DOC, RTF, whatever common formats are available). HTML and RTF actually already are text documents, with special tags in delimiters. The other formats are special ones. I believe that search engines and the like have special routines in themselves that convert the PDF or whatever to text, then the engine stores the text version for searching and sorting. (Often the text is split up so the full text version no longer exists.) IOW, there is to text version open to the public, there are multiples ones, one in each search engine and not available to others as such. You would need to write or buy routines that convert files from a few given formats to text. I doubt that this would be easy or cheap, and I also doubt that you could get conversions for most file types. Rory Daulton rorydaul...@email.com __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
RE: Loading text versions of files
Rory, Thanks, that beautifully summarizes my own conclusions, though coming from assorted other directions. It ought not to be so hard. There's gotta be a betta way as Donnie Deutsch likes to say. And so maybe there is something out there that hasn't had its day in the sun. Does anybody know of such a new star? -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-talk-boun...@elists.org [mailto:delphi-talk-boun...@elists.org] On Behalf Of Rory Daulton Sent: Thursday, August 20, 2009 2:48 PM To: Delphi-Talk Discussion List Subject: Re: Loading text versions of files Rich, Yet with every file type, if I run the program, I can select text and Ctl/C a copy of the text, then paste it into my TMemo. There has to be a better way to move it, at least. The TMemo has a windows level paste that does that part of the job. But that is the part I want to automate as much as possible. When, for example, you run Adobe Acrobat Reader, select some text, and press Ctrl+C, a copy message is sent to Acrobat Reader. Reader converts that section of text to text format, then places it into the Windows Clipboard (perhaps with other formats). When you paste it into TMemo, the TMemo takes the data that is already in text format and copies it in. IOW, the proprietary program takes the data in its proprietary format, does its conversion, and *then* gives it out to the world. You could easily automate the pasting, but the copying to the clipboard is another matter. If you can't do a direction conversion from the proprietary format to text, you could simulate a select then a press of Ctrll+C; components exist to emulate keystrokes. IFilter sounds like a good idea; I also thought of that. But I have not seen the specification, and my own recent attempt to find IFilters for my old data files does not give much hope for dealing with many formats. Rory Daulton rorydaul...@email.com __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
RE: Playing video on a web site page
Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com Rob Kennedy wrote: RC How do I upgrade that web site to serve video files from the web site itself instead of from Youtube? When your server gets a request with a URL referring to a video resource or a Flash resource, serve that instead of the HTML resources you're already serving. I do that in the Indy server example code. I started with the Indy HTTP server and added code to check requested files (any extension) against the files in a folder on my PC. That folder can be as deep as needed, but it has to contain the named file and path to serve up. You could serve those resource from files, or they could be embedded in your application binaries, or you could even generate them on the fly. The user agent never needs to know; it doesn't care. My plan is to put them in files in the server directory with links to those files embedded into the HTML pages, also in the same directory tree. But how do I embed the link to send my own files instead of the Youtube files? It's the link text (changes to the example snippet of code) which seem to specify other parameter values. I have no idea what the parameters do. Do the browsers use those parameters? All I need is a URL from the clients to request my file by name and path - any extension. Somehow that URL has to be conjured up in the client program and sent back to my server as a file request. But the client has to know that it's a flash, movie, or whatever kind of file. Also, I want to let people download other files from the site, but I don't understand how to set up an FTP server along with the Indy HTTP server. Do you want to write the FTP server yourself, or would you be content to use one of the billions of FTP servers already available? (I might have exaggerated.) FTP listens on a different port from HTTP, so the servers don't have to be combined into one if you don't want. If you want to use Indy to make your own FTP server, then I think you start by creating an FTP server object and handling the events it provides. It will be similar to implementing an HTTP server, but it might provide a few more shortcuts for tying the FTP interface to the local computer's files. Do I really have to put up an FTP server to be able to send flash, movies, and so on to clients? Don't the client browsers know how to handle those extensions? -- Rob ___ -Rich ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
Playing video on a web site page
Hi All Delphians that may be left, I found out by experimentation that I can embed video clips into HTML pages on my Indy HTTP web server - haven't done that before. This is the video clip HTML I pasted into my web page: object width=425 height=344param name=movie value=http://www.youtube.com/v/X5tOjiP9A3Qcolor1=0xb1b1b1color2=0xcfcfcf; feature=player_embeddedfs=1/paramparam name=allowFullScreen value=true/paramparam name=allowScriptAccess value=always/paramembed src=http://www.youtube.com/v/X5tOjiP9A3Qcolor1=0xb1b1b1color2=0xcfcfcffe ature=player_embeddedfs=1 type=application/x-shockwave-flash allowfullscreen=true allowScriptAccess=always width=425 height=344/embed/object In this case the src is a Youtube web URL. I would like to paste OTHER video clips into my web site from time to time, but I don't want to have to put them on Youtube. Using D7, Indy, Vista for the web server. How do I upgrade that web site to serve video files from the web site itself instead of from Youtube? Also, I want to let people download other files from the site, but I don't understand how to set up an FTP server along with the Indy HTTP server. Suggestions appreciated. -Rich ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: Add *.exe programs into a main program
Thanks Rob, I'll take a look at that link and see if it does the job for me. -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Rob Cameron Sent: Thursday, June 11, 2009 7:06 AM To: delphi@elists.org Subject: Re: Add *.exe programs into a main program I'm not 100% clear about what exactly you want to do, but perhaps the Exemod library from Gwen Carpenter might be helpful: http://www.torry.net/authorsmore.php?id=3984 It allows you to insert files within files, etc. So you might be able to add the exe into your own app, then at run-time extract it, save it, run it, delete it. Maybe. Warnings though: (1) Exemod is no longer supported; (2) It *will* fail when used with D2009 because it uses non-unicode strings; (3) there can be problems running apps from a CD - I had this problem when I wrote a small installer using Exemod (however this is described in the Exemod source - it's a known problem). Apart from that I have found it very useful indeed. Rob I've found an *.exe file that runs (D7 / Vista) in DOS mode like a batch file command. When running, it gives a prompt and stops. 1. I could execute it as a batch job and pipe the input and output, if I can figure out how to do that in old DOS command language. 2. But that would mean loading the *.exe for each call, executing it, managing the interface pipes and process contexts; Isn't there a way I can put it into my D7 source program as a resource of some kind, or load it once and link it up that way somehow? If it would only load once, when the program starts. Each time the *.exe runs, it could make a copy of itself to run and destroy the answer when completed. Suggestions appreciated, -Rich ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
Add *.exe program into a main program
Hi All, I've found an *.exe file that runs (D7 / Vista) in DOS mode like a batch file command. When running, it gives a prompt and stops. 1. I could execute it as a batch job and pipe the input and output, if I can figure out how to do that in old DOS command language. 2. But that would mean loading the *.exe for each call, executing it, managing the interface pipes and process contexts; Isn't there a way I can put it into my D7 source program as a resource of some kind, or load it once and link it up that way somehow? If it would only load once, when the program starts. Each time the *.exe runs, it could make a copy of itself to run and destroy the answer when completed. Suggestions appreciated, -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: Which SSL? and WHERE from?
Is there a web access to that newsgroup - a URL? TIA, Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Doug Chamberlin Sent: Wednesday, May 27, 2009 4:44 PM To: Borland's Delphi Discussion List Subject: Re: Which SSL? and WHERE from? Rainer von Saleski wrote: Help! More than an hour of googling and searching and reading, and I still can't find a coherent version of SSL for Delphi 7 (with Indy). CodeGear's newsgroup embarcadero.public.delphi.internet.winsock is the right place to ask for help with Indy. I know the packaging is currently poor and the instructions are out-of-date but you should be able to get the help you need there. ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: Which SSL? and WHERE from?
Thanks all Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Cord Schneider Sent: Thursday, May 28, 2009 5:51 AM To: delphi@elists.org Subject: RE: Which SSL? and WHERE from? Rich Cooper wrote: Is there a web access to that newsgroup - a URL? Try https://forums.codegear.com/category.jspa?categoryID=12 Regards, Cord Schneider StaffPlan http://www/ ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: [TWebBrowser] Calling a JavaScript function
Francois, Thanks, that solved many of the missing definitions, but there is still one I haven't been able to track down. The line: HTMLWin.execScript(JavaScriptExpression, 'JavaScript'); Causes an error because JavaScriptExpression is still not defined. Something must be missing; do you have a definition for JavaScriptExpression? Thanks, Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Francois Piette Sent: Wednesday, February 18, 2009 12:41 AM To: Borland's Delphi Discussion List Subject: Re: [TWebBrowser] Calling a JavaScript function What unit has to be in the uses clause to define the two vars: Doc : IHTMLDocument2; // Current HTML document HTMLWin : IHTMLWindow2; // Parent window of current HTML document You need MSHTML, SHDocVw and ActiveX. -- francois.pie...@overbyte.be Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Francois Piette Sent: Monday, February 16, 2009 7:25 AM To: Borland's Delphi Discussion List Subject: Re: [TWebBrowser] Calling a JavaScript function I have the following problem: Having a web page loaded into a TWebBrowser hosted in my Delphi application, I want to have Delphi code execute a JavaScript function embedded in the HTML page. How can I do that ? Answering my own question: procedure WB_ExecScript(WebBrowser: TWebBrowser; JavaScriptExpression : String); var Doc : IHTMLDocument2; // Current HTML document HTMLWin : IHTMLWindow2; // Parent window of current HTML document begin Doc := WebBrowser.Document as IHTMLDocument2; if Assigned(Doc) then begin HTMLWin := Doc.parentWindow; if Assigned(HTMLWin) then begin try HTMLWin.execScript(JavaScriptExpression, 'JavaScript'); except on E:Exception do begin ShowMessage('Erreur d''exécution JavaScript de ' + JavaScriptExpression + ''); end; end; end; end; end; -- francois.pie...@overbyte.be Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: [TWebBrowser] Calling a JavaScript function
Found it! Var JavaScriptExpression : string; Does the job and now it runs properly! -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Francois Piette Sent: Wednesday, February 18, 2009 12:41 AM To: Borland's Delphi Discussion List Subject: Re: [TWebBrowser] Calling a JavaScript function What unit has to be in the uses clause to define the two vars: Doc : IHTMLDocument2; // Current HTML document HTMLWin : IHTMLWindow2; // Parent window of current HTML document You need MSHTML, SHDocVw and ActiveX. -- francois.pie...@overbyte.be Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Francois Piette Sent: Monday, February 16, 2009 7:25 AM To: Borland's Delphi Discussion List Subject: Re: [TWebBrowser] Calling a JavaScript function I have the following problem: Having a web page loaded into a TWebBrowser hosted in my Delphi application, I want to have Delphi code execute a JavaScript function embedded in the HTML page. How can I do that ? Answering my own question: procedure WB_ExecScript(WebBrowser: TWebBrowser; JavaScriptExpression : String); var Doc : IHTMLDocument2; // Current HTML document HTMLWin : IHTMLWindow2; // Parent window of current HTML document begin Doc := WebBrowser.Document as IHTMLDocument2; if Assigned(Doc) then begin HTMLWin := Doc.parentWindow; if Assigned(HTMLWin) then begin try HTMLWin.execScript(JavaScriptExpression, 'JavaScript'); except on E:Exception do begin ShowMessage('Erreur d''exécution JavaScript de ' + JavaScriptExpression + ''); end; end; end; end; end; -- francois.pie...@overbyte.be Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: [TWebBrowser] Calling a JavaScript function
Francois, What unit has to be in the uses clause to define the two vars: Doc : IHTMLDocument2; // Current HTML document HTMLWin : IHTMLWindow2; // Parent window of current HTML document Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com -Original Message- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Francois Piette Sent: Monday, February 16, 2009 7:25 AM To: Borland's Delphi Discussion List Subject: Re: [TWebBrowser] Calling a JavaScript function I have the following problem: Having a web page loaded into a TWebBrowser hosted in my Delphi application, I want to have Delphi code execute a JavaScript function embedded in the HTML page. How can I do that ? Answering my own question: procedure WB_ExecScript(WebBrowser: TWebBrowser; JavaScriptExpression : String); var Doc : IHTMLDocument2; // Current HTML document HTMLWin : IHTMLWindow2; // Parent window of current HTML document begin Doc := WebBrowser.Document as IHTMLDocument2; if Assigned(Doc) then begin HTMLWin := Doc.parentWindow; if Assigned(HTMLWin) then begin try HTMLWin.execScript(JavaScriptExpression, 'JavaScript'); except on E:Exception do begin ShowMessage('Erreur d''exécution JavaScript de ' + JavaScriptExpression + ''); end; end; end; end; end; -- francois.pie...@overbyte.be Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
Cursors in Vista
Hi Delphians, Using D7 with Vista, I can't get the expected cursor operation. Here is my code: begin OldCursor := Screen.Cursor; Cursor := crHourGlass; Application.ProcessMessages; Try long time process going on finally Screen.Cursor := OldCursor; end; end; The cursor doesn't change from the old pointer to the crHourGlass during the long time process going on. I tried crCross insteads of crHourGlass, but nothing seems to work! Does anyone know why this isn't showing the hourglass cursor, and possibly what I should change to make it work? Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
RE: Cursors in Vista
Yes, using 'Screen.Cursor := OldCursor' did the job. I guess the shorter form must have been pointing to the control's cursor instead. Thanks! Sincerely, Rich Cooper -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David J Taylor Sent: Friday, October 31, 2008 1:46 AM To: Delphi-Talk Discussion List Subject: Re: Cursors in Vista Rich Cooper wrote: Hi Delphians, Using D7 with Vista, I can't get the expected cursor operation. Here is my code: OldCursor := Screen.Cursor; Cursor := crHourGlass; Application.ProcessMessages; [] Sincerely, Rich Cooper Rich, I suspect that: Cursor := crHourGlass; should be: Screen.Cursor := crHourGlass; and I would suggest removing the: Application.ProcessMessages; Cheers, David -- SatSignal software - quality software written to your requirements Web: http://www.satsignal.eu Email: [EMAIL PROTECTED] __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
RE: Delphi 7 component built on TextExtractor.dll
Rob Kennedy replied Rich Cooper wrote: It's a DLL that pulls text out of many different formats - doc, pdf, html, and so on. If you google it, you'll get a number of hits about it. I get 13 hits. All of them merely show that it doesn't contain a virus. I get no newsgroup hits about it. Do you have any headers or documentation about this DLL? Where did you get the DLL? Does the vendor provide any information about it? If not, then it's probably not a DLL you're allowed to use in your own programs anyway. -- Rob According to Wakoopa, it was developed by an unknown developer: http://wakoopa.com/software/textextractor Googling the phrase TextExtractor gives 3,660 hits just now. Googling TextExtractor.dll gives just 12 hits. Googling TextExtractor Delphi gets 19 hits. But none of the hits I looked at describe how to load it into a Delphi component. Since there is no copyright notice on it (at least not on the hits I viewed), it should be legal to use it. Do you know how to find out what the DLL object interface looks like? I would really like to get a Delphi component around it. It should have serious value for a lot of us. -Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
Delphi 7 component built on TextExtractor.dll
Does anyone have a Delphi component, or other way to use TextExtractor.dll? Example software would be very nice to have. I'm using D7 on XP and Vista systems. Tutorials on how to use TextExtractor would be very welcome also. -Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
Text extraction from many formats
Hi Delphians, I'm using D7 and Vista/XP here. I'm looking for some component that can extract text from a whole variety of formats, such as Word, PDFs, HTML, XML, and so on. I only want the text, not the visuals or other nontextual materials, and I don't care about the structure of the text (paragraphs, etc) so long as I have it in a usable format. I know that Windows has an iFilter interface, but I'm not sure if that is a good way to get the text, because it requires the user of my software to download DLLs for each kind of format. Companies like Google, Yahoo, etc have access to text in many, many formats for their search engines, and I suspect there is some software available that does that extraction since its such a widely applicable need. Component, suggestions, or shared experiences are welcome. -Rich ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: Splitters and PageControls
Hi Robert, Yes, we're both talking about the TSplitter component on the Additional component palette. All my three splitters modify the size of the PageControl on the immediate right of that splitter. All the splitters are set to alRight, and the fourth PageControl, which has no splitter, is set to alClient. That means I can resize the form, and the fourth PageControl takes up the slack. I have nearly given up making the three rightmost PageControls switch between visible and not visible - I haven't been able to figure out what happens to the PageControl and its associated Splitter when I make it invisible, so I haven't figured out how to reposition the three Splitters and three PageControls when changing visibility settings. I guess I could root through the watch window and set up cases to figure out how the various positions change when one or more is made invisible, but I haven't gotten there yet. But I have figured out how to keep the PageControls from disappearing when I adjust their width to too small a value. Here is an event I use to keep the Details PageControl from getting narrower than 30 pixels: procedure TfmConversation.spDetailsCanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean); begin {Be sure the Details component can be seen} if NewSize=30 then Accept := False else Accept := True; end; Sincerely, Rich Cooper EnglishLogicKernel.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Meek Sent: Sunday, May 11, 2008 8:21 AM To: 'Delphi-Talk Discussion List' Subject: RE: Splitters and PageControls Rich, Perhaps we're not in synch on what a Splitter is. When I refer to a Splitter I mean a visual control that looks like a Panel having a moveable bar splitting the panel into two Panes. The bar can be set to split the Panes vertically or horizontally. To set things up as you describe, I would first add a splitter to my Form set to alClient and its bar set to Vertical. Then I would add a second Splitter to the first Splitter's Left Pane set to alClient, and a third Splitter to the first Splitter's Right Pane set to alClient. You now have 4 separate resizable Panes that you can use the way you likee. From your description below, I would put the [pcConversations-PageControl] on the Second Splitter's Left Pane set to alClient, the [pcDetails-PageControl] in the Second Splitter's Right Pane set to alClient, the [pcObjects-Pagecontrol] in the Third Splitter's Left Pane set to alClient, and the [pcActions-PageControl] in the Third Splitter's Right Pane set to alClient. Next you would have to decide how you want the form and Splitters to react when one or more of the PageControls is made invisible. For example, if you make the [pcActions-PageControl] to disappear, you could do it two ways since it's in the right Pane of Splitter 3. You could reposition it's bar to it's max to cover the PageControl up, which would make the [pcObjects-Pagecontrol] twice as wide as it was. Or you could also re-position the bar of Splitter 1 and/or 2 at the same time to even out the widths of the remaining three PageControls. Or you could instead set the bar for Splitter 3 to its max position but instead of resizing the other Splitter's just readjust the Form's width! Doing this allows you many options as to what is visible or not and how visibility effects pane and/or Form size. All you need to do is create events to do exactly what you want, then save the Splitter.position for each Splitter and the Form's width to an inifile and read and set them again when the user calls one of the events. Anyway, all this depends on if we're even talking about the same type of control! g from Robert Meek dba Tangentals Design e-mail: [EMAIL PROTECTED] Freelance Windows Programming for XP and Vista Also proud to be a Moderator of the Delphi-List at elists.org Reality cannot be explained...only enjoyed or endured as your current perspective allows! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich Cooper Sent: Saturday, May 10, 2008 11:55 AM To: 'Delphi-Talk Discussion List' Subject: RE: Splitters and PageControls Hi Robert, All the Splitters are set align=alRight, and each splitter is immediately to the left of its related PageControl. I'm using D7 with Vista, and the Splitters don't have a property named UsePercent. That must be a new property later than D7. The best pictorial description is this one: [pcConversations]spDetails[pcDetails]spObjects[pcObjects]spActions[pcActions ] As it shows, there are four PCs and three Splitters. Sincerely, Rich Cooper EnglishLogicKernel.com [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Meek Sent: Saturday, May 10, 2008 12:06 AM To: 'Delphi-Talk Discussion List' Subject: RE: Splitters and PageControls
RE: Splitters and PageControls
Hi Robert, All the Splitters are set align=alRight, and each splitter is immediately to the left of its related PageControl. I'm using D7 with Vista, and the Splitters don't have a property named UsePercent. That must be a new property later than D7. The best pictorial description is this one: [pcConversations]spDetails[pcDetails]spObjects[pcObjects]spActions[pcActions ] As it shows, there are four PCs and three Splitters. Sincerely, Rich Cooper EnglishLogicKernel.com [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Meek Sent: Saturday, May 10, 2008 12:06 AM To: 'Delphi-Talk Discussion List' Subject: RE: Splitters and PageControls Rich, If each Pagecontrol is set to alRight how, where, and when are their left sides being anchored? And you also didn't say how the splitters themselves are setup. For example, do you have one splitter set to alClient and parented by the form, and then a second Splitter set to alClient in one side's pane of the first Splitter? And also do you have the Splitters set to UsePercent = True or False? If you like I'd be happy to throw an example of how I'd do it for you and send it along, but I would need to know the answers to the above, and also if the three PageConrols are the only components ever seen on this form except for the two Splitter bars even when one or more is invisible. from Robert Meek dba Tangentals Design e-mail: [EMAIL PROTECTED] Freelance Windows Programming for XP and Vista Also proud to be a Moderator of the Delphi-List at elists.org Reality cannot be explained...only enjoyed or endured as your current perspective allows! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich Cooper Sent: Friday, May 09, 2008 12:31 PM To: 'Delphi-Talk Discussion List' Subject: RE: Splitters and PageControls Not quite like that. Every TPageControl except the left most (pcConversations) has its align property set to alRight, and each of them has an associated splitter width=3, positioned just to left of the TPageControl. That's how the program starts running. Visually, the panels are as shown below: [pcConversations]spDetails[pcDetails]spObjects[pcObjects]spActions[pcActions ] Where the Hungarian prefix sp is for splitter, and pc is for PageControl. While the program is running, I want to let my user make any of the TPageControls visible or not visible in any combination. But when I turn off one page control's visible property, it gets positioned somewhere away from its original position. Then when I turn it visible again, its associated splitter has moved, and no longer fulfills the function of adjusting the TPageControl's width, since it is no longer just to the left of the TPageControl. Here is some code that turns ALL TPageControls off and on at the same time, in right to left order: procedure TurnOffAllPageControls; {in left to right order} begin fmConversation.pcConversations.Align := alNone; fmConversation.spDetails.Align := alNone; fmConversation.pcDetails.Align := alNone; fmConversation.spDetails.Visible := False; fmConversation.pcDetails.Visible := False; fmConversation.spObjects.Align := alNone; fmConversation.pcObjects.Align := alNone; fmConversation.spObjects.Visible := False; fmConversation.pcObjects.Visible := False; fmConversation.spActions.Align := alNone; fmConversation.pcActions.Align := alNone; fmConversation.spActions.Visible := False; fmConversation.pcActions.Visible := False; end; procedure TurnOnAllPageControls; {in right to left order} begin fmConversation.pcActions.Left:= fmConversation.Width-16; fmConversation.pcActions.Align := alRight; fmConversation.pcActions.Visible := True; fmConversation.spActions.Align := alRight; fmConversation.spActions.Visible := True; fmConversation.pcObjects.Align := alRight; fmConversation.pcObjects.Visible := True; fmConversation.spObjects.Align := alRight; fmConversation.spObjects.Visible := True; fmConversation.pcDetails.Align := alRight; fmConversation.pcDetails.Visible := True; fmConversation.spDetails.Align := alRight; fmConversation.spDetails.Visible := True; fmConversation.pcConversations.Align := alClient; end; As long as I turn them all off in right to left order, then all on in right to left order, everything stays ok. But when I turn just one pc off, it gets moved because the other pcs to the left of it get adjusted due to the alRight setting of all the pc and sp components. What I need is a design concept that lets me adjust the position of each page control and its associated splitter. I'm still working on defining that concept. -Rich -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Meek Sent
RE: Splitters and PageControls
it's width based upon any particular PageControl being visible or not, as that is confusing to the user's eyes. Instead, I would want the pcConversations PageControl to increase in width via increasing the secondary Splitter's left-most Pane being increased in width as required when ever one or both of the other two PageControls are made invisible. So the way I would handle this is to reset the second Splitter's Percentage to 100% or to its max position so as it make its left-most pane and the pcConversations PageControl as wide as possible whenever the pcObjects PageControl must disappear which can be accomplished simply by altering its Splitter's position or percentage as just stated. I would do exactly the same thing to the Position or Percentage of the original Splitter when ever the pcActions pane needs to disappear as well. This makes each one independent of the other so that they can be made to disappear and/or re-appear in whatever order and/or sequence the user wants, and to cause the pcConversations PageControl to react by getting wider or thinner as needed to fill in the addition empty space or allow for the additionally needed space depending upon how the other two PageControls are altered and without having to worry about the possibility that the Form itself may have had its own width changed between any of the events! Note: As I've used this same technique myself, depending upon the Splitter type and brand you are employing, and also on how you have it's borders and/or frames setup visually, you may need to play around with these settings as you click on these events so as to make things appear as clean as possible. What I have had to do in the past was actually make the Splitter bar width 0 when set to its max position and then to its default width again when resized to make both its panes visible again otherwise they often look clumsy all at one side! HTH's from Robert Meek dba Tangentals Design e-mail: [EMAIL PROTECTED] Freelance Windows Programming for XP and Vista Also proud to be a Moderator of the Delphi-List at elists.org Reality cannot be explained...only enjoyed or endured as your current perspective allows! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich Cooper Sent: Thursday, May 08, 2008 3:53 PM To: 'Delphi-Talk Discussion List' Subject: Splitters and PageControls Hi All, I have a form with three PageControls on it. The one on the left (pcConversations) is always visible. There is a menu which lets the user check or uncheck whether the other two PageControls are visible. Those two PageControls are called pcActions and pcObjects. pcActions is on the right side of the form, align=alRight, and there is a splitter (spActions) with align=alRight flush on the left side of pcActions. The same structure is used for pcObjects (just to the left of spActions and pcActions) and spObjects (just to the left of pcObjects). Now I want to write the handlers for the 'checked' property of the two menu items View | Objects and View | Actions. Here is the first attempt at writing these handlers: procedure TfmConversation.Objects1Click(Sender: TObject); begin Objects1.Checked := not Objects1.Checked; spObjects.Left:= pcObjects.Left-7; spActions.Left:= pcActions.Left-7; pcObjects.Visible := Objects1.Checked; end; procedure TfmConversation.Actions1Click(Sender: TObject); begin Actions1.Checked := not Actions1.Checked; spActions.Left:= pcActions.Left-7; spObjects.Left:= pcObjects.Left-7; pcActions.Visible := Actions1.Checked; end; The problem is that the splitters and the PageControls don't stay in the right places. If I make pcActions.visible=false and pcObjects.visible=false (by using the checks in the menu) everything is OK. But then when I bring them back to visible (again by using menu checks), they are in the wrong place. Does anyone know how to handle turning the PageControls and splitters visible and back to invisible without changing the left to right order of the components on the form? Thanks for any comments, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
Strange error in D7
Hi Delphiers, While trying to compile an old pascal program with D7/Vista, I get an error that I don't understand. It says: [Fatal Error] Grail.dpr(6): Unit Messages was compiled with a different version of Windows.TSmallPoint I am compiling Grail.dpr, which has the following text: == = program Grail; uses Forms{,} {Ai in 'AI.PAS' {Form1,} {Grailio in 'GRAILIO.PAS'}; --THIS IS WHERE THE ERROR OCCURS {$R *.RES} begin Application.CreateForm(TForm1, Form1); Application.Run; end. == = Since I have commented out the two units, what is it that uses Messages? If that is Forms, then how do I adjust this to get a good compile? Suggestions appreciated. -Rich ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: Developing for Vista
I just found out that even if I change the file permissions from read-only to read-write on Program Files | Borland, they go right back to read-only as soon as I close that directory. Can someone explain how to set the permissions for Program Files | Borland to read-write permanently? -Rich ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: D7 on Vista
I use D7 on Vista. It took a while to find out that it has to be run as administrator to work. Otherwise, Vista won't let programs rename files as they run, which is what D7 does when you create a new form from within the IDE. Generally speaking, Vista truly sucks more than any other OS I have used in the last 35 years with the possible exception of OS360. If you still have an XP machine, that would be a better place to run D7. Also, expect to find absolutely no software drivers worth a hoot for your printer, scanner, fax and so on. Vista is pretty good at email though. Outlook only crashes a few times per month. Sincerely, Rich Cooper EnglishLogicKernel.com [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, March 06, 2008 4:09 AM To: delphi@elists.org Subject: D7 on Vista Hello List, I just got my shiny new works computer. With shiny new Vista Business. Alas, when I try to install my grubby old Delphi 7 it complains that there known compatibility issues. Of course it neglects to tell me just exactly what those issues are, or indeed how I should overcome them. The (Code Gear, Inprise, Borland) Delphi web site is suitably opaque, and I cannot find a solution. Does anyone on this list use D7 on Vista? Can you tell me what I need to do? Thanks - Chris ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: D7 on Vista
Thanks Ross! I just made the file read/write, I hadn't known that Borland (or InstallShield) sets the permissions to read only without asking. I didn't have that problem on XP, so didn't suspect it on Vista. Sincerely, Rich Cooper EnglishLogicKernel.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ross Levis Sent: Thursday, March 06, 2008 3:47 PM To: 'Borland's Delphi Discussion List' Subject: RE: D7 on Vista You can leave UAC enabled and simply set the Program Files\Borland folder and all subfolders to have full read/write access to all users. Delphi can then rename files to it's hearts content. Ross. ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: Graphics32
When I expanded graphics32-1-8-3.zip, I also got the *.chm file, but it doesn't work. The chm file seems to use a web site call, and my screen shows a can't find message. So I tried installing the Graphics32 package, but then I found that the last few units must be use ing the first unit GR32.dcu, and I think Vista supposedly protects my computer by not letting the dcu file be read by the using file during compilation. If anyone has been able to install Graphics32 into D7 in Vista, I would love to hear how you did it. I'm sure it works with XP - most of my old software did before I got stuck with this yucky Vista machine. Thanks for trying Irwin, -Rich -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Irwin Scollar Sent: Saturday, December 29, 2007 6:33 AM To: delphi-talk@elists.org Subject: Graphics32 1. Graphics32 help file (Rich Cooper) 2. Graphics32 again (Rich Cooper) I have Graphics32 (2005) version installed and use it frequently under D7 with: 17/11/2005 10:36 2,249,324 graphics32-1-7-1.zip As an experiment, I expanded: 18/10/2007 09:56 2,109,489 graphics32-1-8-3.zip to get: 04/03/2007 22:12 888,928 Graphics32.chm which can be opened and read without problems in D7 under WinXP SP2 fully updated. The normal dual windows are shown and can be explored after clicking on the Show button. I don't have D7 installed under Vista and with D2007 installed there, I've left it by itself because I'm afraid of possible registry conflicts. Irwin Scollar __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
Delphi app playing minesweeper
Hi Delphians, Using D7 and (gasp) Vista, I would like to write an experimental app that plays minesweeper. I suppose I could simulate it in Delphi and build around that, but I would prefer to write an app that uses the 16 high by 30 wide configuration of minesweeper itself. The app should be able to manage an x,y grid of 16 by 30. It should be able to sense the state of each cell (unknown, or a number of mines near the cell), mark a cell as suspicious, select and click on a specific cell by x,y coordinate. This capability should ideally be a small app to write. I want to try out various search strategies and other things in Delphi and then try out a sequence of moves in procedures for the experiment. Has anyone already done this? Is there a component or activex that can do the job? Suggestions appreciated, Rich ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
Graphics32 help file
Hi Delphians, Using D7, Vista, I downloaded Graphics32, but the Graphics32.chm help file doesn't work. I think the reason is that the web site moved since the last time the *.chm file was generated for the D7 version. The left side panel with tree view for help contents works, but the right side (which must be a browser) shows The address is not valid for every item in the help file. So I tried installing the package GR32_D7.dpk into D7 but D7 shows an error message Invalid package file. Has anyone successfully gotten Graphics32 into D7? If so, what URL did you get the downloads from? My download was from http://sourceforge.net/project/showfiles.php?group_id=112985package_id=1222 11 and I got file Graphics32-1-8-3.zip. That one has the broken *.chm file and invalid package. In Vista, I'm running D7 as administrator. Suggestions appreciated. Sincerely, Rich Cooper __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
RE: Skype4COM
Thanks Jack, I googled up SkypeControl, got it deRARed, and as soon as I can, I'll try using it instead of Skyp4COM. I'm sure my problems with Skype4COM are based in Vista's ridiculous handling of security matters. If I had known how bad Vista was when I bought my computer, I would have insisted on XP instead. Even running D7 as administrator isn't enough to keep Vista from screwing it up. So if you're running in a functional OS, that could be why you're not experiencing the problems I'm seeing. Sincerely, Rich Cooper http://www.EnglishLogicKernel.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jack Sent: Sunday, November 18, 2007 8:24 AM To: Borland's Delphi Discussion List Subject: Re: Skype4COM I get that white box with black border with text Skype in it, too. This is probably because Skyep4COM is not a visible ActiveX so it doesn't know how to draw itself and Delphi just uses default drawing code to draw the box. (Only my guess.) But I'm not getting the loop, although the box sometimes disappears, so it's still usable. You may want to try a SkypeControl VCL. You should be able to find it in skype public api forum. I used it in another project of mine and it works fine. Jack component palette. But when I drop it on a form, it shows a white square with the text Skype in it, and nothing else. That's when the system goes into a loop, or at least gets nonresponsive in D7. If I wait another couple of minutes, it gets responsive again until I click on the dropped component again - at which point it goes nonresponsive for a couple of minutes. What is Delphi doing in that endless loop? Since I can't pause D7 during that time, I don't know. I also tried the task manager, which shows that D7 is using 0-1 percent and Skype is using 1-2 percent of the cpu. Nothing is chewing up more time than that. When the two minutes is up, I can run the form with Skype component on it, but that's all I have on the form, so its not very exciting to see the form come up and sit there. Any ideas? -Rich ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: Skype4COM
Does placing the Delphi wrapper component on the form afford any advantages over simply instantiating the COM object directly in code? In the past, I've always dropped the object on a form, so I haven't tried instantiating it directly. I guess there's no particular advantage to either way though. What install COM function are you trying to use? On the D7 menu: Component|Import ActiveX Control|Skype4COM 1.0 Type Library (Version 1.0)|Skype4COM.dll|Install After that, the Skype component symbol appears on the ActiveX page of the component palette. But when I drop it on a form, it shows a white square with the text Skype in it, and nothing else. That's when the system goes into a loop, or at least gets nonresponsive in D7. If I wait another couple of minutes, it gets responsive again until I click on the dropped component again - at which point it goes nonresponsive for a couple of minutes. What is Delphi doing in that endless loop? Since I can't pause D7 during that time, I don't know. I also tried the task manager, which shows that D7 is using 0-1 percent and Skype is using 1-2 percent of the cpu. Nothing is chewing up more time than that. When the two minutes is up, I can run the form with Skype component on it, but that's all I have on the form, so its not very exciting to see the form come up and sit there. Any ideas? -Rich ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: Skype4COM
Another hint: when I use the taskbar to switch to another program, the loop stops hanging, and I can get to D7 again. But if I click on the Skype component on the form, it starts hanging again! This can repeat any number of times - click on the Skype component and hang - use another program for at least fifteen seconds, and it frees up again. Any idea how to fix this would be welcome! -Rich http://www.EnglishLogicKernel.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rob Kennedy Sent: Tuesday, November 13, 2007 7:52 PM To: Borland's Delphi Discussion List Subject: Re: Skype4COM Rich Cooper wrote: I've tried to use Skype4COM with D7 and Vista. I run D7 as administrator. But I can't get the Install COM function to work. The Skype4COM component gets put on the ActiveX tab OK, but when I try to put one on a form, D7 goes into an endless loop, and Vista says it can't save the package! Does anyone have a workaround for D7/Vista/Skype that avoids this problem? Does placing the Delphi wrapper component on the form afford any advantages over simply instantiating the COM object directly in code? What install COM function are you trying to use? What is Delphi doing in that endless loop? -- Rob ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
Skype4COM
I've tried to use Skype4COM with D7 and Vista. I run D7 as administrator. But I can't get the Install COM function to work. The Skype4COM component gets put on the ActiveX tab OK, but when I try to put one on a form, D7 goes into an endless loop, and Vista says it can't save the package! Does anyone have a workaround for D7/Vista/Skype that avoids this problem? Sincerely, Rich Cooper [EMAIL PROTECTED] ___ Delphi mailing list - Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
RE: ServerSocket - SSL
Francois, I have heard somewhere that a web server must have a certificate for SSL at a cost of $500 to be able to use the SSL for all visitors. Is that still true, or is your SSL project eliminating that need for Delphi servers? -Rich Francois PIETTE wrote: Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
DIFF processing component/source code
Hi All, I'm looking for components, or just source code in Delphi, that calculates DIFF functions between two TStrings or TStringLists containing English text. So far, no luck on Delphi Super Page, or any other searches I've come up with. The closest I've gotten was a paper on sequence comparison (with no source code) at: http://www-igm.univ-mlv.fr/~lecroq/seqcomp/ If I were looking for file-to-file DIFFs, there are a number of those available, for example: http://www.freedownloadscenter.com/Best/diff-delphi.html which has syntax oriented Pascal DIFFs and file DIFFs like: http://www-igm.univ-mlv.fr/~lecroq/seqcomp/ But I want to look at MUCH SMALLER text strings organized into string lists and DIFF them quickly in memory, not in files, which is the usual way DIFFs are implemented. Suggestions for components people have actually used and found to be good choices will be appreciated. -Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
RE: DIFF processing component/source code
Another thought on this one - I need a measurement for how different pairs of these strings are. The Levenshtein distance measure is a good example of the kind of measurement I want to find between arbitrary pairs of strings. Some of the file-to-file or syntax oriented DIFF algorithms seem to use the Levenshtein distance measure, but not pass it back to the calling program. Some distance measure is very important for this application. http://en.wikipedia.org/wiki/Levenshtein_distance -Rich === Hi All, I'm looking for components, or just source code in Delphi, that calculates DIFF functions between two TStrings or TStringLists containing English text. So far, no luck on Delphi Super Page, or any other searches I've come up with. The closest I've gotten was a paper on sequence comparison (with no source code) at: http://www-igm.univ-mlv.fr/~lecroq/seqcomp/ If I were looking for file-to-file DIFFs, there are a number of those available, for example: http://www.freedownloadscenter.com/Best/diff-delphi.html which has syntax oriented Pascal DIFFs and file DIFFs like: http://www-igm.univ-mlv.fr/~lecroq/seqcomp/ But I want to look at MUCH SMALLER text strings organized into string lists and DIFF them quickly in memory, not in files, which is the usual way DIFFs are implemented. Suggestions for components people have actually used and found to be good choices will be appreciated. -Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Installing third part ActiveX controls in Delphi 2007
Thanks John! - Original Message - From: John Wilson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 8:49 AM Subject: Re: Installing third part ActiveX controls in Delphi 2007 Hi Rich, I came across something similar in dot net, on CodeProject. Basically it shows you how to translate the lat/long into google map grid co-ordinates, and then use those to grab the section of map that you want. Here's the link: http://www.codeproject.com/useritems/googlemap.asp It's not Delphi, but the principle applies :) Good luck with it! John. Date: Tue, 10 Apr 2007 10:40:42 -0800 From: Rich Cooper [EMAIL PROTECTED] Subject: Re: Installing third part ActiveX controls in Delphi 2007 I'm using D7 on XP HE and I am trying to write a program that shows IP addresses (already done) so that I can click on them (already done) and display a map of the area (that's what still needs to be done) where the IP is located. The present build is getting the textual lat,long specification of an IP address based on searching a table of IPs. When I go to Google | Maps, I can manually paste the lat,long into the box and get a nice map from Google, but not in just one window. Instead, I get a bunch of extraneous material at the top and left, and just the map in the bottom right of the window. I've tried looking at the HTML text (using view | source) but I don't get a clear idea of how to extract just the map window to display in my application. For example, here is an IP address and its lat long: 194.117.22.137 38.723, -9.133 and when I key or paste that lat long into Google Maps, I get a nice image of a town in Portugal near Lisbon. Ideally, I would like to embed a TWebBrowser in my application, and steer it to the map, but the present Google response is http://maps.google.com/maps?ie=UTF-8oe=UTF-8hl=entab=wlq= which doesn't have the lat, long physically embedded in the URL. Also, the portion of the image that I want to embed in my app has a map on the bottom right of the browser window, and extraneous material on the top and left sides. I've looked for places in the source that describe the window of interest, but I haven't found anything that seems to do the trick of capturing just the map info. It wouldn't hurt to also capture the pan and zoom buttons and the scale, which are on the same image as the map, but the HTML might as well be in greek. I also tried Mapquest, but I can't get lat,long maps from that one. Does anyone have any ideas that might lead to capturing the map of an arbitrary lat, long specification in a window by itself? Thanks, Rich ___ Delphi mailing list - [EMAIL PROTECTED] http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - [EMAIL PROTECTED] http://www.elists.org/mailman/listinfo/delphi
Re: Installing third part ActiveX controls in Delphi 2007
I'm using D7 on XP HE and I am trying to write a program that shows IP addresses (already done) so that I can click on them (already done) and display a map of the area (that's what still needs to be done) where the IP is located. The present build is getting the textual lat,long specification of an IP address based on searching a table of IPs. When I go to Google | Maps, I can manually paste the lat,long into the box and get a nice map from Google, but not in just one window. Instead, I get a bunch of extraneous material at the top and left, and just the map in the bottom right of the window. I've tried looking at the HTML text (using view | source) but I don't get a clear idea of how to extract just the map window to display in my application. For example, here is an IP address and its lat long: 194.117.22.137 38.723, -9.133 and when I key or paste that lat long into Google Maps, I get a nice image of a town in Portugal near Lisbon. Ideally, I would like to embed a TWebBrowser in my application, and steer it to the map, but the present Google response is http://maps.google.com/maps?ie=UTF-8oe=UTF-8hl=entab=wlq= which doesn't have the lat, long physically embedded in the URL. Also, the portion of the image that I want to embed in my app has a map on the bottom right of the browser window, and extraneous material on the top and left sides. I've looked for places in the source that describe the window of interest, but I haven't found anything that seems to do the trick of capturing just the map info. It wouldn't hurt to also capture the pan and zoom buttons and the scale, which are on the same image as the map, but the HTML might as well be in greek. I also tried Mapquest, but I can't get lat,long maps from that one. Does anyone have any ideas that might lead to capturing the map of an arbitrary lat, long specification in a window by itself? Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: copying one richedit to another
Thank you both, for both the suggestion and the discussion of alternatives. Yes, the memorystream version does seem to be the best candidate, and I will try it as soon as I get time. I was using the clipboard method just as a brainstorming approach in case it worked - it didn't! Your help is much appreciated, Rich --Original Mail-- From: Henry Bartlett [EMAIL PROTECTED] To: Borland's Delphi Discussion List delphi@elists.org Sent: Wed, 21 Mar 2007 07:16:28 +1100 Subject: Re: copying one richedit to another Ross Levis [EMAIL PROTECTED] wrote I wouldn't suggest using the clipboard, as the user may want to use it him/herself. The user could in fact copy something to the clipboard in another program at the same time as your program does, and end up with unusual results. I suggest using the stream option. I agree. I included the clipboard option as an example because the OP had tried and failed to make a similar method work. Henry Bartlett ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
copying one richedit to another
Hi All, I have two TRichEdits - reSentence and rePhraseSentence. The program spends a lot of time figuring out how to highlight reSentence with different fonts to help the user identify which words have which significance. Next, I want to copy the contents of reSentence to rePhraseSentence intact, with all the same highlight fonts in all the same places so the program doesn't have to spend a lot of time doing the exact same highlighting to rePhraseSentence that it already did to reSentence. I tried: reSentence.CopyToclipboard; rePhraseSentence.PasteFromClipboard; but that didn't do it. So I tried: rePhraseSentence.Lines := reSentence.Lines; and rePhraseSentence.Text := reSentence.Text; but of course that didn't do it either - the highlighted font information didn't get copied from reSentence to rePhraseSentence. I tried: rePhraseSentence.Assign(reSentence); but that caused a runtime exception stating that I can't assign a TRichEdit to a TRichEdit. Since rePhraseSentence is placed on panel rePhraseLeft, I tried: paPhrasesLeft.rePhraseSentence := reSentence; but that generated a compiler error. Can anyone figure out how to move the contents of one RichEdit to another RichEdit while preserving the highlighted font selections as well as the text? Help appreciated, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: TidHTTP
How does the TidAntiFreeze control work? Principles of operation would be nice to know if anyone can tell them. -Rich Use the TidAntiFreeze control. I'm using Indy 9 in D7, and in my audio player I'm using a HTTP.Get to retrieve a webpage inside a separate thread so as to not affect operation of the main user interface. However, during the execution of the Get, my main form stops responding. This is only a couple of seconds usually, but it's quite noticeable when the VU meter stops. Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: StringGrid
Hi Tony, I use a TGrid with the Align property set to alClient to fill up its area, and when the grid changes size, I use dgSearch.ColWidths[0]:= 70; dgSearch.ColWidths[1]:= dgSearch.Width-60; to set the two columns to a fixed first size, and all the remainder used for the right column, except enough space for a scroll bar to pop up when the grid is big. Hope that works for you Rich --- If I put a StringGrid (or similar component) on a form, and then scale the form (on application startup) according to the screen resolution being used, then the StringGrid component scales itself as does the form. However, the actual cell size does not scale. So if the grid is made to fit exactly into the control, at the resolution used for design, then when adjusted for higher screen resolution the grid will be smaller than the control, which looks ridiculous as well as leaving the grid very small at very high resolutions. Of course at the time of scaling the form, it would be possible to scale the DefaultColWidth and DefaultRowHeight properties. In most cases this is an OK workaround for row height but mostly my grids need different col widths but of course this workaround makes all the col widths equal. The F1 component scales correctly but that seems to be using a sledge hammer to crack a nut. I only need some simple 2 x 10 grids for data entry, not a spreadsheet. Does anyone know of a simple alternative workaround or alternative component? -- Regards, Tony Foale España / Spain www.tonyfoale.com [EMAIL PROTECTED] ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Automatic uninstall before installing new version - automatic updates
Hi All, Using D7 and Indy 9, I have a THttpServer that supports a thick client program. The client program is sent to customers and I want to provide an automatic update service, like MS does with WinXP. I've used the InstallShield Express version that ships with D7 to create a 'setup.exe' file. That works fine, but if I try to install over a previous version, WinXP objects. The user is forced to uninstall the previous version, though it seems the user can uninstall the previous one AFTER installing the new version! My question is this. How can I make my thick client D7/Indy9 program uninstall the previous version, and install the new version? Or is that impractical in practice? Should I just download and store a new .exe over the old one? Is there a way to do that? Suggestions appreciated, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
SSL with D7 and Indy 9
Hi Again, I'm using the Indy 9 component THTTP in a client program, and it has to connect using SSL to the Indy 9 example HTTPServer which is based on the TIdHTTPServer component. For the client, I dropped a TIdSSLIOHandlerSocket onto the form with the following settings: SSLOptions.Method = sslvSSLv2 (the default value) SSLOptions.Mode = ssImUnassigned (the default) SSLOptions.RootCertFile = (?I don't know where to get an SSL Certificate) There is a web page that describes how one person did it at http://www.tek-tips.com/viewthread.cfm?qid=419856 using the client program, but he doesn't say anything about the certificate, so I'm nonplussed. Does anyone know where (how) to get an SSL Certificate? I have to distribute it with my program I guess, so it will have to be distributable. Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
SSL with D7 and Indy 9
Having dropped a TId I get an exception from class EIdOSSLCouldNotLoadSSLLibrary with message 'Could not load SSL Library'. I have put 'libeay.dll' and 'ssleay32.dll' into the start directory, as I read should be done, but somehow it isn't getting put in right. The hunk of code raising the exception is in IdSSLOpenSSL: .. if DLLLoadCount = 0 then begin if not IdSSLOpenSSL.LoadOpenSLLibrary then begin raise EIdOSSLCouldNotLoadSSLLibrary.Create(RSOSSLCouldNotLoadSSLLibrary); end; end; .. Remember that I don't have an SSL certificate yet, so that might be the issue to be solved, but does that stop loading of DLLs? Does anyone know how to fix this? Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Scrollbars in TMemo when Enabled=False
Rob Kennedy wrote Rich Cooper wrote: Problem is, when the TMemo has lots of text, the user can't operate the scrollbars when Enabled=False. So s/he can't see the material in the TMemo which is off the visual area. See the ReadOnly property. -- Rob Perfect! Thanks for the tip! -Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Scrollbars in TMemo when Enabled=False
Hi All, Using D7 and Indy 9, I have some data fields that are extracted from web pages, so they can be arbitrarily long. I want to use TMemos with ssBoth scrollbars so people can see the entire field. First, I used TLabels to display the fields, but the fields extended past the limits of my TPanel which holds the TLabels, so I went to TMemos with scrollbars to get around this problem. But I don't want the user to be able to change the text in the TMemo any more than s/he would with the TLabel. So I set Enabled=False in the TMemo fields. Problem is, when the TMemo has lots of text, the user can't operate the scrollbars when Enabled=False. So s/he can't see the material in the TMemo which is off the visual area. I would like to present the entire text to a user, letting the user manage the scrollbar positions, but not let the user change the text. Does anyone know how to do this? Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Turbo Editions
I have D5, D7 and D2005 on the same machine. The registry entries for *.dpr, *.pas, *.dfm and so on are set to one of them - D2005 I think since that was the last one I installed. But mostly I use D7, which is my favorite. When I want to launch a DN, I right click on the *.dpr file and a list of options pops up which includes open with.. as a submenu. Left clicking again on the one I want at that moment chooses the DN I want to use. So the registry entries don't affect me in any way other than that I have to right click and choose before launching. Alternatively, all DN are on the Start|All Programs menu sequence, so I can get to any of them that way, and use File|Open Project.. once some DN has been launched to get going. So I don't find registry entries to be a problem at all, not even an inconvenience, and unless Borland marketing got in the act, I would expect the Turbo line to follow the same design lines. JMHO, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
TWebBrowser and Popup menu
Hi All, I have a TWebBrowser successfully downloading html pages and displaying them. When I right click on the TWebBrowser, I get the standard IE6 menu (Back, Forward, Save Background as .. ) which I don't want. I'm using XP HE, D7. I built a popupmenu and added the click features I do want the TWebBrowser to show the user, and I set the TWebBrowser's PopupMenu property to that popup menu. It doesn't work. When I right click on the TWebBrowser at run time, I still get the IE6 menu! The PopupMenu property box has a + in the object inspector, so I checked the sub items and they all look OK to me: AutoPopupTrue Items has the menu items on my popup menu TrackButton tbRightButton So none of those are obvious problems. Does anyone know how to change the IE6 popup menu to another popup menu of my own design? Thanks, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
Re: TWebBrowser and Popup menu
Thanks Rob, From that MSDN web site material, it appears that the way to eliminate the standard context menu and implement a Delphi popup menu is to override what MSDN calls IDocHostUIHandler::ShowContextMenu Does anyone have a sample (or article) about how to do that? Surely lots of people must have faced that issue before and solved it? Thanks, Rich Rob Kennedy wrote: Rich Cooper wrote: Does anyone know how to change the IE6 popup menu to another popup menu of my own design? See the following MSDN article. http://msdn.microsoft.com/workshop/browser/overview/overview.asp#Controlling_the_Cont -- Rob __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
WordWrap with TRichEdit and SelAttributes
There is something funny going on with TRichEdit (D7). When I use SelAttributes on a selected text portion with RichEdit.WordWrap set to false, all the positionng is correctly done. But when I do the same thing with RichEdit.WordWrap set to true, positioning is offset by CRLF functions in SOME RichEdits, but not in others! So if I turn RichEdit.WordWrap to False, then do the text selection and SelAttributes, then set RichEdit.WordWrap to True (for visual readability purposes), the text in SOME RichEdits goes into the formatted rich text description instead of the original text. In all RichEdits, I have PlainText set to False. I'm using four RichEdits, and they all have the exact same property values, as verified in the object inspector. Here's the latest code: var OldStyle : TFontStyles; OldColor : TColor; procedure TfmGetAllHRSectionsOfAPatentString.HighlightWord( RichEdit : TRichEdit; TotalLen : Integer; LineCount : Integer; I, Len: Integer ); begin RichEdit.SelStart := I-1; RichEdit.SelLength := Len; RichEdit.SelAttributes.Color := clRed; RichEdit.SelAttributes.Style := [fsBold]; RichEdit.SelLength := 0; RichEdit.SelStart := TotalLen; RichEdit.SelAttributes.Style := OldStyle; RichEdit.SelAttributes.Color := OldColor; end; procedure TfmGetAllHRSectionsOfAPatentString.HighlightKeyWords( RichEdit : TRichEdit ); var TotalCharCount : Integer; LastChar : Char; NextChar : Char; I,L: Integer; AWord : string; EndOfWord : Boolean; TheText: string; LineCount : Integer; begin {Highlight keywords and their synonyms} OldStyle := RichEdit.SelAttributes.Style; OldColor := RichEdit.SelAttributes.Color; TheText:= RichEdit.Lines.Text; TotalCharCount := Length(TheText); NextChar := ' '; I := 1; LineCount := 0; RichEdit.Lines.BeginUpdate; while (I(TotalCharCount-1)) do begin LastChar := NextChar; NextChar := TheText[I]; if NextChar=#$D then LineCount := LineCount+1 else if IsSeparator(LastChar) then if IsAlpha(NextChar) then begin L := 1; EndOfWord := False; while ( ((I+L)=TotalCharCount) and(not EndOfWord)) do begin if IsSeparator(TheText[I+L]) then begin AWord := Copy(TheText,I,L); if (KeysPlusSynonyms.IsBoundString(AWord)-1) then HighlightWord( RichEdit, TotalCharCount, LineCount, I, L); EndOfWord := True; end; L := L+1; end; NextChar := TheText[I+L-1]; I:= I+L-1; end; I := I+1; end; RichEdit.Lines.EndUpdate; RichEdit.Invalidate; Application.ProcessMessages; end; And in the main routine, three RichEdits are called: ... HighLightKeywords(reDescription); HighLightKeywords(reClaims); HighLightKeywords(reAbstract); ... Here is the text copied from a RichEdit with WordWrap set to True: BACKGROUND OF INVENTION This invention relates generally to computer systems and more specifically to the memory portions of such systems. The subject matter of this invention is related to the subject matter of the prior inventions entitled GARBAGE-COLLECTING MEMORY MODULE, Ser. No. 07/994,517, filed Dec. 21, 1992 (now U.S. Pat. No. 5,560,003, issued Sep. 24, 1996) and OBJECT SPACE MANAGER CIRCUIT, Ser. No. 08/176,940, filed Jan. 4, 1994, (pending). As you can see, the red bold font only works properly for the first four keywords, which happen to be on the first line of text. After that, the red bold font is spaced away by a multiple of the number of lines. If I then turn WordWrap off and back on, the formatting text appears: -- {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil MS Sans Serif;}} {\colortbl ;\red255\green0\blue0;} \viewkind4\uc1\pard\f0\fs16 BACKGROUND OF INVENTION \par \par \cf1\b This\cf0\b0 invention relates generally to computer systems \cf1\b and\cf0\b0 more specifically to \cf1\b the\cf0\b0 memory portions of such systems. \cf1\b The\cf0\b0 subject matter of th\cf1\b is i\cf0\b0 nvention is\cf1\b r\cf0\b0 elated to th\cf1\b e s\cf0\b0 ubject
Re: Strange accesses to Indy 9 web server using D7
Hi All, I used to be able to open WordNet 2.0 with the following ShellExecute: ShellExecute( 0,'open', 'C:\Program Files\WordNet\2.0\bin\wishwn.exe/', 'C:\Program Files\WordNet\2.0\bin\wnb', nil, SW_HIDE); but now with WordNet 2.1, it doesn't work. The old WordNet 2.0 shortcut target location was shown in the properties box as: C:\Program Files\WordNet\2.0\bin\wishwn.exe C:\Program Files\WordNet\2.0\bin\wnb But the new WordNet 2.1 shortcut target location is grayed and disabled, and just a symbolic entry is given as: WordNet 2.1 which is clearly not amenable to putting into a ShellExecute. Looking into the new directory c:/program files/wordnet/2.1/bin/ there are only the executables: wn.exe wnb.exe So wishwn.exe doesn't even exist anymore. When I click directly on the wnb.exe file from Win Explorer, it runs properly. So I changed the ShellExecute to ShellExecute( 0,'open', 'C:\Program Files\WordNet\2.1\bin\wn.exe', 'C:\Program Files\WordNet\2.0\bin\wnb', nil, SW_HIDE ); Which does nothing I can see. I click on a button to execute the ShellExecute and nothing happens. When I changed the SW_HIDE to SW_SHOW, I get a very fast flash of a DOS box, but nothing else. When I change the execute to: else ShellExecute( 0,'open', 'C:\Program Files\WordNet\2.1\bin\wnb.exe', 'C:\Program Files\WordNet\2.1\bin\', nil, SW_SHOW ); I get an error box with the comment: couldn't read file wnb.tcl; no such file or directory. But the file wnb.tcl is there in the same directory as the executable, i.e. in: C:\Program Files\WordNet\2.1\bin\ Does anyone know how to figure out a ShellExecute command to get that program going? Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Strange accesses to Indy 9 web server using D7
Eddie Shipman wrote Does anyone know how to redirect these IP addresses to another address using the Indy 9 HTTPServer and D7? Don't accept connections from them. There is no hint of how to refuse a connection in the Indy 9 HTTPServer example code. The OnConnect and OnDisconnect events (with my time stamp added) are: procedure TfmHTTPServerMain.HTTPServerConnect(AThread: TIdPeerThread); var PeerIP : string; PeerPort : string; DTStamp : string; begin PeerIP := AThread.Connection.Socket.Binding.PeerIP; PeerPort := IntToStr(AThread.Connection.Socket.Binding.PeerPort); DTStamp := DateTimeToStr(Now); DisplayMessage('User logged in '+PeerIP+':'+PeerPort+' at '+DTStamp); end; procedure TfmHTTPServerMain.HTTPServerDisconnect(AThread: TIdPeerThread); var DTStamp : string; begin DTStamp := DateTimeToStr(Now); DisplayMessage('User logged out at '+DTStamp); end; Neither of these show how to refuse a connection. Since I have to already have a connection in the examples to get an IP address, how could I refuse a connection based on IP? There must be a way. Suggestions greatly appreciated. Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Strange accesses to Indy 9 web server using D7
Eddie Shipman wrote Does anyone know how to redirect these IP addresses to another address using the Indy 9 HTTPServer and D7? Don't accept connections from them. How do I do that? Looking at the Indy 9 HTTPServer demo, it isn't exactly obvious how to do that. There is a reference to the IP address in the HTTPServerCommandGet procedure which looks at the IP address as: TIdIOHandlerSocket(AThread.Connection.IOHandler).Binding.PeerIP which I could look up in a listbox of bad IPs, but how do I know it hasn't already been acknowledged deeper down in the Indy components? If I put a test for a bad IP there, and just simply ignore the rest of the Get procedure, does that constitute not accepting the connection, or is there a deeper structure I need to modify in Indy 9? Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Strange accesses to Indy 9 web server using D7
Hi All, I've been running my web server for a week or two now, and I'm getting accessed by, at present, 13 unique IP addresses other than my own IP when I test the server using a D7 thick client program. One access sequence is particularly disturbing because it seems to be time spaced in a variable way, and the user never accesses web pages - just logs in and then out immediately after. Here's a section of the log my Indy HTTPServer program made: User logged in 24.130.81.58:1730 at 7/18/2006 10:56:21 AM User logged out at 7/18/2006 10:56:21 AM User logged in 24.130.81.58:1741 at 7/18/2006 10:56:21 AM User logged out at 7/18/2006 10:56:22 AM User logged in 24.130.81.58:2659 at 7/18/2006 11:07:52 AM User logged out at 7/18/2006 11:07:52 AM User logged in 24.130.81.58:2677 at 7/18/2006 11:07:52 AM User logged out at 7/18/2006 11:07:52 AM User logged in 24.130.81.58:3304 at 7/18/2006 11:25:57 AM User logged out at 7/18/2006 11:25:57 AM User logged in 24.130.81.58:3332 at 7/18/2006 11:25:57 AM User logged out at 7/18/2006 11:25:57 AM Note that 10:56:21 AM plus 00:11:30 gets to 11:07:52 AM, plus another 00:18:05 gets to 11:25:57 AM. So the time lags between accesses seem long enough to be a human hacker rather than a web bot scanning for sites. Also, the 13 IPs my HTTPServer logs include some (see the *s) which have accessed multiple times: http://124.0.90.2 http://132.248.133.225 http://24.10.33.13 http://24.111.87.129 http://24.130.201 http://24.130.201.47 * http://24.130.80.56 http://24.130.81.58 * http://24.163.81.123 http://24.207.242.67 http://24.210.196.74 http://24.24.174.20 http://24.98.49.155 * Does anyone recognize this kind of pattern? Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: D7 with Indy 9 http server - security issues
Thanks for your assessment - like many web site builders, I hope this one will grow into a famous web site, but its still a long way from that now! -Rich Human wrote Hello. snip/ I do not really think you need a protection. Exploits appears for famous web servers, when somebody knows what the weak point is and how to penetrate through that point. Just keep your server anonymous (do not display any info about the server type and version). In the BEST CASE, a hacker can block/reset your server (flood). It is really really really difficult to penetrate a server and take over your computer/server or to delete/replace the web content. However, if you still want you can modify the demo to make a small... something, I do not know how to call it. Is like a firewall but it will trigger only if the visitor try to connect to the server more than 20 times in a minute. If somebody tries to connect even faster 10/sec, then the firewall will trigger more quickly. No decent user will try to request so many pages in a minute. Therefore, you can filter the 'enemy' out. --- PS: the elementary school is the ideal place for a (small) hacker to hatch and grow. Small hacker = script kid PS2: the server you mentioned (124.0.90.2) run currently a SSH server. They also have a Telnet, FTP and of course HTTP. They are also running some strange services that I was unable to identify for sure but I think that server is infected with NetPort Discovery Port Masters Paradise Trojan Horse (3129 open). So it just scanned your computer purely random. Still I do not understand why it scanned you more than once. --- At the final As an unwritten rule: the higher is the port used, the greater the chance that connection is an attack (is coming from a 'bad' software with bed indentions). --- Rich Cooper [EMAIL PROTECTED] wrote: Hi All, I have my Indy 9 httpserver running, and I have it store a log of which IPs access the site. There is one persistent visitor who shouldn't even be there. Its from IP address http://124.0.90.2/ When I point IE at that address, I get a web page with asian characters on it that says something about Yeonseo elementary school. Perhaps that site has been permeated by a virus that looks around the web for other sites to infect. Here's the section of log that shows what they were after: User logged in 124.0.90.2:43434 User logged out User logged in 124.0.90.2:37702 Command GET /a1b2c3d4e5f6g7h8i9/nonexistentfile.php received from 124.0.90.2:37702 User logged out User logged in 124.0.90.2:37788 Command GET /adxmlrpc.php received from 124.0.90.2:37788 User logged out User logged in 124.0.90.2:37869 Command GET /adserver/adxmlrpc.php received from 124.0.90.2:37869 User logged out User logged in 124.0.90.2:37950 Command GET /phpAdsNew/adxmlrpc.php received from 124.0.90.2:37950 User logged out User logged in 124.0.90.2:38031 Command GET /phpadsnew/adxmlrpc.php received from 124.0.90.2:38031 User logged out User logged in 124.0.90.2:38113 Command GET /phpads/adxmlrpc.php received from 124.0.90.2:38113 User logged out User logged in 124.0.90.2:38190 Command GET /Ads/adxmlrpc.php received from 124.0.90.2:38190 User logged out User logged in 124.0.90.2:38270 Command GET /ads/adxmlrpc.php received from 124.0.90.2:38270 User logged out User logged in 124.0.90.2:38435 Command GET /xmlrpc.php received from 124.0.90.2:38435 User logged out User logged in 124.0.90.2:38517 Command GET /xmlrpc/xmlrpc.php received from 124.0.90.2:38517 User logged out User logged in 124.0.90.2:38600 Command GET /xmlsrv/xmlrpc.php received from 124.0.90.2:38600 User logged out User logged in 124.0.90.2:38681 Command GET /blog/xmlrpc.php received from 124.0.90.2:38681 User logged out User logged in 124.0.90.2:38763 Command GET /drupal/xmlrpc.php received from 124.0.90.2:38763 User logged out Does anyone have any suggestions about components/techniques that could provide some security for the server? Thanks, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk If I choose Christianity then the Islamic will say I'm a pagan. If I choose Islamic then the Buddhism will say I'm a pagan. If I chose Buddhism then the Jewish will say I'm pagan. If I choose no God then everybody will say I'm pagan. Please, can I be free? Can you NOT tell me how I should live MY life? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org
Starting up ANY web browser with ShellExecute
Hi All, I can successfully get the following ShellExecute to start up IE: ShellExecute( 2,'open', 'iexplore.exe', pChar(WebURL+'News.htm'), nil, SW_SHOWNORMAL); But what if the user is running a different web browser? Is there a better (more generic) way to do this? Thanks, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
Re: Starting up ANY web browser with ShellExecute
Hi Si, Thanks! That works for IE, though I haven't been able to test it using other browsers at this time. Logically, it seems like it will work with any of them. Thanks, Rich Kraven wrote I use this (opens whichever is default browser) ShellExecute( 2,'open', pChar(WebURL+'News.htm'), nil, nil, SW_SHOWNORMAL); - Original Message - From: Rich Cooper [EMAIL PROTECTED] To: Delphi-Talk Discussion List delphi-talk@elists.org Sent: Saturday, July 15, 2006 6:49 PM Subject: Starting up ANY web browser with ShellExecute Hi All, I can successfully get the following ShellExecute to start up IE: ShellExecute( 2,'open', 'iexplore.exe', pChar(WebURL+'News.htm'), nil, SW_SHOWNORMAL); But what if the user is running a different web browser? Is there a better (more generic) way to do this? Thanks, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
Re: D7 with Indy 9 http server again
Human wrote Sorry for this very late answer. I had a similar problem recently and I found a tool 'TCPview' from sysinternals.com, which will show you what program listen to which port. I just want to let everybody know this. May be helpful in the future. PS: it is worthing to switch to Indy 10? Indy 9 is the one I've used for most of my work, so switching would require rebuilding all my older programs into Indy 10 as well. I don't know of any features in Indy 10 that are compelling enough to motivate that change just yet. But maybe I'm unaware of some useful feature. Do you have anything specific in mind? Thanks, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
Re: similiar to opening a csv file in default program
Stephen Posey wrote: Rich Cooper wrote: Thanks Stephen, I found a web page with a similar snippet, and so I was able to get the following to work in my OnFormCreate handler: D := GetStartDir; ShellExecute( 0, 'open', PChar('command.com'), PChar('/c '+'ipconfig/all harbor.txt'), nil, SW_HIDE ); Waiting := 100; while ( (Waiting0) and (not FileExists(D+'HARBOR.TXT'))) do begin Sleep(250); Waiting := Waiting-1; end; if (not FileExists(D+'HARBOR.TXT')) then raise Exception.Create('Login Error 1.'); But there is still a problem. The 'Waiting' loop discovers that the file exists, but not whether it has been completely written and let loose to be read. In my OnFormActivate handler, I use: if FirstActivation then begin D := GetStartDir; Application.ProcessMessages; Sleep(500); if FileExists(D+'HARBOR.TXT') then begin meHarbor.Lines.LoadFromFile(D+'HARBOR.TXT'); which works 95% of the time. But sometimes it causes the LoadFromFile procedure to throw an exception related to trying to read a file that is not yet ready to be read - still locked by the NT file system in XP, and not yet completely written to the HARBOR.TXT file and then released to the rest of the computer. Does anyone have a way to determine whether the file HARBOR.TXT has been released for reading after being completely written? I would be able to fix this problem by replacing the Sleep(500) with a loop that tests till the HARBOR.TXT file is ready for reading, having been fully released. I don't know precisely how cmd.exe creates and opens a redirected file like that, but your attempting to open it in exclusive share mode ought to fail regardless if the file is still being written. You can use a TFileStream instance, like so: FS := TFileStream.Create(D + 'HARBOR.TXT', fmOpenRead or fmShareExclusive); Attempt that and catch any exception raised due to the sharing conflict (should be some form of EInOutError), if the file exists and no exception is raised on attempting to open it, then it should be finished. HTH Stephen Posey [EMAIL PROTECTED] I tried LoadFromFile() with try ... except end around it and kept looping till the exceptions went away - that worked just fine! Thanks Stephen and Simon, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: similiar to opening a csv file in default program
I managed to set a flag, then loop on exceptions with a LoadFromFile) until there was no exception, and that seems to solve the problem! Thanks Sid, Rich Sid Gudes wrote I haven't tried this, but probably what you can do is try to open the file exclusively (fmShareExclusive). If it is in use by DOS, then the open should fail. Once DOS finishes and closes the file, the open should succeed. So something like this: waiting := 100; repeat try fs := tFileStream.create (D+'harbor.txt', fmOpenRead or fmShareExclusive); // at this point the open succeeded, so break out of the loop fs.destroy; break; except // we get here if the file was not openable, or does not exist sleep (100); end; dec (waiting); until waiting = 0; if waiting = 0 then error... The above is OTTOMH. I think also, in case there is an old version of harbor.txt on the hard drive, that it would make sense to delete the file before running the DOS command, otherwise the tFileStream.create might just succeed on the old file before the DOS session gets underway. BTW, should '/c '+'ipconfig/all harbor.txt' be instead '/c '+'ipconfig/all ' + D + 'harbor.txt' ? HTH At 09:07 AM 7/6/2006, Rich Cooper wrote: Thanks Rob, But actually, I did get one to work. It finally gelled for the following code in my OnFormCreate handler: D := GetStartDir; ShellExecute( 0, 'open', PChar('command.com'), PChar('/c '+'ipconfig/all harbor.txt'), nil, SW_HIDE ); Waiting := 100; while ( (Waiting0) and (not FileExists(D+'HARBOR.TXT'))) do begin Sleep(250); Waiting := Waiting-1; end; if (not FileExists(D+'HARBOR.TXT')) then raise Exception.Create('Login Error 1.'); But there is still a problem. The 'Waiting' loop discovers that the file exists, but not whether it has been completely written and let loose to be read. In my OnFormActivate handler, I use: if FirstActivation then begin D := GetStartDir; Application.ProcessMessages; Sleep(500); if FileExists(D+'HARBOR.TXT') then begin meHarbor.Lines.LoadFromFile(D+'HARBOR.TXT'); which works MOST of the time. But occasionally, (5%) it causes an exception related to trying to read a file that is still being written. Does anyone have a way to determine whether the file HARBOR.TXT has been released for reading after being completely written? I would be able to fix this problem by replacing the Sleep(500) with a loop that tests till the HARBOR.TXT file is ready. Thanks, Rich Rob Kennedy wrote Rich Cooper wrote: I'm trying to pipe a DOS command to a file using a ShellExecute, but it doesn't create the output file. Here's the code: var D : string; ... D := GetStartDir; ShellExecute(0,pChar('ipconfig/all '),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL); ... but no file named 'harbor.txt' gets created. Does anyone know how to fix this? First, ipconfig/all is not a shell verb. Did you read the documentation for ShellExecute before composing the code above? Second, you're telling ShellExecute to look in the registry for the ipconfig/all key for files named *.txt, and then execute the command it finds there on the harbor.txt file, which I'm guessing doesn't even exist. Third, note that command-line redirection is performed by the command-line interpreter. ShellExecute is not a command-line interpreter. Read this: http://blogs.msdn.com/oldnewthing/archive/2006/05/16/598893.aspx You should be able to find lots of example code to solve your problem with the following search: http://groups.google.com/groups?q=pipe+dos+commandas_ugroup=*delphi* Fourth, ipconfig is not a DOS command. It's a console program, but it's a fully fledged Windows program. Try to run it in DOS (if you even have a computer with DOS installed anymore), and you'll simply be told that it needs to run in Win32 mode. Finally, type-casting a string literal to PChar is not necessary and can sometimes lead to problems. A string literal can be used as any string-related type, including AnsiString, WideString, PAnsiChar, and PWideChar. The compiler will choose based on what it needs. You don't need to tell it. -- Rob Regards, Sid Gudes PIA Systems Corporation [EMAIL PROTECTED] ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: similiar to opening a csv file in default program
Lovely! Thanks, Jeff -Rich Jeff Young wrote Rich, Thought I'd chime in with code that I've used for the very same process. It worked on D7... HTH. unit Process; interface uses Classes, Windows, SysUtils; function ExecuteWait(Path, Command, Params: String; ShowWindow: Word; Output: TStringList): DWord; function GetTempFile: String; implementation function ExecuteWait(Path, Command, Params: String; ShowWindow: Word; Output: TStringList): DWord; // Build a temporary filename --- var StartupInfo: TStartupInfo; ProcessInfo: TProcessInformation; saAttr: TSecurityAttributes; hOut, hInp: THandle; outFile, inpFile: String; begin if Path = '' then begin Output.Add('Path not specified: ' + Path); exit; end;// if Path saAttr.nLength := sizeof(TSecurityAttributes); saAttr.bInheritHandle := True; saAttr.lpSecurityDescriptor := nil; hOut := STD_OUTPUT_HANDLE; hInp := STD_INPUT_HANDLE; if Output nil then begin outFile := GetTempFile; hOut := CreateFile(PChar(outFile), GENERIC_READ or GENERIC_WRITE, 0, @saAttr, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, 0); end; // if Output nil ZeroMemory(@ProcessInfo, SizeOf(TProcessInformation)); ZeroMemory(@StartupInfo, SizeOf(TStartupInfo)); with StartupInfo do begin cb := SizeOf(TStartupInfo); hStdOutput := hOut; hStdError := hOut; hStdInput := hInp; wShowWindow := ShowWindow; dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES; end; // with if CreateProcess(nil, PChar(''+ Path + Command + ' ' + Params), @saAttr, @saAttr, True, 0, nil, PChar(Path), StartupInfo, ProcessInfo) then begin WaitForSingleObject(ProcessInfo.hProcess, INFINITE); repeat GetExitCodeProcess(ProcessInfo.hProcess, Result); //Application.ProcessMessages; until (Result STILL_ACTIVE); CloseHandle(ProcessInfo.hProcess); CloseHandle(ProcessInfo.hThread); if Output nil then begin CloseHandle(hOut); Output.LoadFromFile(outFile); end; // if Output nil DeleteFile(inpFile); DeleteFile(outFile); end // if CreateProcess(... else Output.Add('Create Process failed. Code: ' + IntToStr(GetLastError())); end; // function GetTempFile: String; var DirBuf, FileBuf: Array [0..255] of char; begin GetTempPath(Length(DirBuf), DirBuf); GetTempFileName(DirBuf, 'tmp', 0, PChar(@FileBuf)); Result := FileBuf; end;//GetTempFile end. ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
TWebBrowser and automating web surfing
Hi Everybody, Using D7 and TWebBrowser, I would like to automate surfing some web sites. To do that, I have to plug strings into text areas of the web page, and then push a button, all automatically. That is, I want the program to do the string plugging and the button pushing. Here's an example text area: TEXTAREA ROWS=4 COLS=47 WRAP=VIRTUAL NAME=Query/TEXTAREA and here arethe two buttons that go into the same web page to start the web server searching its database or canceling the search: INPUT TYPE=SUBMIT VALUE=Search INPUT TYPE=RESET TWebBrowser lets me get the text of a web page using the Indy HTTP component: Memo1.Lines.Text := HTTP.Get(VisitURL); So I can go through the memo lines to find the right sections, but here's the sticky part I haven't figured out yet: How do I put the string into the text area and press the Search button in D7 with Indy components? Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: similiar to opening a csv file in default program
Thanks Wim! I finally got it figured out. -Rich Wim Sterns wrote --- Rich Cooper wrote: I'm trying to pipe a DOS command to a file using a ShellExecute, but it doesn't create the output file. Here's the Rich, try pchar('d:\harbor.txt'),nil,pchar('d:\') Wim code: var D : string; ... D := GetStartDir; ShellExecute(0,pChar('ipconfig/all '),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL); ... but no file named 'harbor.txt' gets created. Does anyone know how to fix this? Thanks, Rich __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: similiar to opening a csv file in default program
Thanks Rob, But actually, I did get one to work. It finally gelled for the following code in my OnFormCreate handler: D := GetStartDir; ShellExecute( 0, 'open', PChar('command.com'), PChar('/c '+'ipconfig/all harbor.txt'), nil, SW_HIDE ); Waiting := 100; while ( (Waiting0) and (not FileExists(D+'HARBOR.TXT'))) do begin Sleep(250); Waiting := Waiting-1; end; if (not FileExists(D+'HARBOR.TXT')) then raise Exception.Create('Login Error 1.'); But there is still a problem. The 'Waiting' loop discovers that the file exists, but not whether it has been completely written and let loose to be read. In my OnFormActivate handler, I use: if FirstActivation then begin D := GetStartDir; Application.ProcessMessages; Sleep(500); if FileExists(D+'HARBOR.TXT') then begin meHarbor.Lines.LoadFromFile(D+'HARBOR.TXT'); which works MOST of the time. But occasionally, (5%) it causes an exception related to trying to read a file that is still being written. Does anyone have a way to determine whether the file HARBOR.TXT has been released for reading after being completely written? I would be able to fix this problem by replacing the Sleep(500) with a loop that tests till the HARBOR.TXT file is ready. Thanks, Rich Rob Kennedy wrote Rich Cooper wrote: I'm trying to pipe a DOS command to a file using a ShellExecute, but it doesn't create the output file. Here's the code: var D : string; ... D := GetStartDir; ShellExecute(0,pChar('ipconfig/all '),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL); ... but no file named 'harbor.txt' gets created. Does anyone know how to fix this? First, ipconfig/all is not a shell verb. Did you read the documentation for ShellExecute before composing the code above? Second, you're telling ShellExecute to look in the registry for the ipconfig/all key for files named *.txt, and then execute the command it finds there on the harbor.txt file, which I'm guessing doesn't even exist. Third, note that command-line redirection is performed by the command-line interpreter. ShellExecute is not a command-line interpreter. Read this: http://blogs.msdn.com/oldnewthing/archive/2006/05/16/598893.aspx You should be able to find lots of example code to solve your problem with the following search: http://groups.google.com/groups?q=pipe+dos+commandas_ugroup=*delphi* Fourth, ipconfig is not a DOS command. It's a console program, but it's a fully fledged Windows program. Try to run it in DOS (if you even have a computer with DOS installed anymore), and you'll simply be told that it needs to run in Win32 mode. Finally, type-casting a string literal to PChar is not necessary and can sometimes lead to problems. A string literal can be used as any string-related type, including AnsiString, WideString, PAnsiChar, and PWideChar. The compiler will choose based on what it needs. You don't need to tell it. -- Rob ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: similiar to opening a csv file in default program
Thanks Stephen, I found a web page with a similar snippet, and so I was able to get the following to work in my OnFormCreate handler: D := GetStartDir; ShellExecute( 0, 'open', PChar('command.com'), PChar('/c '+'ipconfig/all harbor.txt'), nil, SW_HIDE ); Waiting := 100; while ( (Waiting0) and (not FileExists(D+'HARBOR.TXT'))) do begin Sleep(250); Waiting := Waiting-1; end; if (not FileExists(D+'HARBOR.TXT')) then raise Exception.Create('Login Error 1.'); But there is still a problem. The 'Waiting' loop discovers that the file exists, but not whether it has been completely written and let loose to be read. In my OnFormActivate handler, I use: if FirstActivation then begin D := GetStartDir; Application.ProcessMessages; Sleep(500); if FileExists(D+'HARBOR.TXT') then begin meHarbor.Lines.LoadFromFile(D+'HARBOR.TXT'); which works 95% of the time. But sometimes it causes the LoadFromFile procedure to throw an exception related to trying to read a file that is not yet ready to be read - still locked by the NT file system in XP, and not yet completely written to the HARBOR.TXT file and then released to the rest of the computer. Does anyone have a way to determine whether the file HARBOR.TXT has been released for reading after being completely written? I would be able to fix this problem by replacing the Sleep(500) with a loop that tests till the HARBOR.TXT file is ready for reading, having been fully released. Thanks, Rich Stephen Posey wrote: Rich Cooper wrote: I'm trying to pipe a DOS command to a file using a ShellExecute, but it doesn't create the output file. Here's the code: var D : string; ... D := GetStartDir; ShellExecute(0,pChar('ipconfig/all '),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL); ... but no file named 'harbor.txt' gets created. Does anyone know how to fix this? The issue with piping is that it's a function of the DOS command processor (CMD.EXE under NT/Win2000/XP); ShellExecute on its own knows nothing of it. In order to accomplish what you're describing you'll need to invoke the command processor to run the command. Something like: ShellExecute(0, pchar('OPEN'), pchar('c:\windows\system32\cmd.exe'), pchar(' /c c:\windows\system32\ipconfig.exe /all c:\harbor.txt'), pchar('c:\'), SW_SHOWNORMAL); ought to do it. HTH Stephen Posey [EMAIL PROTECTED] ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: similiar to opening a csv file in default program
I'm trying to pipe a DOS command to a file using a ShellExecute, but it doesn't create the output file. Here's the code: var D : string; ... D := GetStartDir; ShellExecute(0,pChar('ipconfig/all '),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL); ... but no file named 'harbor.txt' gets created. Does anyone know how to fix this? Thanks, Rich Brendan Blake wrote: ShellExecute works fine for me: (still on Delphi 5) ShellExecute(0,'open',PChar(filen),nil,nil,sw_ShowNormal); Where filen is a string containing the full path, filename and file type/extension (.csv) You need uses ShellAPI (I recall). My default application is Excel. Works fine. Maybe you have not got the registration correctly set up to your default application? Regards, Brendan. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Stebbing Sent: 03 July 2006 09:37 To: Delphi List Subject: opening a csv file in default program Hi All, I'd like to be able to launch a CSV file into Excel or whatever happens to be the default application to handle CSV's. I had though that I could just do a ShellEx or CreateProcess with the csv as the application name, but that doesn't seem to work. Can anyone advise how I might acheve this? Ta muchly, Chris. ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
TTreeView event for clicking on each node
Hi All, In D7, my Help file says there are no events for the TTreeView, and the TCustomTreeView has no events that process a click on a node. Digging a little further, I found the example about GetNodeAt(x,y), but the example uses the OnDragDrop event, which I don't want to use. Does anyone know how to perform a function whenever the user clicks on a specific node in a TTreeView? Confusedly, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
Indy 9 http server demo with D7
Hi All, I'm running the Indy v.9 HTTP server demo using D7. I just downloaded it from the Nevrona site, so it must be up to date. According to the comments, the server binds to 127.0.0.1, but when I put that URL ( http://127.0.0.1 ) into the IE browser, I get a HTTP 404 message that the page can't be found. I haven't made ANY changes to the demo source code - I just compiled it and ran and tried the browser. I also tried 192.168.0.1 but got my D-Link router instead of the Indy server. The system uses a cable modem with the D-Link router set at http://24.130.185.207/ but that address gives a 404 error also. The router WAN settings are: DHCP Client Connected IP Address 24.130.185.207 Subnet mask 255.255.252.0 Default Gateway24.130.184.1 DNS68.87.66.196,68.87.76.178 There is only the one computer (mine) on the LAN at the moment, but a laptop occasionally gets plugged in. Does anyone have a suggestion about how to get a browser connected to the running Indy server? Thanks, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
Re: D7 with Indy 9 http server again
Kraven wrote: If you connect to the net through a router or network/internet gateway you will need to set up a NAT or Port Forwarding rule to port all traffic on port 80 from the WAN to your machine's LAN IP. This means all incoming traffic on your WAN on port 80 (HTTP port) will go automatically to your machine... allowing you to run a HTTPServer program (just as I will be doing in 3 days for one of my websites) Hope that helps! Regards, Simon Yes, the NAT settings have to be right. Presently, my D-Link router has an WAN IP address of http://24.130.185.207/ but I can't get anything on my browser when I use that URL. In the D-Link virtual servers page, I've set up a virtual server at local IP 192.168.0.25 with port 1234. the virtual server page lists it at 192.168.0.25 with 1234/80, whatever that means. Note the .25 instead of .01. I THINK that it can't be .01 because that's my own desktop computer's IP address. Is that correct? Or should I change it to .01? Some little detail of this NAT setup escapes me at the moment. Thanks, Rich Kraven wrote In order to use HTTP on 127.0.0.1 (which is YOUR local LAN IP Address) you need to have IIS (Internet Information Services) installed on your machine this comes with the XP CD under Add Remove Programs in control panel. Note that most INDY server utilities are only for LAN communications and not Internet communications. Regards, Si Thanks Si, But the Indy http server does work on the internet - I had one working a couple years ago, but can't remember how I figured it out. But I do remember there was a lot of playing around with IP and Port addresses to get it working. The HTTP protocol doesn't know whether its on a LAN or a WAN. And the Indy server even uses threading to manage multiple requests. There is a way, I just haven't figured it out yet. If anyone can suggest a fix, please do so. Thanks, Rich - Original Message - From: Rich Cooper [EMAIL PROTECTED] To: Delphi-Talk Discussion List delphi-talk@elists.org Sent: Thursday, June 29, 2006 5:20 PM Subject: D7 with Indy 9 http server again A little more info: If the activate check box is clicked, an error message comes up saying Project HTTPServer.exe raised exception class EIdCouldNotBindSocket with message 'Could not bind socket. Address and port are already in use.' Process stopped. Use Step or Run to continue. So maybe there is something already using the 127.0.0.1 IP address. Does anyone know how the IP address can be changed? Thanks, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
Re: D7 with Indy 9 http server again
Kraven wrote: Rob, snip I'm only trying to help but if my help is not needed then I won't do so again. Regards, Simon I appreciate your help, Si, thanks for your suggestions, which are helping me think it through. And hopefully we can work the issue that's stopping the Indy 9 server. I'm using Indy 9 because I want the HTTP protocol, even if I never put up an HTML web site. The basic idea is to run tools on my home computer from work, and I need a reliable communication method to do it. Indy 9 provides that, and unlike the chat program, seems to be very stable according to anecdotal evidence and the few months I used one a couple years ago. Thanks, Rich __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
Re: D7 with Indy 9 http server again
Rob Kennedy wrote: 1. At a command prompt, run the command telnet localhost 80 2. You should get a blank console window. I do - that part works. Type the following: HEAD / HTTP/1.0 What you type might not get echoed back to the screen, so type it carefully. (You can always start over if you make a mistake.) As soon as I type HEAD, it goes to a bunch of squiggly characters and says 'connection lost', so this part doesn't work. I never get to the end of the line. Does that mean there is no server running? Thanks, Rich 3. After you type that line, press Enter twice. The blank line is what tells the server that the request is complete. For example, on my computer, I get the following response: HTTP/1.1 200 OK Date: Thu, 29 Jun 2006 18:01:33 GMT Server: Apache/2.2.2 (Win32) PHP/5.1.4 X-Powered-By: PHP/5.1.4 Connection: close Content-Type: text/html The Server field tells what server is running. You should get something similar to let you determine which program is running on your computer. By default, the TIdHTTPServer component uses a Server line that mentions Indy, but you'll want to change that as you write your own program. If you want to delay solving the problem and continue playing the the server demo, configure it to listen a port other than 80. Ports 8000 and 8080 are common choices. Then point your browser to http://127.0.0.1:8080/ instead of the usual address. (And remember to set the server component's Active property to True.) -- Rob __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk __ Delphi-Talk mailing list - Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk
Invalid property value
Hi All, I have two independent programs - both very large. Each one works fine as a stand alone program. But I want to add the program CAD, with main form fmCAD as a subform to the program GetAllHRSections. But when I try to run application.createform(TfmCAD, fmCAD), I get a Invalid property value exception from Forms. I'm using D7. The two programs are in completely separate directories. The call stack is hugely deep, and lots of DLLs are involved, so I have no visibility into why the error is occuring at present. There's probably a fairly simple answer that one of you gurus knows by heart. Can anybody share the answer with me? Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Delphi and Web blogs
Cord Schneider wrote: Hi Rich, At the time when the author had made that announcement, I recall [..] web based applications from within the Delphi environment without a steep learning curve Looking at their web site http://www.deltasoft.hr/rtc/index.htm I don't see any particular advantage over the free Indy components. Have you used the Indys in D7? I found those very easy to use. Why would RTC be a better choice than Indy? Because Indy doesn't easily do what Robert was originally intending. Indy is a fantastic component suite for developing low(er) level TCP/UDP projects - writing HTML servers, peer-to-peer clients, etc. - whereas Robert was looking for a way to use Delphi to serve his webpages. His solution would most likely lie in writing an ISAPI extension. For comparison, RTC's nearest competitors would be Atozed Software's IntraWeb, RemObjects Software's RemObjects SDK and Components4Developers' kbmMW. There may be others but I'm not currently aware of them and I welcome comment from other readers. Of those mentioned, RTC would most likely be the easiest to learn and would give Robert the best mileage - especially when combined with something like Zeos Database Objects for the MySQL access. An alternative to RTC would be the opensource project DelphiWebScript. But, this would require Robert to develop his ISAPI extension using Delphi's own built-in TWebModule. This approach has a steeper learning curve and is a nuisance to debug. RTC side-steps the debug issue by allowing one to create and debug one's code first as a webserver before converting it into a true ISAPI extension. Another issue for Robert to consider is that some ISPs won't allow you to place your own ISAPI extensions on their servers. It will depend on his hosting agreement with his ISP and he should check this before embarking on any development. Frankly though, based on his initial posted requirements, Robert should consider using the best tool for the job: PHP (he could use ASP but I'm afraid I'm not an MS pundit). Essentially all Robert wants is to serve several pages - some of which will have data retrieved from and sent to a MySQL database. PHP does this very well. My 5c worth, Cord Nicely stated. But if you would like to contribute another 5c worth, I still don't quite see how PHP is of such high value. I've studied some PHP tutorials, and seen only some examples for people who don't program. Do you have a reference URL for PHP with a MySQL database? A couple examples would be very useful. Thanks, Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Delphi and Web blogs
Hi John, At the time when the author had made that announcement, I recall feeling amazed that such a solid product was being offered for free. Yes it is that good. These components have allowed me to easily produce, test, and debug web based applications from within the Delphi environment without a steep learning curve. That there are not more than 30 licensed users can only be because the word has not gotten around. Kind regards, --Jon P. Grewer Looking at their web site http://www.deltasoft.hr/rtc/index.htm I don't see any particular advantage over the free Indy components. Have you used the Indys in D7? I found those very easy to use. Why would RTC be a better choice than Indy? -Rich ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi