Delphi

How can I write a Delphi program to control the CPU fan speed and monitor the temperature?

 ̄綄美尐妖づ 提交于 2020-01-01 06:38:55
问题 I want to use Delphi to create a program that controls the fan speed of my computer and monitors the temperature. What API calls are involved in doing that? Are there any good code samples that you can share? 回答1: You can use the WMI classes Win32_TemperatureProbe and Win32_Fan, from delphi you must import the Microsoft WMIScripting V1.x Library using Component->Import Component->Import type library->Next->"Select the library"->Next->Add unit to project->Finish. See this code. is just a

How to check if a TCP port is available with Delphi?

依然范特西╮ 提交于 2020-01-01 06:07:10
问题 Is there a more elegant way of checking if a TCP port is available with Delphi other than catching a netstat call? 回答1: I guess you can use Indy's components to do that. For instance a TIdHTTPServer will raise an exception if a port is in use when it is being opened. So basically you could create such component, bind it to localhost:<yourport> and if an exception is raised ( catch it and check it ) then the port is probably in use, else it is free. I guess other indy components can tell if a

How to check if a TCP port is available with Delphi?

感情迁移 提交于 2020-01-01 06:06:12
问题 Is there a more elegant way of checking if a TCP port is available with Delphi other than catching a netstat call? 回答1: I guess you can use Indy's components to do that. For instance a TIdHTTPServer will raise an exception if a port is in use when it is being opened. So basically you could create such component, bind it to localhost:<yourport> and if an exception is raised ( catch it and check it ) then the port is probably in use, else it is free. I guess other indy components can tell if a

Get ready for Delphi 2009 and up when developing with Delphi 7?

有些话、适合烂在心里 提交于 2020-01-01 05:45:08
问题 I'm developing a Word addin in Delphi 7, but soon I'll upgrade it to Delphi 2010, as you know, since version 2009 Delphi introduces the new string type UnicodeString which equals to the keyword string . On the other hand, according to this thread we need to use WideString to communicate with COM. My question is, what should I do in order to get ready for Delphi 2010 in the future while currently developing in Delphi 7? Currently in my code I use a user-defined type UnicodeString, the idea is

How do I send e-mail using Gmail's SMTP and Indy 10?

本秂侑毒 提交于 2020-01-01 05:40:14
问题 I'm using Delphi 2009 and the lastest Indy 10 from svn to send e-mails using SMTP, but it doesn't work with Gmail (Google Apps hosted domain). When I try to send an e-mail I get "Must issue a STARTTLS command first". I tried Googling about it and I found several forums and several solutions, but they all just bashed some code or just said I needed an OpenSLL DLL, which so far isn't very clear to me exactly what I need. Can someone please tell exactly which DLL I need and what do I have to

How can I create alpha blended icon/cursor (indirect) from the TBitmap instance of 32 bpp w/o making an temporary DIB section?

℡╲_俬逩灬. 提交于 2020-01-01 05:36:12
问题 According to MS KB entry, there is a quirk in CreateIconIndirect which recognizes HBITMAP s been created with BITMAPV5HEADER passed to CreateDIBSection (and BGRA channel layout). However, TBitmap instances with (PixelFormat = pf32bit) and (AlphaFormat = afDefined) (behaving as alpha blended for the other purposes) when referred by its Handle s are not being recognized as valid alpha blended bitmaps for creation of icons or cursors. Currently, I have to create a full copy of TBitmap using

Is there a MapReduce library for Delphi?

孤街浪徒 提交于 2020-01-01 05:09:08
问题 I recently read this great article which succinctly explains the power of Google's MapReduce: http://www.joelonsoftware.com/items/2006/08/01.html In Mastering Delphi 2009, Marco Cantu shows a multi-threaded for loop using Anonymous functions, which is basically the Map part of MapReduce, but said it wasn't complete and there were other samples out there. I'm also vaguely aware of someone at Embarcadero working on a DTL library but I haven't seen much on it lately. So, are there solid

Delphi REST API Post Sample

随声附和 提交于 2020-01-01 05:08:59
问题 Can someone post a simple example of a JSON POST request to an API using Delphi 2005. I have found numerous examples using GET but the API provider does not allow requests via HTTP GET and does not support URL encoding parameters. I am brand new to calling REST services (have used SOAP in the past) so please let me know if you require more information. 回答1: You would just use Indy's TIdHTTP component and call the Post method. Pass the URL as the first argument and your JSON string as the

How create a screenshot of a particular area?

喜你入骨 提交于 2020-01-01 05:04:09
问题 I have code that receives a specific area already defined before on server side and creates a hole on Form in client side. Instead of this, i want to get a screen capture of this same area but without appears my Form in final result, like a normal desktop capture, but in this case will be only captured, this small area. So, how i can adapt this my code below for this? procedure TForm1.CS1Read(Sender: TObject; Socket: TCustomWinSocket); var X1, X2, Y1, Y2: Integer; List: TStrings; FormRegion,

TLabel displays accelerator keys even when the UI state says not to

天涯浪子 提交于 2020-01-01 05:01:06
问题 With default Windows settings, accelerator keys are not meant to be shown on dialogs until the user presses the ALT key. Delphi's TLabel control does not obey this convention, as shown below: Although both label and check box have an accelerator key specified, the check box correctly hides it, but the label does not. Of course, when ALT is pressed, the accelerator shows for the check box, but it's the behaviour prior to that which is incorrect. My understanding of why this happens is that the