Delphi

Why doesn't my program recognize mapped UNC paths?

筅森魡賤 提交于 2020-01-03 12:31:09
问题 I have some problems writing to a mapped network drive (P:) in Windows 7 from my Delphi program. When I try, for example, ForceDirectories('P:\test\folder') , I get an error (path not found). I have tried typing in the UNC path in the code ( ForceDirectories('\\computername\share\test\folder') ) and that works. However, ExpandUNCFileName('P:\') does not seem to work; it returns 'P:\'. On Windows XP, ExpandUNCFileName('P:\') returns the UNC path. How do I get the UNC path in Delphi on Windows

Delphi data structures

心已入冬 提交于 2020-01-03 11:45:36
问题 I maybe need to do a project in Delphi and are a beginner in that field. Currently, I am searching the net for ressources and get confused because there are so few resource sites. First of: can you give me some good websites with resources for Delphi I missed so far? I was also searching for data structures in Delphi and was wondering if there are cool classes like an ArrayList in Java or something like that? 回答1: exist many resources for a Delphi beginner, see theses questions in

Why does Indy Project HttpClient Get() give code 500 on some URLs which work fine in web browsers?

半腔热情 提交于 2020-01-03 11:04:04
问题 I have several URLs which work just fine in all browsers, but if I try to get the page content using Get() of the Indy Http client, it returns error code 500, internal server error. This is with the latest Indy SVN build (4981). Here is my example code. All that is needed for this is Delphi with Indy components and a form with a button and a memo. procedure TForm1.Button1Click(Sender: TObject); var HTTPCLIENT1: TIdHTTP; begin try try HTTPCLIENT1 := TIdHTTP.Create(nil); Memo1.Clear; with

Word 2010 automation: 'goto bookmark'

纵饮孤独 提交于 2020-01-03 11:02:14
问题 I have a program written in Delphi-7 which opens a new Word document which is based on a template. Once the document is open, the automation jumps to a bookmark (predefined in the template) and adds some text there. The following code works fine in Word 2003 but causes a invalid variant operation error message in Word 2010 (I have omitted try/except blocks for the sake of clarity) . wrdapp:= CreateOleObject ('Word.Application'); wrdDoc:= wrdapp.documents.add (wrdApp.Options.DefaultFilePath

Word 2010 automation: 'goto bookmark'

a 夏天 提交于 2020-01-03 11:02:10
问题 I have a program written in Delphi-7 which opens a new Word document which is based on a template. Once the document is open, the automation jumps to a bookmark (predefined in the template) and adds some text there. The following code works fine in Word 2003 but causes a invalid variant operation error message in Word 2010 (I have omitted try/except blocks for the sake of clarity) . wrdapp:= CreateOleObject ('Word.Application'); wrdDoc:= wrdapp.documents.add (wrdApp.Options.DefaultFilePath

Is there a easier way to define a Enum type based on a boolean value?

为君一笑 提交于 2020-01-03 10:59:08
问题 Overview Not entirely sure if the question is worded appropriately or not, but I previously asked this question which relates to this one: How do I correctly implement a Set in a class as a property? I like to keep code as short, minimal and readible as possible, and this is where I think some code could be written better but I am running into problems. An example first of 2 ways to read the value in a Set: The long way: if (Delphi1 in IDECompatibility) then CheckListBox1.Checked[0] := True;

NSIS Plugin “nsScreenshot” not working in Windows NT 6.x

人走茶凉 提交于 2020-01-03 10:45:26
问题 I added a code that was published 3 years later than original plugin, but it still returns error... Code is straight forward imho ... but still I most likely miss some aspect ... See this code: { nsScreenshot NSIS Plugin (c) 2003: Leon Zandman (leon@wirwar.com) Re-compiled by: Linards Liepins (linards.liepins@gmail.com) Code by: http://www.delphitricks.com/source-code/forms/make_a_desktop_screenshot.html (e) 2012. } library nsScreenshot; uses nsis in './nsis.pas', Windows, Jpeg, graphics,

NSIS Plugin “nsScreenshot” not working in Windows NT 6.x

无人久伴 提交于 2020-01-03 10:45:01
问题 I added a code that was published 3 years later than original plugin, but it still returns error... Code is straight forward imho ... but still I most likely miss some aspect ... See this code: { nsScreenshot NSIS Plugin (c) 2003: Leon Zandman (leon@wirwar.com) Re-compiled by: Linards Liepins (linards.liepins@gmail.com) Code by: http://www.delphitricks.com/source-code/forms/make_a_desktop_screenshot.html (e) 2012. } library nsScreenshot; uses nsis in './nsis.pas', Windows, Jpeg, graphics,

Is there a way to turn off the quiet mode in DCC32 called by MSBuild?

落花浮王杯 提交于 2020-01-03 09:47:10
问题 By default, the DCC32 compiler is called with the -Q switch that turns the quiet mode on. Is there a way to disable this switch in the .dproj file or by a command line parameter? I use msbuild for the build automation in my Delphi project. Unfortunately I can't find any reference to the DCC32 parameters when it is executed by MSBuild. Usually I first change a compiler parameter in the Delphi IDE and then check what was changed in the project file. However, this approach won't work for the

Why does Assigned return true for uninitialized variables?

柔情痞子 提交于 2020-01-03 09:46:25
问题 I read many posts on forum about pointers, Assigned function, Free function, FreeAndNil function, etc... I already know Free function don't remove the pointer reference to an object assigned and FreeAndNil does it... All posts I read treat this subject considering Create method already was executed, or in other words, considering an object already created. My question is: Why Assigned function returns true for a uninitialized object variable ? Follow an example: procedure TForm1.FormCreate