[Lazarus] Windows context menu for files and directories

2014-07-26 Thread Jürgen Hestermann

From internet sources (mostly from
http://bcbjournal.org/articles/vol4/0006/Using_the_shell_context_menu.htm )
I have scraped together a routine to display
the Windows context menu for a given file or directory name (see below).
This works okay but (at least) one issue appears:

On Windows XP, when clicking on the context menu entry Send to another submenu 
Send to
is shown instead of a list of programs to select. When clicking on this second Send 
to nothing happens.
On Windows 7 everything works ok and the list of programs is displayed!
Also, selecting other entries like Properties work ok on both platforms.

Any Windows gurus who know why this is the case (and how to fix it)?



//-
procedure FileShowContextMenuOK(Handle : HWND; const Path,Name : UTF8String; 
const PosX,PosY : SizeInt);
var DesktopFolder : IShellFolder = nil;
ParentFolder  : IShellFolder = nil;
Attr,
Eaten,
Flags : DWord;
B : WinBool;
CM: IContextMenu;
CI: TCMINVOKECOMMANDINFO;
hM: HMENU;
WidePath,
WideName  : WideString;
Pidl,
ParentPidl: LPITEMIDLIST;

begin // FileShowContextMenuOK
SHGetDesktopFolder(DesktopFolder);
if not assigned(DesktopFolder) then
   Exit;
WidePath := UTF8Decode(Path);
Attr := 0;
if 
DesktopFolder.ParseDisplayName(Handle,nil,pwidechar(WidePath),Eaten,ParentPidl,Attr)0
 then
   Exit;
if DesktopFolder.BindToObject(ParentPidl,nil,IID_IShellFolder,ParentFolder)0 
then
   Exit;
WideName := UTF8Decode(Name);
if 
ParentFolder.ParseDisplayName(Handle,nil,pwidechar(WideName),Eaten,Pidl,Attr)0
 then
   Exit;
if ParentFolder.GetUIObjectOf(Handle,1,Pidl,IID_IContextMenu,nil,CM)0 then
   Exit;
hM:= CreatePopupMenu;
Flags := CMF_EXTENDEDVERBS; //CMF_EXPLORE; // CMF_NORMAL; //CMF_ASYNCVERBSTATE; 
// CMF_EXPLORE;
CM.QueryContextMenu(hM,0,1,$7FFF,Flags);
B := TrackPopupMenu(hM,TPM_LEFTALIGN or TPM_LEFTBUTTON or TPM_RIGHTBUTTON or 
TPM_RETURNCMD { or TPM_NONOTIFY or TPM_RETURNCMD},
PosX,PosY,0,Handle,nil);
if not B then
   exit;
fillchar(CI,sizeof(CI),0);
with CI do
   begin
   cbSize   := SizeOf(CI);
   lpVerb   := MAKEINTRESOURCE(Integer(B)-1);
   lpParameters := '';
   lpDirectory  := '';
   hwnd := Handle;
   nShow:= SW_SHOWNORMAL;
   end;
CM.InvokeCommand(CI);
CoTaskMemFree(Pidl);
CoTaskMemFree(ParentPidl);
end;  // FileShowContextMenuOK
//-


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] SpinEdit on Delphi question (related to bug 26488)

2014-07-26 Thread Bart
Hi,

I'm trying to fix issue http://bugs.freepascal.org/view.php?id=26488
For this I need to know how Delphi behaves in following situations:

Given that SE is a TFloatSpinEdit (if Delphi only has SpinEdit this
will do as well):
Given that SE.Value is set to 10 at design time.

Now do (in code @runtime):

SE.Text := 'abc'; //obviously invalid number
After that what is the content of SE.Value?
Is it 10 or 0 or something else? (in D3 with a SpinEdit it is 0.)

Same question if you do SE.Clear as the first step.

Bart

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SpinEdit on Delphi question (related to bug 26488)

2014-07-26 Thread Vojtěch Čihák

Hi,
 
on Delphi7, when I do SpinEdit1.Text:='abc'; then it fairly contains abc :-). 
But when I try to spin it, it raises exception: abc is not integer value.
 
Vojtěch 
__

Od: Bart bartjun...@gmail.com
Komu: Lazarus mailing list lazarus@lists.lazarus.freepascal.org
Datum: 26.07.2014 16:42
Předmět: [Lazarus] SpinEdit on Delphi question (related to bug 26488)


Hi,

I'm trying to fix issue http://bugs.freepascal.org/view.php?id=26488 
http://bugs.freepascal.org/view.php?id=26488
For this I need to know how Delphi behaves in following situations:

Given that SE is a TFloatSpinEdit (if Delphi only has SpinEdit this
will do as well):
Given that SE.Value is set to 10 at design time.

Now do (in code @runtime):

SE.Text := 'abc'; //obviously invalid number
After that what is the content of SE.Value?
Is it 10 or 0 or something else? (in D3 with a SpinEdit it is 0.)

Same question if you do SE.Clear as the first step.

Bart

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SpinEdit on Delphi question (related to bug 26488)

2014-07-26 Thread Bart
On 7/26/14, Vojtěch Čihák vojtech.ci...@atlas.cz wrote:
 Hi,

 on Delphi7, when I do SpinEdit1.Text:='abc'; then it fairly contains abc
 :-). But when I try to spin it, it raises exception: abc is not integer
 value.

OK, but that doesn't answer the question:

SE.Text := 'abc';
Caption := 'Value = ', + FloatToStr(SE.Value);

Bart

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SpinEdit on Delphi question (related to bug 26488)

2014-07-26 Thread Vojtěch Čihák

This
 

Caption := 'Value = ', + FloatToStr(SE.Value);

 
raises the same exception, EConvertError, not a integrer value.
 
Vojtěch 
__

Od: Bart bartjun...@gmail.com
Komu: Lazarus mailing list lazarus@lists.lazarus.freepascal.org
Datum: 26.07.2014 17:08
Předmět: Re: [Lazarus] SpinEdit on Delphi question (related to bug 26488)


On 7/26/14, Vojtěch Čihák vojtech.ci...@atlas.cz wrote:

Hi,

on Delphi7, when I do SpinEdit1.Text:='abc'; then it fairly contains abc
:-). But when I try to spin it, it raises exception: abc is not integer
value.


OK, but that doesn't answer the question:

SE.Text := 'abc';
Caption := 'Value = ', + FloatToStr(SE.Value);

Bart

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SpinEdit on Delphi question (related to bug 26488)

2014-07-26 Thread Bart
On 7/26/14, Vojtěch Čihák vojtech.ci...@atlas.cz wrote:
 This

Caption := 'Value = ', + FloatToStr(SE.Value);

 raises the same exception, EConvertError, not a integrer value.

Thanks.
This proves that Delphi sucks ;-)

Bart

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread ABorka

There is some information on what Michael mentions below here:

http://forum.lazarus.freepascal.org/index.php/topic,13312.15.html

It might help a little. The linked post has some explanation on the 
different (3 ways) FCGI solutions with apache and fpc/lazarus.


AB

On 7/26/2014 05:47, Michael Van Canneyt wrote:



On Sat, 26 Jul 2014, Reimar Grabowski wrote:


Hi,

first of all, sorry if the information is out there, but I did not
find anything usefull to help me along.

I need to build a server-side application (fcgi is my choice) that
gets send some json, processes it and communicates with a mysql
database, simple enough.
Looks like all this is perfectly doable without any problems with
Lazarus and fcl-web, at least the 'gets send some json and processes
it'-part I have already done for another project.
But it was a pain to develop.
For such kind of projects I am used to Java and development in Eclipse.
My major problem with Lazarus is where is my server?


That depends.


In Eclipse I just configure my Tomcat or whatever other container I
want to use, press 'run on server' and voila, eclipse starts Tomcat
and my application with full logging working inside the IDE to be
found at 'http://localhost:8080/myapp'.
If I need breakpoints or single stepping, I just start the server in
debug mode and all is well.
So how do I configure Lazarus to do about the same?


It depends on how you set it up.


I found some mentioning of fpembweb or lazaruswebdesign packages but
nothing concrete about where to find or how to use them.
Surely some of you guys do such kind of development with Lazarus and I
cannot believe that everybody runs a local apache and copies his
executable around after every compile (my apache is on a VM which made
it even more work to copy the files around and there was no debugging
capability to speak of).
So it boils down to let Lazarus run the fcgi app (can be another app
type if it is easy to switch it to fcgi for deployment) on an
(embedded) server, with logging output shown in the IDE and the option
to use a debugger with breakpoints and single stepping.


There are 2 options:

1. Use embedded server to do the debugging; that part is easy, it's like
running a normal executable.
You don't need apache for this.

2. You can run the fastcgi server if you use mod_fastcgi.so, but then
you must use the ExternalFastCGIServer option, and configure the fastcgi
application to listen on this port:

In Apache, configure
FastCgiExternalServer /home/michael/public_html/testht -host
127.0.0.1:10020 -idle-timeout 3 -flush
Here 10020 is the port to listen on, and
/home/michael/public_html/testht is the URL that will be the 'base' url
for your fastcgi app.


In that case, your fastcgi application must be configured to listen on
the same port:
Set
Application.Port:=10020;
in the project source file.

Restart apache, run your executable, and do a request through the
browser. That's it.

Note that you cannot do this with the mod_fcgid module. I do believe
that in Apache 2.4, mod_proxy can handle this situation, but I haven't
tried yet.

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread leledumbo
 My major problem with Lazarus is where is my server? 
 So how do I configure Lazarus to do about the same? 

Up to you. Apache, nginx, any other you've ever heard of, fphttpserver
(embedded), the choice is yours. The last is capable of debugging from IDE.
If you use the Lazarus wizard, you should've found it in the application
type selection dialog. But actually they only differ in uses clause (fpcgi,
fpfcgi, fphttpapp), everything else is the same. Well, maybe you need to set
Port as well but that's all. Practically this applies to ALL fcl-web
examples, so you can try it yourself.



--
View this message in context: 
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Developing-with-fcl-web-tp4038075p4038085.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread Reimar Grabowski
On Sat, 26 Jul 2014 14:47:07 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:

 There are 2 options:
 
 1. Use embedded server to do the debugging; that part is easy, it's like 
 running a normal executable.
 You don't need apache for this.

That's what I am looking for. The 'use embedded server' part is what I failed 
to understand how to do. But leledumbos mail (hopefully) cleared things up. I 
was expecting the server, to be started by Lazarus and not that it is a 
different option in the 'New Project' wizard.
 
 2. You can run the fastcgi server if you use mod_fastcgi.so, but then you 
 must use the ExternalFastCGIServer option, and configure the fastcgi 
 application to listen on this port:

Although this is not what I am currently looking for, it's appreciated for 
future reference.
It's always good to have options.

Thanks.
R.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread leledumbo
 I tried this on my older CGI Application, changing the uses clause in the
.lpr file to 'fphttpapp'. Compiled without a problem but of course I could
not run it in Lazarus since the run button/menu entry is disabled.

Check Project Options-Miscellanous-Project Is Runnable. CGI wizard
automatically uncheck this because it makes no sense for CGI.

 Running on the command line gave a socket error which looks like it is
 working (perhaps changing the port from 80 to something else fixes this).

I don't remember whether the default is 80 or not, I always set it
explicitly via Application.Port.

 If it's that simple why is it that hard to get that information. Please,
 tell me I am stupid and there is a wiki page that I just did not find.

Perhaps it's your turn to contribute to fcl-web wiki article :)

P.S.: If you use Nginx or any other web server whose FastCGI executable must
be started manually, you can also debug from IDE



--
View this message in context: 
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Developing-with-fcl-web-tp4038075p4038088.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing with fcl-web

2014-07-26 Thread Reimar Grabowski
On Sat, 26 Jul 2014 14:45:15 -0700 (PDT)
leledumbo leledumbo_c...@yahoo.co.id wrote:

 Perhaps it's your turn to contribute to fcl-web wiki article :)
Added to todo list.

R.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus