delphi - Cannot make DragAcceptFiles work when using a dialog box

I am using Delphi to code a simple app that needs to accept dropped directory names onto it. Though I am using Delphi, this program is straight Windows API (no VCL, no object oriented stuff) just as it would be in plain C.I had some code that already worked using a normal window (as created by CreateWindowEx). When I converted that code to use a dialog box, the drag and drop functionality broke and I cannot figure out why.This is (part of) the code I had that worked fine:function WndProc (Wnd : hWnd; Msg, wParam, lParam : DWORD) : DWORD; stdca...Read more

delphi - Strange filter behavior in DevExpress grid

I have a form with 2 grids showing records selected using master-detail option on Devart UniQuery. This working very nice showing the wanted records in detail that relates to master.I have the option to select records (companies) using a filter. This is done by 30 buttons with a letter on each and then when pressing one I set the filter with this codeprocedure TfrmJsCompanies.ButtonClick(Sender: TObject);var ButtonValue: char; FilterString: string;begin ButtonValue := (Sender as TcxButton).Caption[1]; FilterString := ButtonValue + '%'; wit...Read more

Chromium-embedded for Delphi - TChromiumOSR.OnPaint is not fired when a modal window is shown

I'm using the Off-screen rendering component TChromiumOSR in the dcef3 package - the Delphi wrapper for Chromium-embedded library.SituationFormA contains a TChromiumOSR and paints the output.Modal FormB modifies the web page by executing some js code against FormA.TChromiumOSR.IssueThe TChromiumOSR.OnPaint event (in FormA) is not triggered until FormB.ShowModal returns.NotesThere is no such issue in the above described situation (under a modal form) with the standard TChromium control.I assume the `TForm.ShowModal' method only blocks the input...Read more

delphi - Resizing bsNone Form when Vcl Styles Enabled

I'm trying to resize a non borderless form (bsNone border style). It can be done with the following code, but it worked only when the application has no a VCL style enabled. protected procedure WMNCHitTest(var message: TWMNCHitTest); message WM_NCHITTEST;....procedure TForm1.WMNCHitTest(var message: TWMNCHitTest);const EDGEDETECT = 7;var deltaRect: TRect;begin inherited; if BorderStyle = bsNone then with Message, deltaRect do begin Left := XPos - BoundsRect.Left; Right := BoundsRect.Right - XPos; Top := YPos - B...Read more

delphi - CreateFileMapping fails with hFile other than INVALID_HANDLE_VALUE

update - solved and answered, offending lines have been commented out Brief descriptionI am having a problem linking CreateFile with CreateFileMapping even though I use (GENERIC_WRITE or GENERIC_WRITE) for CreateFile, with PAGE_READWRITE for CreateFileMappingDetailed descriptionI am using CreateFileMapping to share memory between proceses.the actual mechanics of that is working fine, assuming I don't map to a physical file and instead use INVALID_HANDLE_VALUE for the first parameter to CreateFileMapping. This is fine, however what I'd like to a...Read more

delphi - How to immediately completely stop an application and show a message?

When my application needs to make an emergency stop, I could call Halt or ExitProcess to terminate it immediately. This shouldn't happen quietly, though; the user needs to be shown a message. Therefore I looked to FatalAppExit but was surprised that it keeps everything (timers, threads) running until the user has closed the dialog.I understand that showing a UI owned by the process requires the process to keep running. The UI does not need to be owned by my process, however. The dialog presented by FatalAppExit seems to be owned by Windows, eve...Read more

delphi - How can i get process suspended state?

I want to check the process is suspended or not in delphi.So I used the function below, but the function always return true.How can i check the process suspended??function ProcessExist(exeFileName: string): Boolean;var ContinueLoop: BOOL; FSnapshotHandle: THandle; FProcessEntry32: TProcessEntry32;begin FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); FProcessEntry32.dwSize := SizeOf(FProcessEntry32); ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); Result := False; while Integer(ContinueLoop) <>...Read more

delphi - Get name of default paper bin?

I got a list of paper bins, using the WinAPI functionality DM_BINNAMES, and I also got a list of valid source indexes using DM_BINS .But I would like to find out what the name of the default paper source is. How can I do this?My current code looks like this, but it doesn't work at all. dmDefaultSource has value 258, which is greater than the array bin.FPaperSourceIndex = -1; // defaultfunction GetDefaultPaperbinName: string;var pDevMode: PDeviceMode; bin: array[0..255,0..23] of char; i: DWORD; Res: DWORD; found: Boolean;begin GetPrinter(A...Read more

delphi - How to calculate CPU load by a thread?

I'd like to view how the thread loads CPU like it is made in ProcessExplorer. Number of thread CPU cycles can be retrieved by QueryThreadCycleTime, number of idle cycles - by QueryIdleProcessorCycleTime, but to know busy cycles I have to reiterate through all processes using QueryProcessCycleTime that I don't think is very efficient. Is there a simpler method of finding it?...Read more

winapi - Highlight controls in themed Delphi App with Delphi Tokyo

Using Delphi Tokyo 10.2, with Stylized Themes. I am trying to highlight components on the form, e.g., ComboBoxes, EditTexts, etc. For example, if a user entered invalid data, I would like to highlight the component. In the past, we just colored components Red, and the color persisted through resizes/movement/repaints in general. Now with theming, we need to do a bit more to get the color to show and persist. I have tried disabling each component's StyleElements [seFont, seClient, seBorder] properties to force show the color. This works but seem...Read more

delphi - Wrong colors extracted from TBitmap.Palette

I am trying to extract colors from 8 bit bitmap with the usage of TBitmap.Palette. My colors are messed up and I don't know why. I've created a simple visual test to compare results:Code that I am using:procedure TForm36.FormCreate(Sender: TObject);var LBitmap1, LBitmap2: TBitmap; LPaletteEntries: TMaxLogPalette; P1: PByteArray; P2: PRGBTriple; X,Y: Integer;begin {$POINTERMATH ON} LBitmap1 := TBitmap.Create; LBitmap1.LoadFromFile('E:\3x2x8.bmp'); img1.Picture.Assign(LBitmap1); LBitmap2 := TBitmap.Create; LBitmap2.Width := LBitmap1.Wi...Read more

delphi - How to filter executed apps in Windows?

I have a list of CRC32 or MD5 Checksums of some apps. I will disable the execution of this apps, from a delphi app. So, i need to create a system wide hook to CreateProcess (or CreateProcessW?), inside a DLL to make this Hook System Wide. And while my app is running, be notified for all executed apps, calculate their hash, compare with my list and allow/disallow their execution. Some tip of how make a Dll that create a hook for CreateProcess and use from a Delphi app?Thanks and sorry for my poor english !...Read more

delphi - Can MS Access 2007 support multiuser environment?

There is an application which is running on several machines(say roughly on 2).This application updates an shared mdb placed on network.Both users are trying to update the shared mdb at one time but the problem is only one user is able to update mdb at one time.Another user is not able to open it.Can anyone suggest that access support multiuser environment?edit:There is one form TFormRoadAttrib.When it activates following function is calledprocedure TFrmRoadAttrib.FormActivate(Sender: TObject);if dmTimeDomain <> nil then begin if no...Read more