delphi-2009

Access Violation in function CreateProcess in Delphi 2009

雨燕双飞 提交于 2019-11-27 14:02:30
问题 In my program I've the following code: //Code if not CreateProcess(nil, NonConstCmd, nil, nil, True, NORMAL_PRIORITY_CLASS or CREATE_NEW_PROCESS_GROUP, nil, PCh, SI, P) then //Code And I keep getting Access violation error. By the way, in Delphi7 the same code works perfectly. I've read MSDN and found that CreateProcess function in Delphi can modify the second argument. Inititally It was const, that's why I create a new variable with the same value. But it takes no effect. The question is:

What are major incentives to upgrade to D2009 (Unicode excluded)?

≡放荡痞女 提交于 2019-11-27 13:46:09
I'm a hesitant upgrader when it comes to development tools. For roughly half of my product I still use D7, and for others D2006. The truth is, although Unicode support is more than welcomed and very useful, it could cause me more troubles than gains with my current projects (they are more-or-less Unicode ready already). It's especially case with one of them who's performance would suffer a lot if each string takes twice as much memory as before. So, Unicode aside, what are other major incentives to upgrade? Bruce McGee To put things in to perspective, look at the things that were added between

Why does ReadDirectoryChangesW omit events?

馋奶兔 提交于 2019-11-27 11:59:06
I use ReadDirectoryChangesW to watch a specified directory and update indexing structures whenever a change is detected. I use the following code (roughly) var InfoPointer : PFileNotifyInformation; NextOffset : DWORD; ... while (not Terminated) do begin if ReadDirectoryChangesW (FDirHandle, FBuffer, FBufferLength, True, FFilter, @BytesRead, @FOverlap, nil) then begin WaitResult := WaitForMultipleObjects (2, @FEventArray, False, INFINITE); if (WaitResult = waitFileChange) then begin InfoPointer := FBuffer; repeat NextOffset := InfoPointer.NextEntryOffset; ... PByte (InfoPointer) := PByte

How do I make a PNG resource?

断了今生、忘了曾经 提交于 2019-11-27 11:14:10
I've got a form with a large TImage on it as a background. Problem is, this is stored directly in the DFM as a bitmap, which takes up about 3 MB. The original PNG file is ~250K. I'd like to try to reduce bloat by embedding the PNG in a resource, and then having the form load it during OnCreate. I can do that now that Delphi 2009 includes PNG support, except I don't quite know how to build a resource file with a PNG in it. Anyone know how that's done? Example text file (named myres.rc): MYPNG RCDATA mypng.png Added to project: {$R 'myres.res' 'myres.rc'} Example of loading at runtime: uses

Getting Allen Bauer's TMulticastEvent<T> working

。_饼干妹妹 提交于 2019-11-27 10:10:02
问题 I've been mucking around with Allen Bauer's code for a generic multicast event dispatcher (see his blog posts about it here). He gives just enough code to make me want to use it, and unfortunately he hasn't posted the full source. I had a bash at getting it to work, but my assembler skills are non-existent. My problem is the InternalSetDispatcher method. The naive approach is to use the same assembler as for the other InternalXXX methods: procedure InternalSetDispatcher; begin XCHG EAX,[ESP]

EProgrammerNotFound exception in Delphi?

倾然丶 夕夏残阳落幕 提交于 2019-11-27 09:48:09
问题 In Delphi 2009, SysUtils.pas contains this in line 425: EProgrammerNotFound = class(Exception); Is this simply an easter egg or something serious? When should this exception be raised? Does it also exist in Delphi Prism and/or Free Pascal? Q: Is this exception class still declared in Delphi (currently XE7)? A: Yes, and it is even documented! Nonstandard way to indicate software faults. You can use EProgrammerNotFound as an alternative to indicate software faults detected at run time. 回答1: It

How to cast a Interface to a Object in Delphi

◇◆丶佛笑我妖孽 提交于 2019-11-27 09:05:18
In delphi 2009 I have a reference to a IInterface which I want to cast to the underlying TObject Using TObject(IInterface) obviously doesn't work in Delphi 2009 (it's supposed to work in Delphi 2010 though) My searches lead me to a function that should do the trick , but it doesn't work for me, I get AV's when I try to call methods on the returned object. I can't really modify the Classes and I know that this breaks OOP Instead of relying on Delphi's internal object layout you could also have your objects implement another interface which would simply return the object. This, of course, only

Delphi 2009: How to communicate between Windows service & desktop application under Vista?

我只是一个虾纸丫 提交于 2019-11-27 07:55:27
How can a desktop application communicate with a Windows service under Vista/Windows2008/Windows7? The application needs to send small strings to the service and receive string responses back. Both are written in Delphi 2009. (Please provide sample code also) The way to go is named pipes , you'll probably have to take a look at the communication across different Integrity levels . This article explores how to do this in vista. Although it's written in c++ it's just basic Windows API calls, so it should translate fast enough to Delphi. If you want to search for more on this subject, this

How to use MS UI Automation in Delphi 2009

不问归期 提交于 2019-11-27 07:26:38
问题 I have a C# application, which uses Microsoft UI Automation functionality, e. g. a call like AutomationElement.RootElement.FindFirst(...) . Now I need to do the same thing (use MS UI Automation) in Delphi 2009. How can I a) declare that my Delphi code uses MS UI Automation library and b) make calls like AutomationElement.RootElement.FindFirst(...) ? There are several tutorials (tutorial 1, tutorial 2) explaining how to package one's own .NET code so that it can be used with Delphi, but in my

Let components dropped on my control in the IDE become children of my control

孤街醉人 提交于 2019-11-27 07:12:07
问题 I have a descendant of TWinControl (in fact it is just that for now) and I registered it as a component in the IDE: type TGroupPanel = class(TWinControl); But when I drop other components on it, they attach to the form instead of to my control. In other words, I want my custom control to behave like a TPanel so that components dropped on it become its children. If I create the components at runtime and assign them manually to my control, like in the code below, then it works: TForm1 = class