-
Content Count
135 -
Joined
-
Last visited
-
Days Won
1
Everything posted by rvk
-
Well... Type in Oauth 2.0 communication in Google (or similar search terms), then select Images... and there you go... Lots of flow diagrams
-
BTW. You can still use app-passwords with Google. So if you are only doing this for you own account, creating an app password is easiest. If you need to allow your users to use their own account, then you need OAuth2.
-
No no, because you want to catch that URL it's easiest to create your own listening thread. I have an example for OAuth2 in combination with Lazarus/FPC and Synpase. (You can also use Synapse on Delphi but you could also use Indy) https://github.com/rvk01/google-oauth2 Relevant snippet: This is a minimalistic http server which server a string saying your program now has access and you can close the window. type THTTPServerThread = class(TThread) private ListenerSocket: TTCPBlockSocket; ConnectionSocket: TTCPBlockSocket; public Authorize_token: string; procedure Execute; override; procedure CancelThread(Sender: TObject; var CanClose: boolean); end; procedure THTTPServerThread.CancelThread(Sender: TObject; var CanClose: boolean); begin Terminate; end; procedure THTTPServerThread.Execute; var S: string; method, uri, protocol: string; OutputDataString: string; SendDataString: string; begin Authorize_token := ''; FreeOnTerminate := False; ListenerSocket := TTCPBlockSocket.Create; ConnectionSocket := TTCPBlockSocket.Create; try ListenerSocket.CreateSocket; ListenerSocket.setLinger(True, 10); ListenerSocket.Bind('localhost', '1500'); ListenerSocket.Listen; while not terminated do begin Sleep(1000); // Application.ProcessMessages; if ListenerSocket.CanRead(1000) and not terminated then begin ConnectionSocket.Socket := ListenerSocket.Accept; // read request line S := string(ConnectionSocket.RecvString(1000)); method := fetch(S, ' '); uri := fetch(S, ' '); protocol := fetch(S, ' '); // read request headers repeat S := string(ConnectionSocket.RecvString(1000)); until S = ''; // /?code=4/fegArZQDUJqFdoCw-1DU16ohYsoA5116feRuCW0LiuQ // /?error=access_denied Authorize_token := ''; if Pos('code=', uri) > 0 then begin Authorize_token := Copy(uri, Pos('code=', uri) + 5); end; if Authorize_token = '' then begin SendDataString := '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' + ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + CRLF + '<html><center><h1>Something went wrong.<br><br>Application does not have access.<br><br>You can close this page.</h1></center></html>' + CRLF; end else begin SendDataString := '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' + ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + CRLF + '<html><center><h1>Application now has access.<br><br>You can close this page.</h1></center></html>' + CRLF; end; OutputDataString := 'HTTP/1.0 200' + CRLF; OutputDataString := OutputDataString + 'Content-type: Text/Html' + CRLF; OutputDataString := OutputDataString + 'Content-length: ' + IntToStr(Length(SendDataString)) + CRLF; OutputDataString := OutputDataString + 'Connection: close' + CRLF; OutputDataString := OutputDataString + 'Date: ' + Rfc822DateTime(now) + CRLF; OutputDataString := OutputDataString + 'Server: Synapse' + CRLF; OutputDataString := OutputDataString + '' + CRLF; ConnectionSocket.SendString(ansistring(OutputDataString)); ConnectionSocket.SendString(ansistring(SendDataString)); ConnectionSocket.CloseSocket; Terminate; end; end; finally ConnectionSocket.Free; ListenerSocket.Free; end; end;
-
This error page seems to be a step further in the normal OAuth2 process. You accepted the non-verified app, accepted the terms and now you end up on localhost with the desired code for getting the access token in the url parameters. You need to catch that url with a small http server. After getting that code from the url you can go ahead with the process of getting the access and refresh token.
-
O, now I see what you are doing. But if the TPanel is below the TDBGrid then this line is wrong: RecPanel.Parent:=TDBGrid(AOwner); Because the parent isn't TDBGrid but the owner of TDBGrid (which is TForm or TPanel or something). So the AOwner parameter in the create call isn't the TDBGrid itself. You probably get away with it because casting TForm to TDBGrid will point to the same TWinControl object which is stored in TPanel.Parent. But the cast like this is not correct. You probably want to do something like: RecPanel.Parent:=TWinControl(AOwner); But then you need to create TEnhDBGrid with the Form as Owner !! (which is default but not always guaranteed). You might want to do RecPanel.Parent:=Self.Parent; // this would be the same parent as the TDBGrid But that goes wrong because if you create the component dynamically (like I tried) you don't have a parent yet (because that's assigned after TEnhDBGrid.Create(Formx) call). Anyway... you also can't do TEnhDBGrid.Align := alClient now because the dangling panel below it would be out of view That's why it might be more stable if a complete container is created with a TDBGrid and TPanel inside it. Just a thought BTW. You could also do it like TJvDBGridFooter does. (just a inherited TStatusbar where you can define columns which get summed up). But there the TJvDBGridFooter and TDBGrid are really separated from each other (component wise) and it's up to the programmer to place the TJvDBGridFooter.
-
Do you want that panel over the TDBGrid? That would mean interference when using scrollbar and last record etc. It might be better to do a complete TPanel and create the lower TPanel (alBottom aligned) with recordcount and a TDBGrid with alClient aligned. You could even use a sort of TStatusbar. With correct alignment (or correct anchors) all your sub-components should resize automatically with the container. I used my own statusbar for showing recordcount. I also implemented a OnScroll event to check if the TDataset has already reached the EOF. If it didn't, then you can't be certain of the recordcount and you can indicate that with a + after the count. Once TDataset.EOF has been reached, the TDataset.Recordcount is accurate (and the + can be dropped). At least... that's how I do it.
-
So, you have an underlying dataset where RecordCount is always accurate when there are more records then in view? Because often TDataset.RecordCount isn't the actual count of records in the final result. In that case you would need to show something like: 1/4+ or 1/>4 (Or do a TDataset.Last + TDataset.First after opening to get the correct RecordCount)
-
If you need IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY flag (which seems to be required in some cases) then you do need it. For example Windows kernel drivers (??). https://learn.microsoft.com/en-us/archive/technet-wiki/255.forced-integrity-signing-of-portable-executable-pe-files
-
XE3 was the first to support Windows 8. Delphi 2009 was the first to support Windows 7. see https://nl.wikipedia.org/wiki/Delphi_(software) So finding the highest versions supported is not difficult. But are you more interested in the lowest version? For Windows XP it was always advised to upgrade to at least SP2 from very early on. Do you still have machines with SP1 or even without SP ?? From an old Delphi XE PDF (at the bottom): http://www.embarcadero.com.pl/produkty/starter-tools/xe/delphi-data-sheet.pdf
-
No, unfortunately TWebBrowser.Document isn't available for FMX. https://stackoverflow.com/a/41853823/1037511
-
Ah, ok. I thought the default for DoubleBuffered was true. But I am probably mistaken (it is true in Lazarus unless in a remote session but apparently not in Delphi).
-
You didn't set DoubleBuffering to false for the TFrame itself (at least not in the code I saw). So if there (for TFrame) it is still true, then SingleBufferingInRemoteSessions = false would make the difference.
-
Woops, sorry. The Application.SingleBufferingInRemoteSessions is true as default. You should try to set it to false so the RDP acts the same as without RDP regarding doublebuffering. http://docwiki.embarcadero.com/Libraries/Alexandria/en/Vcl.Forms.TApplication.SingleBufferingInRemoteSessions
-
Yes. So you could set SingleBufferingInRemoteSessions to true to test if enabling DoubleBuffering in RDP would help. (turning on DoubleBuffering manually doesn't have effect if SingleBufferingInRemoteSessions is still set to false) If it doesn't help, then it must be something else.
-
https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Double-buffering_and_Remote_Connections
-
PS. You testproject in your openingspost works for me (Compiled on Delphi 10.2, Windows 10 and RDP'ing to a Windows 10 Hyper-V). Panel show solid (without memo1 bleeding through).
-
Could be related to this: WS_EX_LAYERED window appearing invisible over RDP Or with Alpha blending https://duckmaestro.com/2010/06/06/per-pixel-alpha-blending-in-win32-desktop-applications/
-
Weird, I would expect just the opposite (solid in rdp and transparent locally). What are the settings under the Experience tab in your RDP connection? Ser it to highest speed and disable bitmap caching and see if that helps.
-
Delphi CE application accesses unknown IPs
rvk replied to everybyte's topic in Network, Cloud and Web
The real question is: Does the program REALLY access those IPs? It could be that virustotal just analyses the code and sees some unreachable code that could access those IPs. Maybe it's never called. The only way to be sure is to check it yourself (as mentioned before). -
Wait... did I really overlook that file... Aaaargh. Yes, it's in the root.
-
Why is the date of the files on Fulgan updated each night? Also, there seem to be trickling new versions in there occasionally. Maybe a readme file there pointing to the new official spot (or at least stating it is decommissioned) would make that more clear.
-
Yeah, I never used those from slprowen. They only provide an executable with god-knows-what build in. Quote from this site https://wiki.overbyte.eu/wiki/index.php/ICS_Download The indy.fulgan.com ones (same as the one you now use) never gave me problems.
-
Where did you get the openssl-1.0.2u dlls from? As I understand it there could be version with and without the dependencies to those Microsoft DLLs. From https://wiki.openssl.org/index.php/Binaries (the indy.fulgan.com ones shouldn't have any dependency):
-
Maybe its the default font but it definitely displayed differently (look at the capitol G which is different). So maybe there is still some font substitution going on. You can first look in this registry entry to see if that font is substituted. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes Btw. You showed the font for a tlabel. But if the parentfont prop is true, it will take the font from the form. And it could be that for that the screen.font is used which might use the default menu font from windows. If that's the case you might want to do a Application.DefaultFont.Name := 'MS Sans Serif'; (or other font) before creating any forms in your .dpr).
-
It might not be the default font MS Sans which is used. Or there is some font substitution going on. If you look at the image, you definitely see the fonts are different.