Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: visual c++ convert c++ builder



Permlink Replies: 5 - Last Post: Feb 14, 2018 12:25 PM Last Post By: Remy Lebeau (Te... Threads: [ Previous | Next ]
Muhammet Seçme

Posts: 3
Registered: 12/5/17
visual c++ convert c++ builder
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 6, 2018 10:54 AM
hi I have a visual c ++ code I want to organize it so that it can be used in c ++ builder

[CODE VİSUAL C++]

DWORD MobPointer = 0x01B03E50;
void SetMobInfo(int index){

__try{

DWORD pointer = MobPointer;
float playerx = *(float*)(*(DWORD*)(*(DWORD*)pointer + 0x0) + 0x690);
float playery = *(float*)(*(DWORD*)(*(DWORD*)pointer + 0x0) + 0x694);
float mobx = *(float*)(*(DWORD*)(*(DWORD*)pointer + 0x4 * index) + 0x690);
float moby = *(float*)(*(DWORD*)(*(DWORD*)pointer + 0x4 * index) + 0x694);
BYTE mobtyp = *(BYTE*)(*(DWORD*)(*(DWORD*)pointer + 0x4 * index) + 0x620);
int mx = mobx / 100;
int px = playerx / 100;
int my = moby / 100;
int py = playery / 100;
int px2 = px1 / 100;
int py2 = py1 / 100;
mob[index].x = (mx - px);
mob[index].y = (py - my);
mob[index].x1 = (mx - px2);
mob[index].y1 = (py2 - my);
mob[index].typ = mobtyp;

}
__except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) {
}


}
Color myColor;
void DrawMap(){
myColor = Color::FromArgb(0, 51, 51);

Graphics ^ g;
g = pictureBox1->CreateGraphics();

Pen^ Monster = gcnew Pen(Color::Red, 2.0f);
Pen^ Player = gcnew Pen(Color::Yellow, 2.0f);
Pen^ Metin = gcnew Pen(Color::Blue, 2.0f);
Pen^ Green = gcnew Pen(Color::Green, 2.0f);
Pen^ Rand = gcnew Pen(Color::Black, 2.0f);
//g->Clear(myColor);
g->Clear(Color::Black);


int drawx;
int drawy;


try{

for (int i = 0; i < 50; i++)
{

{

SetMobInfo(i);

int yy = (pictureBox1->Height / 2);
int xx = (pictureBox1->Width / 2);

drawx = mob[i].x + xx;
drawy = mob[i].y + yy;


if (drawx < 168 && drawx > -168 && drawy < 157 && drawy > -157){
if (mob[i].typ == 0) {
g->DrawRectangle(Rand, drawx, drawy, 3, 3);
g->DrawRectangle(Monster, drawx, drawy, 2, 2);

}

if (mob[i].typ == 6) {
g->DrawRectangle(Rand, drawx, drawy, 3, 3);
g->DrawRectangle(Player, drawx, drawy, 2, 2);
}

if (mob[i].typ == 2) {
g->DrawRectangle(Rand, drawx, drawy, 3, 3);
g->DrawRectangle(Metin, drawx, drawy, 2, 2);
}

if (mob[i].typ == 1) {
g->DrawRectangle(Rand, drawx, drawy, 3, 3);
g->DrawRectangle(Green, drawx, drawy, 2, 2);
}


//Radius
Pen^ blackPen = gcnew Pen(Color::LightYellow, 1.0f);
System::Drawing::Rectangle rect = System::Drawing::Rectangle(26, 26, 85, 85);
//g->DrawEllipse(blackPen, rect);

}

}

}
}
catch (...){

}
try{
delete Rand;
delete Metin;
delete Player;
delete Monster;
delete Green;
}
catch (...){

}
}

[/CODE VİSUAL C++]
Please help me ..

roca robin

Posts: 140
Registered: 9/10/06
Re: visual c++ convert c++ builder
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 6, 2018 1:08 PM   in response to: Muhammet Seçme in response to: Muhammet Seçme
hi,
my advice; you make a blank c++ builder windows vcl form, paste it,

try to run your program,
then you can see where are the lines needed to be replaced because Error on lines.
Muhammet Seçme

Posts: 3
Registered: 12/5/17
Re: visual c++ convert c++ builder
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 7, 2018 10:53 AM   in response to: roca robin in response to: roca robin
it did not work
roca robin

Posts: 140
Registered: 9/10/06
Re: visual c++ convert c++ builder
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 7, 2018 1:16 PM   in response to: Muhammet Seçme in response to: Muhammet Seçme
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include <JPEG.hpp> //For Graphics

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}

//temp
int px1=1000;
int py1=1000;

DWORD MobPointer = 0x01B03E50;
void SetMobInfo(int index){
__try{

DWORD pointer = MobPointer;
float playerx = *(float*)(*(DWORD*)(*(DWORD*)pointer + 0x0) + 0x690);
float playery = *(float*)(*(DWORD*)(*(DWORD*)pointer + 0x0) + 0x694);
float mobx = *(float*)(*(DWORD*)(*(DWORD*)pointer + 0x4 * index) + 0x690);
float moby = *(float*)(*(DWORD*)(*(DWORD*)pointer + 0x4 * index) + 0x694);
BYTE mobtyp = *(BYTE*)(*(DWORD*)(*(DWORD*)pointer + 0x4 * index) + 0x620);
int mx = mobx / 100;
int px = playerx / 100;
int my = moby / 100;
int py = playery / 100;
int px2 = px1 / 100;
int py2 = py1 / 100;
//mob[index].x = (mx - px);
//mob[index].y = (py - my);
//mob[index].x1 = (mx - px2);
//mob[index].y1 = (py2 - my);
//mob[index].typ = mobtyp;
}
__except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) {
}
}

//
//
//

//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
//
}
//---------------------------------------------------------------------------

Just like that

Muhammet Seçme

Posts: 3
Registered: 12/5/17
Re: visual c++ convert c++ builder
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 14, 2018 10:45 AM   in response to: roca robin in response to: roca robin
this code error please help me

Color mycolor = Color::FromArgb(0, 51, 51);
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: visual c++ convert c++ builder
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 14, 2018 12:25 PM   in response to: Muhammet Seçme in response to: Muhammet Seçme
Muhammet Seçme wrote:

this code error please help me

Color mycolor = Color::FromArgb(0, 51, 51);

Color is a .NET type:

https://msdn.microsoft.com/en-us/library/system.drawing.color.aspx

In C++Builder, use TColor or TAlphaColor instead:

http://docwiki.embarcadero.com/Libraries/en/System.UITypes.TColor

http://docwiki.embarcadero.com/Libraries/en/Vcl.Graphics.TColor

http://docwiki.embarcadero.com/Libraries/en/System.UITypes.TAlphaColor

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02