Search found 347 matches

by Dark Alchemist
Mon Aug 09, 2010 6:32 pm
Forum: C++ Development
Topic: WxString conversion question.
Replies: 13
Views: 1996

Not exactly because it is using char * whereas I am using a char block. It has a wxstring into a char block but not a char block into a wxstring which is what I need.
by Dark Alchemist
Mon Aug 09, 2010 5:45 pm
Forum: C++ Development
Topic: WxString conversion question.
Replies: 13
Views: 1996

WxString conversion question.

How do I do the opposite of this? char cstring[1024]; // assuming you want UTF-8, change the wxConv* parameter as needed strncpy(cstring, (const char*)mystring.mb_str(wxConvUTF8), 1023); I need to take a char X[1024] and slap it into a WxString. I was hoping the bookmarked http://wiki.wxwidgets.org/...
by Dark Alchemist
Wed Aug 04, 2010 3:41 am
Forum: wxDev-C++
Topic: Not sure where this goes, or even if at all ...
Replies: 2
Views: 1293

Re: Not sure where this goes, or even if at all ...

This project is now my home. Why? I love writing C++ classes and OpenGL graphics. I learned (still learning) the language on Dev-C++ 4.x . There are other very good IDEs out there. And if you a professional programmer they may be useful. I am not a professional programmer; I program as others climb...
by Dark Alchemist
Tue Aug 03, 2010 7:56 am
Forum: C++ Development
Topic: How to embed fonts into your Windows programs.
Replies: 4
Views: 1496

You can't embed a font in a app. You can link the file to a binary and have extraction routine in you app. However on windows installing the font with out user rights might be a little bit of a problem, and accessing it from the install directory might cause problems. Not to mention extracting it t...
by Dark Alchemist
Mon Aug 02, 2010 7:10 am
Forum: C++ Development
Topic: How to embed fonts into your Windows programs.
Replies: 4
Views: 1496

How to embed fonts into your Windows programs.

Just thought I would let others know of this since I have seen a few questions asking about this over the years and having just figured this out myself. First take a program that converts any binary to C (bin2c but I wrote my own for inhouse work) and write out your binary into C code (unsigned char...
by Dark Alchemist
Sat Jul 31, 2010 5:04 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Just for the record: EndModal() is not a good universal solution as it's only correct when the Dialog was opened with ShowModal() (Dialogs can be non-modal, too). Use EndDialog() instead: void wxDialogBase::EndDialog(int rc) { if ( IsModal() ) EndModal(rc); else Hide(); } Thanks doublemax for spott...
by Dark Alchemist
Sat Jul 31, 2010 1:27 am
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

I bet it does. Makes sense but odd that they would use Destroy and not a single person has ran into this before. I mean I have been using wxDevcpp for almost 5 years now and I never ran into the bug but up pops the show(false) and KERBOOM! The bug shows its ugly head. That was a bug in your code; y...
by Dark Alchemist
Sat Jul 31, 2010 12:38 am
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Right, but the heap was complaining whereas the dialog was on the stack or is the dialog really on the heap? Even worse could the dialog be on the stack and on the heap at the same time? Consider class X { int* x; public: X() { x = new int(5); } }; int main() { X myX; } The X is on the stack, but i...
by Dark Alchemist
Fri Jul 30, 2010 11:41 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

No. As already mentioned, by calling Destroy() the dialog will be destroyed twice (which creates the assert when the same memory block is attempted to be freed the second time) if the dialog gets created on the stack. Right but I was getting heap errors not stack errors which threw me. just because...
by Dark Alchemist
Fri Jul 30, 2010 11:15 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Doing the endmodal I will not have any memory leaks or will I? No. As already mentioned, by calling Destroy() the dialog will be destroyed twice (which creates the assert when the same memory block is attempted to be freed the second time) if the dialog gets created on the stack. Right but I was ge...
by Dark Alchemist
Fri Jul 30, 2010 10:49 pm
Forum: wxDev-C++
Topic: Crash potential found when adding a new dialog.
Replies: 0
Views: 961

Crash potential found when adding a new dialog.

http://forums.wxwidgets.org/viewtopic.php?t=28490

That is the thread and doublemax found the issue was because your code is generating a Destroy(); in the onclose function instead of an EndModal. As soon as I removed the Destroy and replaced it with the EndModal it worked.
by Dark Alchemist
Fri Jul 30, 2010 10:47 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

As i suspected, the Destroy() call was the culprit. Comment out the event handler in the event table macro or replace the Destroy() with something like EndModal(-1). Ut oh, I need to the let the guys over there know they are creating a crash potential. Doing the endmodal I will not have any memory ...
by Dark Alchemist
Fri Jul 30, 2010 10:11 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Crashed with a brand new project in the same way.

http://www.easy-share.com/1911733352/Test_crash.7z

I 7zipped the wxdevcpp project (latest beta 7zip) and you will see it crashes too.

Btw, everything in the project was created by wxdevcpp and there is absolutely nothing in it from me.
by Dark Alchemist
Fri Jul 30, 2010 9:54 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

doublemax wrote:Well, i'm just poking in the dark. Can you produce a minimal compilable example that shows the crash?
Let me see if I can do that (was already going to attempt this) because in doing so I might see if something else is bugged.
by Dark Alchemist
Fri Jul 30, 2010 8:57 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

The Destroy() in the OnClose handler looks suspicious. If you create the dialog on the stack, it will probably destroyed twice this way. Well, that is how every class is created via wxdevcpp so I copied it verbatim. Heck, what you are seeing is a verbatim copy of my main frame/cpp that wxdevcpp cre...