Windows GUI Programming with C/C++ ( Win32 API ) | Part -9 | Save File Dialog and Scrollbars

  Рет қаралды 37,868

The Pentamollis Project

The Pentamollis Project

Күн бұрын

Пікірлер: 68
@DavePaddy
@DavePaddy 4 жыл бұрын
This was VERY useful tutorial series. I wish you did more of these, you're explaining very well.
@timothywrona6381
@timothywrona6381 4 жыл бұрын
You have a memory leak when you call "new[]" without a corresponding "delete[]" (note that this is "delete[]" with square brackets, not just "delete"). I would suggest taking a more modern C++ approach to reading the file that eliminates the issue of manual memory management altogether: Include these headers: #include #include Then do this: std::wifstream file(path); std::wstring contents((std::istreambuf_iterator(file)), std::istreambuf_iterator()); SetWindowText(hEdit, contents.c_str()); This solves your memory leak and leaves the task of memory management to the C++ standard library. Overall great tutorial videos though!
@grekzorna8750
@grekzorna8750 8 ай бұрын
@Inmasj0ns This is not object oriented though...
@ajupeter1125
@ajupeter1125 4 жыл бұрын
Tributes! to a great teacher you are!.... Thank you so much for explaining things so beautifully.. Pray you do well in everything you do.
@kimlynhep1462
@kimlynhep1462 6 жыл бұрын
Where is part 10?
@billtsou8071
@billtsou8071 6 жыл бұрын
I really like your tutorial. Your English is easy to understand. What you've taught us are extremely helpful for beginners. Hope that you can publish part 10 of GUI tutorial. Thanks!!
@hk-aerialvtol4371
@hk-aerialvtol4371 6 жыл бұрын
Thanks for the 9 video into to Win32. This was extremely well thought out and presented.
@santiagomendezmejia7155
@santiagomendezmejia7155 6 жыл бұрын
Thanks !!!! For me this is the best tutorial of Win32 API. Greetings from Colombia
@aibou2399
@aibou2399 5 жыл бұрын
Thanks for this video series, i was afraid of diving in this old school c style api, but it was a confortable trip with your tutorials.
@Lugmillord
@Lugmillord 6 жыл бұрын
Thank you for this tutorial series. This really helped me getting started with the Windows API!
@Martin-wz5rm
@Martin-wz5rm 5 жыл бұрын
Can you please do a tutorial on checkboxes?
@brendananderson9102
@brendananderson9102 3 жыл бұрын
Yeah, I wanted to program a GUI with bullet points. I guess I'll have to find a tutorial elsewhere.
@carloseduardomayerdeolivei2913
@carloseduardomayerdeolivei2913 2 жыл бұрын
Congratulations! Thank you for the great information that you have provide us!
@timobeyer9870
@timobeyer9870 6 жыл бұрын
We want Part 10♥
@peterSobieraj
@peterSobieraj Жыл бұрын
So there will be challenge in next video, and it was last video in series. :D
@alvinhi5467
@alvinhi5467 6 жыл бұрын
Nice, did you have example for create trackbar in windows GUI C++
@noteng0
@noteng0 2 жыл бұрын
Excellent list bro, was so helpfull to me and my projects :)
@PerchEagle
@PerchEagle Жыл бұрын
Hi .. I have a question, do you have a blog page or email so I send you my problem ? I'm trying to print multiple page on the same hWnd object.
@mikeroland9963
@mikeroland9963 2 жыл бұрын
Very useful tutorial, thank you, brother !
@MohamedGaber-sv6nh
@MohamedGaber-sv6nh 3 жыл бұрын
شكرا لك يا صديقي😀🙂 لقد ساعدتني في الكثير🙂
@newgatefullbustar8366
@newgatefullbustar8366 5 жыл бұрын
thanks so much for these wonderful series.
@benmac6862
@benmac6862 5 жыл бұрын
Why do you sometimes use the underscore _ before a variable ?
@MisterTyken
@MisterTyken 5 жыл бұрын
Awesome work, I've found something that might prove to be difficult for the viewers that I've run into. If you don't load a file then it crashes because it doesn't have a file to load and goes onto the next function as if it did. A little help on this fix would be helpful
@MasterMindmars
@MasterMindmars 2 жыл бұрын
Thank you so much. Could you make a video for draw circles, lines, rectangles. ..? Greetings.
@emanoel.g.s
@emanoel.g.s Жыл бұрын
I have a problem, can you help me? I need to read a file, execute a series of procedures (which take time), and during the procedure I want to show text messages (debug) on ​​the "hEdit" screen. However, it is only after the process is finished that writing is done on the "hEdit" screen. Is there any way for the two processes to coexist?
@starwinner4982
@starwinner4982 6 ай бұрын
Take a look at multithreading. Use one thread for the main loop of the window, where you handle all the events, and another thread for reading the file. In order to get updates on how much of the file has been read, then read the file byte by byte - after each byte notify the other thread about the progress. If you ask how to share this progress? Then just store the pointer of the first object, where the function that is multithreaded, is running. Then just update some array with that pointer. Hope this helped! :)
@mariodvillarreal
@mariodvillarreal 4 жыл бұрын
I want to retrieve data from another application. With window spy, i can get all structure of forms, including theirs Id. But, can't retrieve data. Anyone can help me?
@cato_ix
@cato_ix 6 жыл бұрын
Hey! How do you remove the terminal? This has helped me figure out a couple things, but I don't want to have the extra program open in the background.
@aibou2399
@aibou2399 5 жыл бұрын
If you are compiling from command line, use the "-mwindows" flag.
@ahmedessamahmed860
@ahmedessamahmed860 6 жыл бұрын
How to add sound in the program? please say, thank you
@brazo98
@brazo98 3 жыл бұрын
Thx a lot about your perfect tutorials. So, one question, how can read from a windows a panel objects? For example a label or textedit field? Is this possible with the findwindowex function? Or via getwindowstext? It make me really creepy that problem! Thx a lot for a answere. Please keep healthy! 🖖🏻🖖🏻🖖🏻
@EliasNPC
@EliasNPC 6 жыл бұрын
Could you do these tutorials while using ResEdit for styling?
@srinivasreddy4306
@srinivasreddy4306 5 жыл бұрын
10 bro plz
@code-to-learn
@code-to-learn 3 жыл бұрын
More part please! About media player
@mikejzx
@mikejzx 6 жыл бұрын
Great tutorial, but I believe you forgot to insert the terminating character '\0' into the data before writing, because I noticed when I opened the saved file in Programmer's Notepad there was a character at the end which said "NUL". But I think that was because of the data size being 1 int too large. Here's what I did to prevent this: char* data[length + 1]; GetWindowText (hInputField, data, length); data[length] = '\0'; fwrite(data, length, 1, file); Let me know of any errors I made. I think the ' + 1' isn't actually required for this.
@ThePentamollisProject
@ThePentamollisProject 6 жыл бұрын
Yes you're right, and sorry for this silly mistake. I was just focusing on the stuff that was related to the API and i didn't pay much attention to the input/output code.
@mikejzx
@mikejzx 6 жыл бұрын
No worries mate, we all make mistakes ;)
@Lugmillord
@Lugmillord 6 жыл бұрын
I tried your code and when opening the file, the last character was replaced by a space. This worked fine for me: char* data = new char[sizeOfContent + 1]; data[sizeOfContent] = '\0'; GetWindowText(hFileOutput, data, sizeOfContent + 1); fwrite(data, sizeOfContent, 1, file);
@mikejzx
@mikejzx 6 жыл бұрын
+Lugmillord Interesting... In your code, I don't think the '\0' is even being written to the file, because your specified length in fwrite doesn't have the + 1. And also you called GetWindowText after assigning the last char of data to '\0', so it would probably be replaced anyway.
@Lugmillord
@Lugmillord 6 жыл бұрын
I thought so, too. But when I switched the lines, the last character was replaced and I found an extra space in the text file. Maybe allocate length + 2?
@nastyavicodin6229
@nastyavicodin6229 6 жыл бұрын
I don't understand why but when I open file in usual text editor after every line it's additional empty line. Help me pls with this problem. Code was the same as in video
@ThePentamollisProject
@ThePentamollisProject 6 жыл бұрын
try this char* data[length + 1]; GetWindowText (hInputField, data, length); data[length] = '\0'; fwrite(data, length, 1, file); i didn't pay much attention to the file I/O code so there might be problems with that.
@nastyavicodin6229
@nastyavicodin6229 6 жыл бұрын
In notepad all files are ok When I open it in Sublime text my files became smth like this: 2369 6e63 6c75 6465 0d0d 0a0d 0d0a 6865 6c6c 6f5f 776f 726c 640d 0d0a 7772 6974 6528 2900 But this happend only if I edit empty files.
@nastyavicodin6229
@nastyavicodin6229 6 жыл бұрын
This is my first version of write_file func: void write_file(char *path) { FILE *file; file = fopen(path, "w"); int _size = GetWindowTextLength(hFile_cont); char *data = new char[_size + 1]; GetWindowText(hFile_cont, data, _size + 1); fwrite(data, _size + 1, 1, file); fclose(file); }
@nastyavicodin6229
@nastyavicodin6229 6 жыл бұрын
This is second version: void write_file(char *path) { FILE *file; file = fopen(path, "w"); int _size = GetWindowTextLength(hFile_cont); char *data = new char[_size + 1]; GetWindowText(hFile_cont, data, _size); data[_size] = '\0'; fwrite(data, _size, 1, file); fclose(file); }
@nastyavicodin6229
@nastyavicodin6229 6 жыл бұрын
When I changed my write_file func nothing changed in output, still empty lines and NULL in the EOF
@rajjoshi6300
@rajjoshi6300 6 жыл бұрын
Hey, is there a way that we can see your complete source code from all the files? I want to see it in one place so I can understand it better. I need to do this for my marking period project. Your videos are great and keep working hard!
@ThePentamollisProject
@ThePentamollisProject 6 жыл бұрын
I dont have separate sources of all the tutorials as i edit the same project everytime. Although I do have the source of Part 9. And i think i might be able to dig up the source of part 6 or 7. I can email it all to you you if you provide your id, or alternatively, you can text me at the facebook page of this channel ( facebook.com/pentamollis ), and i'll send the code there. :-)
@rajjoshi6300
@rajjoshi6300 6 жыл бұрын
I will message you on your facebook page
@toadvices1502
@toadvices1502 8 ай бұрын
Hello, can i have the source code of this project? regards
@W3Bches3
@W3Bches3 3 жыл бұрын
Next part(10):
@andreimiga8101
@andreimiga8101 6 жыл бұрын
I have a question. How do you change the font of the controls? The default font looks bad.
@animalvids6312
@animalvids6312 5 жыл бұрын
everything in windows is done by sending messages. enjoy docs.microsoft.com/en-us/windows/desktop/controls/edit-controls-text-operations
@GtTrader67
@GtTrader67 5 жыл бұрын
post the complete code file.
@FrostGamingHype
@FrostGamingHype 3 жыл бұрын
i Still Want A Short Way For This Is Too Many Void Function Going IN My Mind Bro There Should Be An Smaller And Shorter Way To Do IT You Know
@doelekkerrechts3782
@doelekkerrechts3782 6 жыл бұрын
I notice how you use "new" to allocate an array without deleting it afterwards. Are you more familiar with Java? Nevertheless, it's a helpful tutorial. Thanks.
@timothywrona6381
@timothywrona6381 4 жыл бұрын
He actually uses "new[]" which is not quite the same as "new". In order to avoid a memory leak the "delete[]" operator with square brackets must be called. These kinds of subtle details make it very easy for mistakes to happen so it would really be better to just use a "std::ifstream" to read the file and leave the task of memory management to the standard library.
@hungtrinh7169
@hungtrinh7169 3 жыл бұрын
thank you , i am Vietnamese ,HoangSa TruongSa by VIETNAM
6 жыл бұрын
Nice
@royy7954
@royy7954 2 жыл бұрын
Good!
@EarthSettler
@EarthSettler 6 жыл бұрын
thank you again
@Versie2007
@Versie2007 6 жыл бұрын
More, plz :)
@W3Bches3
@W3Bches3 3 жыл бұрын
Hello :)
Windows GUI Programming with C/C++ ( Win32 API ) | Part -8 | Open File Dialog
22:00
Windows GUI Programming with C/C++ ( Win32 API ) | Part -6 | The Message Box Dialog
16:51
#behindthescenes @CrissaJackson
0:11
Happy Kelli
Рет қаралды 27 МЛН
Their Boat Engine Fell Off
0:13
Newsflare
Рет қаралды 15 МЛН
Jaidarman TOP / Жоғары лига-2023 / Жекпе-жек 1-ТУР / 1-топ
1:30:54
$1 vs $500,000 Plane Ticket!
12:20
MrBeast
Рет қаралды 122 МЛН
Cross Platform Graphical User Interfaces in C++
44:49
javidx9
Рет қаралды 874 М.
HOW Win32 Apps Are Made in C
23:54
Jason “Jase” Coulls
Рет қаралды 24 М.
Handmade Hero Day 152 - New Win32 File API Implementation
1:38:52
Molly Rocket
Рет қаралды 9 М.
Creating a Window using C++ and Win32 | Tutorial
23:10
Aerideus
Рет қаралды 97 М.
I Redesigned the ENTIRE YouTube UI from Scratch
19:10
Juxtopposed
Рет қаралды 882 М.
My 2 Year Journey of Learning C, in 9 minutes
8:42
VoxelRifts
Рет қаралды 671 М.
Click a Button, Destroy My Site
11:40
Hyperplexed
Рет қаралды 105 М.
#behindthescenes @CrissaJackson
0:11
Happy Kelli
Рет қаралды 27 МЛН