I want to execute a TTakePhotoFromCameraAction in other procedure, but I can't.
I Tested with TakePhotoFromCameraAction1.Execute, TakePhotoFromCameraAction1.ExecuteTarget,..., but without success. Is it possible?
You cannot execute because TakePhotoFromCameraAction1.Enabled = False.
Please check this sample http://docwiki.embarcadero.com/RADStudio/XE8/en/Taking_Pictures_Using_FireMonkey_Interfaces
First: make sure that you able to work with Camera.
Related
I'm facing a problem I can't find the workaround...
I have a script which take some parameter data before execution. When I run it my code looks like:
Exec := FProgram.CreateNewExecution;
Exec.BeginProgram;
Exec.Info.ValueAsString['varName'] := 'varValue';
Exec.RunProgram(0);
Exec.EndProgram;
It runs just fine. But if I want to debug the script I do something like this:
Exec := FProgram.CreateNewExecution;
Exec.BeginProgram;
Exec.Info.ValueAsString['varName'] := 'varValue';
Debugger.BeginDebug(Exec);
Debugger.EndDebug;
Being Debugger a TdwsDebugger class, I get "runtime error: script is already running".
If I don't assign variables values before debugging everything is ok.
Any hints?
I managed to solve it using the TDelphiWebScript component events. Using OnExecutionStarted does not work either. I modified the code and added OnAfterExecutionStarted event, then I added the variables on the new event and everything is ok now.
After launching osk.exe with ShellExecuteEx() I would like to position the keyboard window relative to the data-entry fields, so that it doesn't cover them.
How do I set the window position for the osk before calling it?
Also, how can I have the application hide the osk when I am finished?
You can use FindWindow using the window class "OSKMainClass" to get the window handle, and then SetWindowPos on that handle to position it to the coordinates you want. (You may need to use the control's ClientToScreen method to convert to the proper coordinates, but I'll let you figure that part out.)
// Off the top of my head - not at a machine that has a Delphi compiler at
// the moment.
var
OSKWnd: HWnd;
begin
OSKWnd := FindWindow(PChar('OSKMainClass'), nil);
if OSKWnd <> 0 then
begin
SetWindowPos(OSKWnd,
HWND_BOTTOM,
NewPos.Left,
NewPos.Top,
NewPos.Width,
NewPos.Height,
0);
end;
end;
Code taken in part from a CodeProject article related to the same topic. I got the window class using AutoHotKey's Window Spy utility.
Notes:
Remy Lebeau points out in a comment that you should make sure to use CreateProcess() or ShellExecuteEx() so that you get back a process handle that can then be passed to WaitForInputIdle() before calling FindWindow(). Otherwise the call to FindWindow() may happen before OSK creates the window.
mghie points out in a comment that the only way he could get this to work was by running the app as Administrator; otherwise the call to SetWindowPos() resulted in an "Access Denied (5)".
I can,t move the window as mentioned above.
Using Win32 commands, SetWindow or MoveWindow not worked for on screen keyboard.
Its worked only while running exe in admin privilege.
I think its not a good solution.
I found another solution.
Please go through this.
After trying using registry values its worked well i can move on screen keyboard in my application
try
{
RegistryKey myKey = Registry.CurrentUser.OpenSubKey(#"SOFTWARE\Microsoft\Osk", true);
myKey.SetValue("WindowLeft", oskLeft, RegistryValueKind.DWord);
myKey.SetValue("WindowTop", oskTop, RegistryValueKind.DWord);
}
catch
{
//Log the error
}
What I try to do is to hide the desktopicons.
I have a hack that works but I want to do it the proper way, using SHGetSetSettings.
The thing is that after calling SHGetSetSettings, the record is filled with zeros!
procedure GetDesktopData;
var
lpss: tagSHELLSTATEW;
begin
ZeroMemory(#lpss, SizeOf(lpss));
SHGetSetSettings(lpss, SSF_HIDEICONS, FALSE); { TRUE to indicate that the contents of lpss should be used to set the Shell settings, FALSE to indicate that the Shell settings should be retrieved to lpss. }
end;
What am I doing wrong? Why the record was not filled with data?
I have Windows 7.
This question is similar to this one Calling SHGetSetSettings from Delphi, but not identical. That question discusses the structure for calling SHGetSetSettings from Delphi 2010. The function and the afferent structure is now present under Delphi xE (but still not working).
Solution provided by TLama.
I tried with many versions of MAPISend, but I everytime got error in one place.
The MAPILogon returns with errorcode 1.
dwRet := MapiLogon(Handle,
nil,
nil,
MAPI_DIALOG or MAPI_NEW_SESSION,
0, #MAPI_Session);
I tried with "MAPISend component", this code:
http://prog.hu/tudastar/60044-6/Delphi-Email+csatolt+file+thunderbird.html
and 2 of others.
Interesting, that Acrobat Reader CAN use the MAPI with Attach to email function, and the "Send" "In Mail" context menu also working.
I don't understand why it isn't working, in my machine (Win7) it is working fine.
Then machines where I failed have WinXP OS, and they used Thunderbird.
What I can do to successfully logon into MAPI?
THanks:
dd
I think I found the problem.
The problem, that Delphi needs a Registry value named MAPI under
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem"
If this not present, it send 1 error code to you what is the base of the confusion.
This value must be string. The sysadmin wrote DWORD, and this caused the problem.
Thanks for your help:
dd
I am using RapWare components, http://www.rapware.nl/
Hth's.
Stanko.
I'm not sure about any Delphi-specific issues, but you don't need to call MAPILogon before calling MAPISendMail. If you do, I wouldn't check the return value. That's why Acrobat Reader was working and your SMAPI client was not.
I am pretty sure I have seen this before, but I haven't found out / remembered how to do it. I want to have a line of code that when executed from the Delphi debugger I want the debugger to pop-up like there was a break point on that line.
Something like:
FooBar := Foo(Bar);
SimulateBreakPoint; // Cause break point to occur in Delphi IDE if attached
WriteLn('Value: ' + FooBar);
Hopefully that makes sense. I know I could use an exception, but that would be a lot more overhead then I want. It is for some demonstration code.
Thanks in advance!
To trigger the debugger from code (supposedly, I don't have a copy of delphi handy to try):
asm int 3 end;
See this page:
http://17slon.com/blogs/gabr/2008/03/debugging-with-lazy-breakpoints.html
As Andreas Hausladen stated in comments to that artice, Win32 API DebugBreak() function is less DOS-ish and works equally well.