win32api best way to create multiple controls - c++

Im just learing to code for the win32 api.. And one thing that i cannot seem to find some ideas for is were to put the code when creating multiple controls..
For example:
Im writing a program that have 8 separete edit boxes + 8 statics.. Should i just dump everyone inside of WM_CREATE? Or should i create a separate function and call that from WM_CREATE?
Ive also tried to think of somekind of loop, but the placements for the different controls is a problem there..
How are you professionals doing it? :)

Related

Searching for the best way to create a field of Text Edits or something like that

I am terrible new to Qt programming, so I wan't to code some simple first projects.
I am trying to create a soduko solver. The problem is, that I now use 9^2 text edits to creat the "sudoke field". I think this is a terrible way to solve this.
Is there a good way in Qt to solve my problem? Like a matrix-text-edit-class or some shortcuts i could use. Working with 9^2 text edits is a little bit annoying.
Thanks for any suggestions and your time.
You can use a QTableWidget (or a QTableView) with 9 columns and 9 rows:

How to get text to display in a TextBrowser in Qt?

I am new to c++ and even newer to Qt on Linux.
Can any one give me a general idea of how to display text in a textbrowser in Qt? I can't post my code because of the seative nature of the project I am working on. All I need is a basic understanding of how to do this related to slots and signals.
My application is this: I am taking input from a CSV file, counting the ords and then displaying the number of counted words along with the line of text in an output window.
It works fine in console c++ program. However, when I code it in Qt, it does not work.
Any advise or help would be welcome.
sorry for the bad question I asked earlier.
It turns out it was a configuration issue on my part.

Launching external editor in GTKmm

i am writing (using C++ and GTKmm) a simple photo browser that is available on GitHub:
https://github.com/jjkrol/ZPR
Currently i am working on creating a button, which will allow user to open currently displayed photo in external editor (for example GIMP). Because of this, i have two questions:
Are there any examples of using Gtk::AppChooserDialog class? I couldn't find any and it's hard to start working on choosing the editor without them.
Most important question - i am thinking about a way to launch an application with photo in command line. The only solution that comes to my mind is using system() call to do something like this: system("gimp /path/to/current/photo.jpg"); , but it is probably not the best way of doing this. Anybody knows a better way? I would like to port my application to Windows someday and a more portable way would be great.
Thank you very much in advance.
Instead of system, you might want to use Glib::spawn_command_line_async. There are other similar functions that gives more control if you need it.
For examples, you might want to look the source code of an application like glom.
Thank you very much for answers, gpoo and ergosys! In the end i decided to use Gio::Appinfo as it looks more OOP-like. If anyone would face the same problem - this is what i have end up with:
Glib::RefPtr<Gio::AppInfo> editor = Gio::AppInfo::create_from_commandline("gimp",
"GIMP", Gio::APP_INFO_CREATE_SUPPORTS_URIS);
Glib::RefPtr<Gio::File> photo = Gio::File::create_for_path(
(*currentPhoto)->getPath().string());
editor->launch(photo);
Of course choosing the editor with Gtk::AppChooserDialog is not yet implemented.

need help replacing image in dll file C++ gui

ok what i want to do is make a program with button witch i have done and use a dll form windows in this case its called resources.dll its from new blue effects and i want to change logo image on a dialog box how would i go around doing this
ok this is new to me dont say to me its advance i know it is just need someone to explain or give me some code and tell me how to implant it into a button im using gui intaface on vb
so one i have a resources.dll file
2 i want to change a image in this dll file using c++ gui witch is already done
3 all i need is some code and a little explication on how to use it we all have to start some ware i know the basics of this but videos dont quite cover what i want to do not asking you to do it for me im just asking for some help with this i will add your name on my product :) thank you
elfenliedtopfan5
images on what i mean

How to get console text to refresh rather than re-type?

Hi so i'm making a game through the console window, and i was wondering if there was any way to just get maybe one or two text character's placement to change or disappear. Usually to accomplish this i would have to tell the console to re-type every single character and line all over again, but this just takes to long (1 second fps plus .5 second time spent re-typing the scene).
Is there some way i could re-fresh or change one or two lines or 'characters' seen on the console so so much time is not spent on waiting for the console to re-typing my 24 lines, each a string? (the scene made up of text)
Thanks! =)
btw... does anyone remember that little easter egg in windows which was an entire star wars movie made out of text in the console?? I want the game be smooth like that!
You'll need to use an external library to interface with the console as C++ doesn't have these capabilities, but it is possible.
My old goto for this sort of thing is ncurses. It's straightforward, quick to set up, and cross-platform. But it's old, and its age shows. (If you're on windows you'll have to use pdcurses; same capabilities, different package).
There are also console-specific ways of doing this. In particular, Windows provides an API for performing these sorts of actions.
You need ncurses library.
See console print w/o scrolling for reasons and examples.
Also google for the source to the rogue/urogue/nethack games which do that already.