Search the Community
Showing results for tags 'c++ builder'.
Found 11 results
-
I have created a DLL with one exported function using the latest version of Delphi (12.1). The function takes one parameter: a record type variable. library MyDLL; uses System, SysUtils; type TMyRecord = record MyString: AnsiString; MyInteger: Integer; end; function FillRecord(var Rec: TMyRecord): Boolean; stdcall; export; begin Rec.MyString := 'Hello from Delphi'; Rec.MyInteger := 42; Result := True; end; exports FillRecord; begin end. In my C++ Builder 6.0 application, I have declared the following: struct TMyRecord { char *MyString; int MyInteger; }; extern "C" __declspec(dllimport) bool __stdcall FillRecord(TMyRecord *Rec); When calling the 'FillRecord' function from my C++ Builder application, I do not get the expected results: TMyRecord iMyRec; Memo1->Lines->Clear(); Memo1->Lines->Add(Format("Address: %p", ARRAYOFCONST((&iMyRec)))); if (FillRecord(&iMyRec)) { String iData = iMyRec.MyString; Memo1->Lines->Add("iMyRec.MyString: " + iData); int iNumber = iMyRec.MyInteger; Memo1->Lines->Add("iMyRec.MyInteger: " + IntToStr(iNumber)); } else { Memo1->Lines->Add("Error calling FillRecord"); } I am expecting: iMyRec.MyString: Hello from Delphi iMyRec.MyInteger: 42 But I am getting: iMyRec.MyString: H iMyRec.MyInteger: 42 I am drawing a blank when trying to figure out what I am doing wrong. Any inputs/suggestions to solve my issue would be greatly appreciated. Thank you
- 3 replies
-
- delphi
- c++ builder
-
(and 3 more)
Tagged with:
-
I have written some code from a tutorial. Now I am stuck with the RenameFile() function from System.SysUtils.hpp The returnValue_ is always false or 0. I tried it as Administrator. I checked the file permissions security. Nothing worked. //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "uTSearchRec.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm2* Form2; TSearchRec SearchRec; //--------------------------------------------------------------------------- __fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner) {} //--------------------------------------------------------------------------- void __fastcall TForm2::btnSearchClick(TObject* Sender) { String FindFirstPath_ = "C:\\Users\\NO_NO\\OneDrive\\TEMP\\*.*"; String Caption1_ = "Current Path:\n" + FindFirstPath_; String Caption2_ = SearchRec.Name + " is " + IntToStr(SearchRec.Size) + "bytes in size"; FindFirst(FindFirstPath_, faAnyFile, SearchRec); lbOutput->Caption = Caption1_ + "\n" + Caption2_; } //--------------------------------------------------------------------------- void __fastcall TForm2::btnAgainClick(TObject* Sender) { if (FindNext(SearchRec) == 0) { lbOutput->Caption = SearchRec.Name + " is " + IntToStr(SearchRec.Size) + " bytes in size"; } else FindClose(SearchRec); } //--------------------------------------------------------------------------- void __fastcall TForm2::btnRenameClick(TObject* Sender) { String const OldFileName_ = SearchRec.Name; String const NewFileName_ = OldFileName_ + "bak"; String const MessageFail_ = "Humpty Bumpty ! Njet Internjet !"; String const MessageOK_ = "The bether its not get !"; bool returnValue_ = true; try { returnValue_ = RenameFile(OldFileName_, NewFileName_); lbControlText->Caption = IntToStr(returnValue_); } catch (...){ lbOutput->Caption = "NewFileName_ : " + NewFileName_ + "\nOldFileName_ :" + OldFileName_ + "\nreturnValue : " + IntToStr(returnValue_); } lbOutput->Caption = MessageOK_; /* if ( (RenameFile(OldFileName_, NewFileName_) == false )) { lOutput->Caption = MessageFail_; } else lOutput->Caption = MessageOK_; */ } //--------------------------------------------------------------------------- Header //--------------------------------------------------------------------------- #ifndef uTSearchRecH #define uTSearchRecH //--------------------------------------------------------------------------- #include <System.Classes.hpp> #include <Vcl.Controls.hpp> #include <Vcl.StdCtrls.hpp> #include <Vcl.Forms.hpp> #include <System.SysUtils.hpp> //--------------------------------------------------------------------------- class TForm2 : public TForm { __published: // IDE-managed Components TLabel *lbOutput; TButton* btnSearch; TButton* btnAgain; TButton* btnRename; TLabel *lbControlText; void __fastcall btnSearchClick(TObject* Sender); void __fastcall btnAgainClick(TObject* Sender); void __fastcall btnRenameClick(TObject* Sender); private: // User declarations public: // User declarations __fastcall TForm2(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TForm2* Form2; //--------------------------------------------------------------------------- #endif
- 10 replies
-
- c++ builder
- 11.3
-
(and 1 more)
Tagged with:
-
I would appreciate some advice on how to do the following. It seemed trivial, but I quickly got tangled up with the various formats for wide strings, a lot of the Embarcadero information turned out to be for Pascal, I’m working with C++ builder. And there are a number of different wide string formats. I am displaying double values on the canvas, the following obviously works fine: Label1 -> Caption = DoubleVal ; But I got into trouble when I wanted to constrain the display precision, there doesn’t appear to be a setting for the display object and just truncating the field width would be visually unappealing. So I applied the setprecision function with a stringstream output….. ostringstream oss ; oss << setprecision (4) << DoubleVal; // This works How do I go from the stringstream to the GUI? Or is there a more direct approach?
- 4 replies
-
- c++ builder
- wide string
-
(and 1 more)
Tagged with:
-
Apologies in advance for this being probably OT. I am trying to register an installation of C++ builder XE-5 that I have just reinstalled following a machine failure. My credentials for these forums were many years old, and my email address has changed so I have just set up another account for this forum, it seemed the most appropriate. However, when I enter these new credentials into the XE5 license registration form it advises that they are not recognised. Having registered for this forum, are the credentials applicable for all Embarcadero forums? Forum credentials entry is required for product registration. The licence key I have is valid.
- 3 replies
-
- installation
- xe-5
-
(and 1 more)
Tagged with:
-
solved: C++ Builder 12.0: 'Find Symbol' (Whole Tomato) does not work
Michaell posted a topic in General Help
Hi, the C++ Builder 12.0 introduced 'Search -> Find Symbol' feature delivers in the related displayed dialog box title bar its search result, in my case: Find Symbol [0 of 0] -- Visual Assist So it is not working at all. Does it need some special prerequisite like "only working together with the Clang compiler"? Thanks! P.S. The Embarcadero feature help is here and the Whole Tomato feature help here. Both don't tell anything about problem fighting.- 3 replies
-
- 12.0
- c++ builder
-
(and 2 more)
Tagged with:
-
Indy TIdHTTP->Get UnicodeString trouble Can you teach me how to format an acceptable string to pass to TIdHTTP->Get() ? I'm working with Embarcadero C++Builder 11 trying to learn how to use Indy TIdHTTP->Get(). Attached are two examples. goodClick works but the URL is hard coded. badClick doesnt work. Looks maybe like I'm not properly formatting the URL string passed to TIdHTTP->Get(). The ip address is comming from a classic 8 bit ascii null terminated string like this "192.168.1.123". sprintf(urlAscii, "http://%s//ajax.xml",iniCfg.ethTcp_ip); I need to take the ip address from iniCfg.ethTcp_ip which is an (8 bit asci null terminated string) How can I fix the badClick example ? here is example code... Thanks for your time !! void __fastcall TEthTcpGateway::Button_goodClick(TObject *Sender) { try { // This example works fine String s = "http://192.168.1.123/ajax.xml"; //Use hard coded string UnicodeString url,us; url = "http://192.168.1.123/ajax.xml"; us = IdHTTP1->Get(url); AnsiString as = us; Memo1->Lines->Text = us; } catch (Exception &ex) { out << "Exception " << endl; } } //--------------------------------------------------------------------------- void __fastcall TEthTcpGateway::Button_badClick(TObject *Sender) { extern char ethTcp_ip[64]; // Null terminated 8 bit character buffer "192.168.1.123"; try { // This example does not work. char urlAscii[1000]; // ethTcp_ip has classic 8 bit ascii null terminated string like this "192.168.1.123"; sprintf(urlAscii, "http://%s/ajax.xml",ethTcp_ip); String s = urlAscii; UnicodeString url,us; url = s; // Copy from String us = IdHTTP1->Get(url); AnsiString as = us; out << "Response" << endl << as.c_str() << endl; Memo1->Lines->Text = us; } catch (Exception &ex) { out << "Exception " << endl; } }
-
Manual uninstall of RAD Studio/Delphi/C++Builder 12.0 Athens
Dev01 posted a topic in Delphi IDE and APIs
How to delete all the files just in case you need to, for some unknown reason. Manual uninstall of RAD Studio/Delphi/C++Builder 12.0 Athens Launch the License Manager from the bin folder (by default “C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\LicenseManager.exe”) and delete any trial or beta (Test Field) license that you can find. Check it under “License Details” in the center column. Under your Control Panel’s Program and Features Add/Remove Program uninstall the following entries: RAD Studio 12 version 23.0 Please follow these instructions to remove any leftover files: 1. If Windows 64-bit, remove the C:\Program Files (x86)\Embarcadero\Studio\23.0 directory (or the custom folder you had used). 2. Remove the C:\Users\Public\Documents\Embarcadero\Studio\23.0 directory 3. Remove the C:\ProgramData\Embarcadero\Studio\23.0 directory. 4. Remove the %APPDATA%\Embarcadero\BDS\23.0 directory. 5. Remove the HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\23.0 registry key 6. If Windows 64-bit, remove the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Embarcadero\BDS\23.0 7. If Windows 64-bit, remove the following files from C:\Windows\SysWOW64: BDEAdmin.* CC32*.DLL Midas.* Xerces*.DLL If you had problems in the second step (uninstalling from Windows Control Panel), try this Microsoft tool to solve un-installation problems: https://support.microsoft.com/en-us/topic/fix-problems-that-block-programs-from-being-installed-or-removed-cca7d1b6-65a9-3d98-426b-e9f927e1eb4d -
C++ Builder Indy error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version
BernardR posted a topic in Indy
Hi, I get the 1409442E error that seems to come back in various situations. My Rad Studio version is 11 with update 1. The Indy version is 10.6.2.0. I have tried TLS 1.0, 1.1 and 1.2 with no success. This error happens with sites using CloudFlare that may be detecting inconsistencies in the request (I have tested with various headers and Mozilla "versions" too). Any suggestions?- 1 reply
-
- c++ builder
- indy
-
(and 1 more)
Tagged with:
-
Here is the code: #include <REST.Json.hpp> ... TJson* formatter=new TJson(); Compilation successful, but linker says following: [ilink32 Error] Error: Unresolved external 'Rest::Json::TJson::' referenced from C:\USERS\ISKOR\DESKTOP\TJSONTEST\WIN32\DEBUG\UNIT1.OBJ How can that be? I use C++ Builder 10.1 Community Edition.
-
C++ Builder V10.4.1: feature 'C++ Audits' is missing & 'Codeguard' is broken
Michaell posted a topic in General Help
Hello, 1) I'm wondering what happened to the 'C++ Audits' feature. In version 10.3 it was here: View -> Tool Windows -> C++ Audits But in my currently used version 10.4 Update 1 it is no longer present. 2) I also used Codeguard in the past, it is now out of work. You can find some matching error report here (link). Thanks for your help / information! Michaell P.S. I'm running Win10 V20H2, 64 bit and I'm installing the C++ Builder via an *.iso image (i.e. offline).- 2 replies
-
- c++ audits
- codeguard
-
(and 1 more)
Tagged with:
-
Manual uninstall of RAD Studio/Delphi/C++Builder 10.4 Sydney
Dev01 posted a topic in Delphi IDE and APIs
How to delete all the files just in case you need to for some unknown reason. Manual uninstall of RAD Studio/Delphi/C++Builder 10.4 Sydney Launch the License Manager from the bin folder (by default “C:\Program Files (x86)\Embarcadero\Studio\21.0\bin\LicenseManager.exe”) and delete any trial or beta (Test Field) license that you can find. Check it under “License Details” in the center column. Under your Control Panel’s Program and Features Add/Remove Program uninstall the following entries: RAD Studio 10.4 version 21.0 Please follow these instructions to remove any leftover files: If Windows 32-bit, remove the C:\Program Files\Embarcadero\Studio\21.0 directory (or the custom folder you had used). If Windows 64-bit, remove the C:\Program Files (x86)\Embarcadero\Studio\21.0 directory (or the custom folder you had used). Remove the C:\Users\Public\Documents\Embarcadero\Studio\21.0 directory Remove the C:\ProgramData\Embarcadero\Studio\21.0 directory. Remove the %APPDATA%\Embarcadero\BDS\21.0 directory. Remove the HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\21.0 registry key If Windows 32-bit, remove the HKEY_LOCAL_MACHINE\SOFTWARE\Embarcadero\BDS\21.0 registry key If Windows 64-bit, remove the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Embarcadero\BDS\21.0 If Windows 32-bit, remove the following files from C:\Windows\System32\: BDEAdmin.* CC32*.DLL Midas.* Xerces*.DLL If Windows 64-bit, remove the following files from C:\Windows\SysWOW64\: BDEAdmin.* CC32*.DLL Midas.* Xerces*.DLL Field testers should also do the following (and others may want to as well): Delete the Godzilla license from License manager before uninstalling it or during the installation of RAD Studio 10.4 If you had problems in the second step (uninstalling from Windows Control Panel), try this Microsoft tool to solve uninstallation problems: http://go.microsoft.com/?linkid=9779673-
- installation
- uninstallation
-
(and 5 more)
Tagged with: