

mvanrijnen
Members-
Content Count
489 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mvanrijnen
-
Read and implement the required steps one by one: Get access without a user - Microsoft Graph | Microsoft Learn
-
[D11.2 VCL] Invalid Type Cast exception with inherited vcl controls
mvanrijnen posted a topic in VCL
Hi, Having a problem with an inherited control of TGroupBox/TCustomGroupBox the line var GroupBox := Control as TCustomGroupBox; in following Vc;.StdCtrls method goes wrong (Invalid typecast); The inherited control worked always in previois delphi versions, now are we gonna get a lot of problems like this? Other people stumbled up on this problem with inherited controsls? Better, someone knows how to quickly work around this problem? the code from vcl.stdctrl (D11.2): [edit] hmz, in a clean project it works, going to dig some more procedure TGroupBoxStyleHook.Paint(Canvas: TCanvas); var R, CaptionRect: TRect; Details: TThemedElementDetails; SaveIndex: Integer; LStyle: TCustomStyleServices; begin LStyle := StyleServices; if not LStyle.Available then Exit; PaintBackground(Canvas); CaptionRect := GetCaptionRect(Canvas); var GroupBox := Control as TCustomGroupBox; if GroupBox.ShowFrame then R := GetBoxRect(Canvas); if Control.Enabled then Details := LStyle.GetElementDetails(tbGroupBoxNormal) else Details := LStyle.GetElementDetails(tbGroupBoxDisabled); SaveIndex := SaveDC(Canvas.Handle); try ExcludeClipRect(Canvas.Handle, CaptionRect.Left, CaptionRect.Top, CaptionRect.Right, CaptionRect.Bottom); if GroupBox.ShowFrame then LStyle.DrawElement(Canvas.Handle, Details, R); finally RestoreDC(Canvas.Handle, SaveIndex); end; DrawControlText(Canvas, Details, Text, CaptionRect, Control.DrawTextBiDiModeFlags(DT_VCENTER or DT_CENTER)); end; -
[D11.2 VCL] Invalid Type Cast exception with inherited vcl controls
mvanrijnen replied to mvanrijnen's topic in VCL
fixed .... Was a trick for the custom component to paint like a GroupBox, so the GroupBoxStyleHook was registred for it. Made an own stylehook, and now it works 🙂 -
Indy HttpClient send JSON to https://login.microsoftonline.com/
mvanrijnen replied to marcin's topic in Indy
Glad Remy made it clear for you not to send JSON. I totally forgot about that 😉 -
Indy HttpClient send JSON to https://login.microsoftonline.com/
mvanrijnen replied to marcin's topic in Indy
// Line breaks for legibility only POST /{tenant}/oauth2/v2.0/token HTTP/1.1 Host: https://login.microsoftonline.com Content-Type: application/x-www-form-urlencoded client_id=11111111-1111-1111-1111-111111111111 &scope=user.read%20mail.read &code=OAAABAAAAiL9Kn2Z27UubvWFPbm0gLWQJVzCTE9UkP3pSx1aXxUjq3n8b2JRLk4OxVXr... &redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F &grant_type=authorization_code &client_secret=jXoM3iz... // NOTE: Only required for web apps No JSON -
Indy HttpClient send JSON to https://login.microsoftonline.com/
mvanrijnen replied to marcin's topic in Indy
I think you do not need to send JSON, take a look here: https://learn.microsoft.com/en-us/graph/auth-v2-user#3-get-a-token We do this (found on the internet), it's for TRestclient, but you can see how the body is composed : url := TURI.Create('http://localhost'); url.AddParameter('grant_type', 'refresh_token'); url.AddParameter('refresh_token', RefreshToken); url.AddParameter('client_id', ClientID); url.AddParameter('client_secret', ClientSecret); paramBody := LRequest.Params.AddItem; paramBody.Value := url.Query; paramBody.Kind := pkREQUESTBODY; paramBody.Options := [poDoNotEncode]; paramBody.ContentType := TRESTContentType.ctAPPLICATION_X_WWW_FORM_URLENCODED; -
RAD Server package running under dev but not in IIS
mvanrijnen replied to nufus42's topic in Network, Cloud and Web
ah, found them myself: from: Editing the Configuration of Your RAD Server Engine Manually - RAD Studio (embarcadero.com) -
RAD Server package running under dev but not in IIS
mvanrijnen replied to nufus42's topic in Network, Cloud and Web
Can you post an example of the section? Somehow we do not have it on our config at all? -
RAD Server package running under dev but not in IIS
mvanrijnen replied to nufus42's topic in Network, Cloud and Web
ah ok, maybe missing some DLL's or wrong versions of DLL's? * What we also do as test, is run the emsdevserver for the BPL on the IIS machine. (we were able to find/fix some problems with this) * Use procmon for get a view on which files are trying to be loaded, filter out the right process, view only files, look for errors on opening fils: Process Monitor - Windows Sysinternals | Microsoft Learn. I know on Radserver is hard to debug this kind of things, there is no logging of what goes wrong. I have read about enabling debugfile in the emsserver.ini but never found out how this works. (very bad documentation) -
mitm is also a localapp.
-
i use mitm proxy a lot, not a specific rest proxy, but you can see all the data flowing: mitmproxy - an interactive HTTPS proxy (mostly i use a compiler directives to force proxy use of my software, for debugging purposes, sometimes a confusion on monday mornings then, if you forget to start the proxy 🙂)
-
RAD Server package running under dev but not in IIS
mvanrijnen replied to nufus42's topic in Network, Cloud and Web
you could try fiddling with the SynchronizedEvents property REST.Client.TCustomRESTClient.SynchronizedEvents - RAD Studio API Documentation (embarcadero.com) -
i use about the same method in our planner (with a timeoffset and a flexible interval (as setting for the user)). function TframeEditFromTill.ComboToTime: TTime; begin Result := TimeOf(IncMinute(0, TimeOffSet + (cmbTimeTo.ItemIndex*EditTimeInterval))); end; * TimeOffSet is a integer property, just to have the possibility to force a mininum time * EditTimeInterval is a integer property, the interval in minutes e.g. 5, 15, 30
-
DelphiMVCFramework-3.2.2-nitrogen has been released
mvanrijnen replied to Daniele Teti's topic in Delphi Third-Party
gonna give it a try, with a small private project. btw bough the cookbook 😉 -
Ctrl+Click declaration fails but CTRL+G works (Delphi 11.2)
mvanrijnen replied to Brandon Staggs's topic in Delphi IDE and APIs
Had the same with clipboard (CTRL-C, CTRL-V, CTRL-X) in D10.xx etc, often exceptions with the rightclick-mouse method, always working through the IDE main menu. very very weird, have made rsp's in the paste about this kind of things, but have giving up hope about it. Maybe it get's fixed when we start paying 10times the price of Delphi as we do now, seems that the current price range is not high enough to garantee a reasonable working product. -
DelphiMVCFramework-3.2.2-nitrogen has been released
mvanrijnen replied to Daniele Teti's topic in Delphi Third-Party
Okay, looks very interesting, do people here at the forum have experiences with it ? Is it usable for production? -
POP, IMAP and SMPT with OAuth2 (Microsoft Office 365 services)
mvanrijnen replied to Milo G's topic in Network, Cloud and Web
We went from sending mail through smtp (office365) to the MS Graph interface. Basically, some rest services authenticated with OAUTH2 (register application in azure director), and sending message with json. (simple messages can go in 1 call, messages with big attachments take a bit more work). So with MSGRaph you can send as user with the user authenticating with OAUTH2, of send it from a registered application with clientid&secret etc. etc. user: sendMail - Microsoft Graph v1.0 | Microsoft Docs -
any body can write this code by delphi?
mvanrijnen replied to mofareh's topic in Network, Cloud and Web
..... or you ask Remy 🙂 -
any body can write this code by delphi?
mvanrijnen replied to mofareh's topic in Network, Cloud and Web
In that case, the code is not that difficult, as a Delphi developer you have to be able to do this for 99,9% on your own. So make your own code in Delphi, see if it works, if it doesn't, then post that Delphi code here for reviewing/tips/improvements. -
any body can write this code by delphi?
mvanrijnen replied to mofareh's topic in Network, Cloud and Web
you gonna need more then that code translated to delphi, Probably there will be some authentication/authorisation) things needed before you can post your data. ah, another WhatsApp api, see here tuturioals enough for other languages: WhatsApp API gateway for sending messages and chatbot - Ultramsg -
Try .ApplyStyleLookup
-
Postgresql in the cloud, possible for Desktop App?
mvanrijnen posted a topic in Network, Cloud and Web
Hi,just curious. Anyone experience with using PostgreSql in the cloud (eg google for example), for use in a Windows Desktop application? (have a small app, and the persons using it would like to use it on multiple locations, so i am looking for an easy way out 🙂.) -
Postgresql in the cloud, possible for Desktop App?
mvanrijnen replied to mvanrijnen's topic in Network, Cloud and Web
yes, i already use only SSL, but i think i go another way. I'm thinking of writing a custom server (using e.g. MARS framework), and then use a service like ngrOK to expose the services. only figure out how to keep it 100% private, put a certificate or something with secrets in it. -
Postgresql in the cloud, possible for Desktop App?
mvanrijnen replied to mvanrijnen's topic in Network, Cloud and Web
I know, but it's just a very small app (semi hobby). Besides that, i wonder if its so not done to go that direction (with which i basicly fully agree), why there are so many providers, exposing databases as a "cloudservice"? Other question, what would be the best way to make rest services available for a smapp app, (low cost), save and secure ? (at work we use radserver and all kinds of dedicated servers, firewalls, proxy's, certificates etc etc, can not do that for this small projetc) Without having to administer webservers, certificates etc. (somekind of appliance i can start in the cloud, upload a dll or cgi/isapi module and publish webservice, private&secure) (developed with Delphi, eg. MARS as rest framework) -
Postgresql in the cloud, possible for Desktop App?
mvanrijnen replied to mvanrijnen's topic in Network, Cloud and Web
I discovered there are some more PostgreSQL cloud providers (dedicated or shared). I'm testing with one now, looks ok right now. (i want to prevent rewriting the app to using rest api's etc, instead of querying the DB directly),