Page 4 of 19

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 13 Feb 2010, 22:56
by B-$hep
Sorry, i found that my IntToString doesn't work for license plates.
I don't know why. If you generate the plates it will display that file not found.

Can you debug this part by yourself?
Something goes wrong in there.
If it doesn't start working, use your old version of IntToString.

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 14 Feb 2010, 06:02
by Sektor
Try ShellExecute and SW_HIDE.

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 14 Feb 2010, 08:46
by B-$hep
Of course, Sektor is correct.
I was wondering why all the mess around "system()".
Is there any particular reason why you use it?

As Sektor said, you can execute almost anything you want with ShellExecute and you can control it's window, command line etc.
Hide it, maximize it, show it as it is and so on.

Read more about it here:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 14 Feb 2010, 20:33
by Cuban-Pete
B-$hep wrote:Of course, Sektor is correct.
I was wondering why all the mess around "system()".
Is there any particular reason why you use it?

As Sektor said, you can execute almost anything you want with ShellExecute and you can control it's window, command line etc.
Hide it, maximize it, show it as it is and so on.

Read more about it here:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
I only use system() because that worked with version 2 and the other ones I tried never freaking work. Always some kind of weird error. It seems that I'm actually working now with .NET and C++ at the same time. The GUI functions in Visual Basic 2008 is from .NET, I didn't know that, I just used it. Learning C++ and .NET at the same time is confusing, for example, the stupid System::String^ isn't native/normal C++ is it?

To be honest, I cannot get the ShellExecute working... :cry:

I add #include <shellapi.h> and ShellExecute(NULL, "open", "imagemagick\\convert.exe", NULL, NULL, SW_SHOWNORMAL);
And what do I get: error LNK2001: unresolved external symbol "extern "C" struct HINSTANCE__ * __stdcall ShellExecuteA(struct HWND__ *,char const *,char const *,char const *,char const *,int)" (?ShellExecuteA@@$$J224YGPAUHINSTANCE__@@PAUHWND__@@PBD111H@Z)

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 14 Feb 2010, 20:41
by B-$hep
You forgot to link shell32.lib.
Under Project->Properties choose Linker.
Then you will see Command Line.
Click on it. Then you will see empty white box on the window.

Type this in: shell32.lib
Click OK and build EXE again.


Im using VC++ Express but the project options window should be same.


Try this, if doesn't work, let me know.


EDIT: you said .NET and C++. So you actually use managed C++ and not the native WIN32 one?

When you started working on GUI version of your tool, what project did you created with VS Wizards?


CLR->Windows Forms Application ?
Or Win32->Win32 Project?

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 14 Feb 2010, 21:11
by B-$hep
OK, as it turned out that it's a managed C++ and you can't use the usual ShellExecute.

You could use Process::Start method
http://msdn.microsoft.com/en-us/library ... start.aspx

Code: Select all

Process::Start("IExplore.exe");
http://msdn.microsoft.com/en-us/library ... 71%29.aspx
Read the whole page, it has info about command line also.

But i don't see any chance to hide the window. Probably you could send message to window (SW_HIDE).

But first try to make it work for you and worry about hiding flashing console window later.

EDIT: almost forgot. You must add this to the top of your code:

Code: Select all

using namespace System::Diagnostics;

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 15 Feb 2010, 18:22
by Cuban-Pete
New color system is getting shape.

Example text input: [1]Cuban-Pete [5]likes [7]fast [15]cars and [10]woman!

Output:
result.png
result.png (2.3 KiB) Viewed 33311 times

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 15 Feb 2010, 21:47
by Cuban-Pete
Anybody any idea how to convert System::String^ to std::string? I use string to get into system(), but the user input is in System::String^.

Do you guys also perhaps know why running my program the first time (after computer restart) takes pretty long, but the next time it goes very quick? How can I fix that?

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 15 Feb 2010, 21:54
by Cuban-Pete
I fixed the string thing, perhaps a bit "ugly", but it works:

Code: Select all

string SystemToString(String ^blabla){
   int lenght = blabla->Length;
   string realString = "";
   for (int i=0; lenght > i; i++){

	realString += char(int(blabla[i]));
   };
	
   return realString;
};

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 15 Feb 2010, 22:54
by Cuban-Pete
I fcked it all up, just when I was almost at the end. I removed a resource image in the (resX?) by hand (I just needed to update the preview image) and now I get LNK2005 error's... this really sucks. Do you guys know a way to find the problem by hand?

What I did was rename an image to "222" and added a new one, but removed the "222" again or something like that...

:cry: :cry:

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 16 Feb 2010, 13:06
by B-$hep
Damn, so many posts here already. Didn't notice.

What errors exactly? How many of them?

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 17 Feb 2010, 10:11
by Sektor
I finally got around to trying this program. It's cool.

I used it to generated some text for this page.

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 17 Feb 2010, 10:39
by Cuban-Pete
Sektor wrote:I finally got around to trying this program. It's cool.

I used it to generated some text for this page.
Thanks. The page looks nice.

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 17 Feb 2010, 13:45
by B-$hep
How is your work on GUI or this tool going?
If you have some problems, post them here.

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 17 Feb 2010, 18:02
by Cuban-Pete
It's going good.

Only small problem with a function, you can only check the System::Object^ sender with the real name and not a string.
I also wanted to do colouring in richTextBox, but I don't get that working. I can make for example "[0]" to grey color, but if there is another [0] in the richtextbox, I can't get it....

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 17 Feb 2010, 19:32
by Cuban-Pete

Code: Select all

				if (this->radio_large->Checked == true){
					this->example_large->Visible = true;
					this->example_normal->Visible = false;
					this->example_menu->Visible = false;
					this->example_street->Visible = false;
					this->example_car->Visible = false;
				};
This is not very efficient if you do it 5 times, is there better way?

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 17 Feb 2010, 19:47
by B-$hep
What are they?
Buttons? Labels? Checkboxes?


You could all hide all at once with simple panel.
Put panel on the top of the controls and hide / unhide just this panel.

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 17 Feb 2010, 19:55
by Cuban-Pete
They are images.

I have no idea about cleaning up strings/integers. Is that necessary? (garbage collection?)

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 17 Feb 2010, 19:58
by B-$hep
.NET has garbage collector, you don't need to mess with that.
It automatically collects garbage.


But where are your images? On the main form?

Re: GTA2 Font Topic - txt2gta2 released!

Posted: 17 Feb 2010, 20:03
by Cuban-Pete
yeah, they are example images of the font the user selected.

I thought perhaps this is possible (but it did not work):

this->example_car->Visible, this->example_normal->Visible = false;