smags13
Posts
-
What will be compressed when using Compress function in FastReport -
create transparent form in vclLooks like you've several posts on same question, correct?
-
chang form -
.Net Com Class Callback to Delphihave you tried connection points[^]
-
Get CPU Usage Using PDH APINot sure your compiler is able to delay load dynamic library[^] which is another option. I haven't got chance to use this syntax though... I would use the following to dynamically load the function.
type
//definition is based on http://gr32ex.googlecode.com/svn/trunk/GR32Ex/Examples/DesktopSnow/GPSysHook/api/JwaPdh.pas
PDH_HQUERY = THANDLE;
PDH_STATUS = DWORD;
FuncPdhOpenQuery = function(szDataSource: LPCTSTR; dwUserData: DWORD_PTR;
var phQuery: PDH_HQUERY): PDH_STATUS; stdcall;//and your function implementation would be:
procedure LoadPDHQuery;
var
PdhOpenQuery: FuncPdhOpenQuery;
DllHandle: HModule;
QueryHandle: PDH_HQUERY;
Res: PDH_STATUS;
begin
try
DllHandle:= LoadLibrary('pdh.dll');
if DllHandle > 0 then
begin
@PdhOpenQuery:= GetProcAddress(DllHandle, 'PdhOpenQueryW');//notice it's either W or A as stated in MSDN (http://msdn.microsoft.com/en-us/library/windows/desktop/aa372652(v=vs.85).aspx)
if (Assigned(PdhOpenQuery)) then
begin
Res:= PdhOpenQuery(nil, 0, QueryHandle);ShowMessage(IntToStr(Res)); end; end;
finally
if (DllHandle > 0)
FreeLibrary(DllHandle);
end;
end; -
Convert delphi 2007 project to latest delphi XE4?If XE4 gives you errors when opening your .dproj file, the answer would be no. And if XE4 is able to open that file, make sure you do a clean build. Do you have 3rd-party packages installed with Delphi 2007? It's sometimes tricky and annoying to keep packages up-to-date when upgrading your codebase. I assume you've already dealt with UnicodeString in your 2007 project, which is big bonus to the conversion.
-
[SOLVED] Not Updating TObjectDictionary Value CorrectlyShouldn't the function signature of TryGetValue look like the following?
function TryGetValue(const Key: TKey; out Value: TValue): Boolean;
and the objStudent was corrupted actually after the call to TryGetValue
if (m_objStudentList.TryGetValue(nId, ObjStudent))
begin
objStudent.StudentName:= sName;//don't need to call AddOrSetValue as Delphi returns object reference for you.
end; -
[SOLVED] Assigning Properties and Events At RuntimeIs RTTI the only way to do? Check if TMethod.Code contains empty info. and you're redirecting properties on TServer class, not a TServer object.
if MethodProp.Code <> Nil then
begin
//Sometimes OutputDebugString is neat for debugging components/pkg
OutputDebugString('Property Found.');
SetMethodProp(TObject(TServer) , 'OnEvent', MethodProp);
end
else
begin
OutputDebugString('Property Not Found.');
end; -
[SOLVED] Access a const from a classclass const is available since Delphi 7 (or Delphi 2009?) (http://edn.embarcadero.com/article/34324[^]), so your compiler is good. What type of error/complain did you get? Did it happen at compilation time or run time? I think what did not work may not relate to class const. You could try a simplified codes where only one class is defined with a class const, and then access it from a different unit, and see if it works, which I think it should.
-
[SOLVED] Access a const from a classWhat compiler do you use?
TClassFoo.NUMBER
should work.
-
[SOLVED] Set/Get ItemData() Equivalent in DelphiBasically, you need to set/get Object into/from Items property of TComboBox instance. An example could be found at TComboBox.Items Property[^] To set:
// Add View styles and constants to the Combo Box
ComboBox1.Items.AddObject('vsIcon', TObject(vsIcon));
ComboBox1.Items.AddObject('vsList', TObject(vsList));
ComboBox1.Items.AddObject('vsReport', TObject(vsReport));
ComboBox1.Items.AddObject('vsSmallIcon', TObject(vsSmallIcon));
// Display first item in the Combo Box
ComboBox1.ItemIndex := 0;To get:
ListView1.ViewStyle := TViewStyle(Items.Objects[ItemIndex]);
TComboBox uses an instance of TCustomComboBoxStrings to maintain captions and their associated data, which has a function called PutObject.
function PutObject(Index: Integer; AObject: TObject); override;
This is the function that sends CB_SETITEMDATA message internally and where you could be able to set 32-bit value along with a given item index. On the other hand, GetObject
function GetObject(Index: Integer): TObject;
will retrieve the 32-bit value for you. Notice, in the world of Delphi, all these 32-bit values here are actually a TObject value.
-
how to wifi, wirless programming?Ha, I knew there is some Delphi header for these APIs somewhere and we are not alone. :-D Thanks Theooo
-
how to wifi, wirless programming?If you are implementing it on Windows: take a look at WlanConnect[^] and WlanDisconnect[^]. Go through this page http://msdn.microsoft.com/en-us/library/windows/desktop/aa816369(v=vs.85).aspx[^] for brief usage of Native Wifi API. I don't think Delphi provides units for these APIs, so you have to download it somewhere else. you can also call netsh command line to perform the connection. It's less flexible but easier to use this command line method than Native Wifi API, but you can decide which one is better based on your project.
-
Just wonderingAnd also wondering if CodeProject is lately sponsored by Windows 8. :laugh:
-
Please I Need Help For My Delphi ProjectI suppose you want to drag a file from Explorer into a TForm window. Basically, you can respond WM_DROPFILES message to catch drag-and-drop events. Allow your Delphi Forms to Accept Dropped Files from Window Explorer[^] shows how to drag files into a window and print the file paths out in a TMemo component.
-
New To Delphi - Want a Right DirectionBtw, has anyone here got this "Handbook"? I just want to hear some opinions about this one. Or anyone find it useful?
-
Generating Label Barcode from inside of our projectWhat version of Delphi are you using? By the way, if you want to buy a component, use trial version and prepare a bunch of technique questions (like Help! the code is not working! or It doesn't work on my printer!) for them before purchase, it will let you know how good their programmers are. By "they don't work on all kind of printers", you mean they can't print the barcode out or the printout can't be scanned? And what type of barcode are you using?
-
Generating Label Barcode from inside of our project -
New To Delphi - Want a Right DirectionMy suggestion would be the same, since Embercadero Delphi is the only reliable IDE for GUI programming in Delphi, from my point of view. You could ask for an academic license if you are qualified. CodeGear Academic Program[^] Let me know how it goes.
-
New To Delphi - Want a Right DirectionHi, Welcome to Delphi community. If you want to be familiar the language first, there are some other pascal compilers available. but I would suggest you use this Embercadero RAD Studio, so that you can play around with Delphi language, IDE, VCL, etc. And you can also access to its big source code depository. You will learn a lot from it. As for books. I don't have any for recommendation. (unless you want to do some COM programming in Delphi :)) Official web site has some tutorials to begin with. RAD Documentation is also a good place to visit for both references and tutorials. These two web sites are good for references too, Delphi Basics and Delphi About. Some contents are old, but 99% are good. Dr.Bob is also neat resource. Last, don't forget here if you have any problem.