Windows GUI Programming with C/C++ ( Win32 API ) | Part -2 | Menus

  Рет қаралды 119,596

The Pentamollis Project

The Pentamollis Project

Күн бұрын

Пікірлер: 102
@apalsnerg
@apalsnerg 6 ай бұрын
Here 7 years later and still the best tutorial I've been able to find. God bless you, mate!
@ameen272-amin
@ameen272-amin 4 ай бұрын
7 years and this youtuber is still underrated
@Ghost572
@Ghost572 6 жыл бұрын
You do such a good job explaining this stuff in detail. I have been learning stuff off websites which are good but don't really explain fully whats going on, although I would of figured it out eventually its really nice to have someone to point out the key areas of where menus connect together etc. Thanks for all this, you should set up a patron account I'm sure there are people who would like to send a bit of money your way for the time you've put into this.
@ThePentamollisProject
@ThePentamollisProject 6 жыл бұрын
thanks for the appreciation. It really means a lot. And actually i was thinking about setting up patreon, but currently i'm more involved in setting up a blog for this channel ( just started sketching out the basic ideas ). Once the blog is up and running, I'll do the patreon work next. although, talking about money, the revenue from this channel is more than enough to keep me motivated to keep coming up with new content.
@compotetonpote2652
@compotetonpote2652 2 жыл бұрын
@@ThePentamollisProject Cool ! Nice! Very gud! I luv you :3
@Ethorbit
@Ethorbit 5 жыл бұрын
Just wanted to thank you for making so many tutorials on Win32 GUIs, even though we could go to MSDN and see the solutions it's always nice to have a video on it with someone who is easy to understand and explains it in great detail.
@harryshuman9637
@harryshuman9637 9 ай бұрын
Yeah, I wish a multi-billion corporation like Microsoft would invest a bit of time and replace this achaic WinAPI interface with a more modern OOP C++ implementation.
@tugaks1837
@tugaks1837 5 ай бұрын
@@harryshuman9637 They already did it with WinUI... tho it is quite slow compared to the WIN32 API.
@harryshuman9637
@harryshuman9637 5 ай бұрын
@@tugaks1837 Is it running C# under the hood?
@tugaks1837
@tugaks1837 5 ай бұрын
@@harryshuman9637 No, it's implemented using C++/WinRT which is a projection of C++.
@pianoblader4263
@pianoblader4263 6 жыл бұрын
Damn dude, I usually don't like watching youtube videos about programming because they don't explain much, and is usually better to go read official documantation for the code, but this is really good.
@orionbekesi
@orionbekesi 5 жыл бұрын
khm, indians
@johnkalady5468
@johnkalady5468 3 жыл бұрын
You teach better than my professor!
@escorvus
@escorvus 5 жыл бұрын
Well, I didn't really listen to what you said but I still got it! Thanks
@mianaliahmed9886
@mianaliahmed9886 8 ай бұрын
dont know how you have been doing but....thanks a lot man......
@aibou2399
@aibou2399 5 жыл бұрын
Best win32 tutorial so far. Thanks, suscribing.
@enderstarpg6921
@enderstarpg6921 Жыл бұрын
Very helpful tutorial series so far, but the MessageBeep function plays the same sound for all the constants. Running windows11 and can't find anything about it on google
@atifkhan-ix1jc
@atifkhan-ix1jc 5 жыл бұрын
Where you learn it
@scramjet4610
@scramjet4610 4 жыл бұрын
Example works good. Great job explaining a complex subject in an understandable and practical way. My mingw compiler throws warnings with NULL, wants to see 0 instead.
@hl2mukkel
@hl2mukkel 6 жыл бұрын
This was super easy and very helpful! Thank you very much :)
@samuelsergio6095
@samuelsergio6095 6 жыл бұрын
Soooo much better than the docs
@vinayarora6544
@vinayarora6544 5 жыл бұрын
Nicely explained topics :) Cheers for the provider!!!
@bobbryson5996
@bobbryson5996 7 жыл бұрын
best video ever extremely helpful, bravo!!!
@mohdhamzaghyas4328
@mohdhamzaghyas4328 7 ай бұрын
best win32 tuturial
@retrozvoc6189
@retrozvoc6189 4 жыл бұрын
Seems very extensive. I like it!
@dmaster20ify
@dmaster20ify 7 жыл бұрын
You are my general for the coding. Which I had a bank account to wire you some money. But I couldn't pay you what you value anyways. Just keep making the good videos. You see that? I am a new subscriber to your channell.
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
thank you. It means a lot to get feedback from viewers like you. :-)
@Оңтүстікжыр-терме
@Оңтүстікжыр-терме Жыл бұрын
With which program are you writing
@icykanfused104
@icykanfused104 3 жыл бұрын
Am having trouble compiling. I am getting a too few arguments error in the AddMenus function, What would be the issue kindly advice.
@vinh01011
@vinh01011 3 жыл бұрын
I need to learn deeply about Win API , code on C ++ language can access the most specific and in-depth details about the computer system . Can you give me advice, how to learn Win API effectively? Thank you !!
@urbanawp
@urbanawp 3 жыл бұрын
can someone explain how you can use a function inside a while loop and how it stays true "while (GetMessage(&msg, NULL, NULL, NULL))" well mine did not stay true some how, i have no idea why, hell the loop don´t make sense to me
@potatopotato7561
@potatopotato7561 5 жыл бұрын
Excellent video, and thank you for this series, but your desktop hurts my eyes.
@raoahmadshaharyar7720
@raoahmadshaharyar7720 4 жыл бұрын
Same here, because of it, i'm having a headache. But HE explains great.
@kevinparsley6806
@kevinparsley6806 7 жыл бұрын
My system does not alter sounds between the MB_OK and MB_ICONINFORMATION. Also, my file menu pops up on the outside edge of the parent window. I don't know if any of that is normal or not.
@RoyNBarlow
@RoyNBarlow 6 жыл бұрын
I didn't have the file menu outside the parent window issue, but I also didn't have altering sounds between those two functions. It made this tutorial less fun to do hahaha
@schmidtlach
@schmidtlach 3 жыл бұрын
Excellent tutorial as usual!
@tovape
@tovape 2 жыл бұрын
you are a life saver, thanks so much for your knowlegde!
@elgato7557
@elgato7557 4 жыл бұрын
Hello man, I know it is 3 years later but I am following your tutorial and I have an issue, when I build and run after adding the menu to my window it causes it to instantly close after running, the window works fine without menus but if i add one i get this problem. I am using Visual Studio 2019
@ATealPenguin
@ATealPenguin 4 жыл бұрын
Carter Hoffmeyer thx so much i was getting Chinese letters instead of “File”
@brycejohansen7114
@brycejohansen7114 3 жыл бұрын
@@ATealPenguin You can put a L before the beginning speech marks of the string, so L"File" ... hopefully that helps.
@papinkelman7695
@papinkelman7695 5 жыл бұрын
Why do you have a microphone inside your keyboard?
@ricardomunhoz6706
@ricardomunhoz6706 7 жыл бұрын
Show man .. I liked your videos I would have checked in C too .. for comparisons
@ricardomunhoz6706
@ricardomunhoz6706 7 жыл бұрын
*checked wrong it's done. Sorry for my english
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
:-)
@marcussmithwick6326
@marcussmithwick6326 7 жыл бұрын
Where was this video 2 years ago, thanks :)
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
2 years ago .... i didn't even know one programming language XD.
@enlightedjedi
@enlightedjedi 4 жыл бұрын
At the AppendMenu(hMenu, MF_STRING, NULL, "File"); line I get an error saying "'BOOL AppendMenuW(HMENU,UINT,UINT_PTR,LPCWSTR)': cannot convert argument 4 from 'const char [5]' to 'LPCWSTR'" How do I solve this?
@enlightedjedi
@enlightedjedi 4 жыл бұрын
I had managed to solve it myself!
@retrodev2772
@retrodev2772 3 жыл бұрын
@@enlightedjedi how did you solve it? I have the same problem
@retrodev2772
@retrodev2772 3 жыл бұрын
nvm all i had to do was do was use L"File" insted of "File"
@skillerdz7145
@skillerdz7145 6 жыл бұрын
i have a probleme , when i start the script , the window crash and don't want to continue
@mikeoxsor6183
@mikeoxsor6183 3 жыл бұрын
I like your background
@raebailey1549
@raebailey1549 5 жыл бұрын
i am only getting the first letter of my window name how can i fix this
7 жыл бұрын
do you have a github so i can grab the files and play with them?
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
I have not uploaded this project. I can email you the files, but they have been modified.
7 жыл бұрын
ok whats you email?
@calibr0636
@calibr0636 5 жыл бұрын
your background tho, is that benedict cumberbatch
@MasterMindmars
@MasterMindmars 2 жыл бұрын
Very good
@hohohappyday77
@hohohappyday77 3 жыл бұрын
can you show the project files?
@satishg6965
@satishg6965 5 жыл бұрын
in next video please tell us how you are able to remember the codes, what are the logic that you use to keep that thing in your brain,
@ThePentamollisProject
@ThePentamollisProject 5 жыл бұрын
The key to remembering all that is experience. Make notes for now, and refer to them whenever necessary. You keep using these commands over and over again, you'll eventually have them by heart.
@ashutoshrautela3454
@ashutoshrautela3454 7 жыл бұрын
How to open console with Win32 application in Visual Studio?
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
if you create a win32 project in visual studio, it automatically disables the console. You might wanna look in the project settings if you want to enable it. Or you can try creating a new project as a "console application" instead of "win32 API project" in the first place,. Win32 works that way too, but you might get linking problems in this case if you are planning to use GDI in your application. Good-luck !
@taviann
@taviann 3 жыл бұрын
Thank you.... 🙏🏽
@serviciointegraldesegurida7276
@serviciointegraldesegurida7276 2 жыл бұрын
Example works good.
@НиколайМиронов-г3и
@НиколайМиронов-г3и 5 жыл бұрын
MessageBeep 9:40 dont work... Do nothing
@RobbieEscamilla
@RobbieEscamilla 5 жыл бұрын
Turn on the speakers :P
@gplayminion1734
@gplayminion1734 3 жыл бұрын
i followed the tutorial and my window wont open now
@EarthSettler
@EarthSettler 7 жыл бұрын
Thank you a lot, will there be the 3rd one?
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
yes, next week. On Wednesday probably.
@Rumplestiltzchen
@Rumplestiltzchen 2 жыл бұрын
that desktop! sheeesh!
@WhoForgot2Flush
@WhoForgot2Flush 5 жыл бұрын
well done
@valizeth4073
@valizeth4073 6 жыл бұрын
Why do you declare the function then define it? like: void addMenu(); void addMenu() { } instead of just doing it once?
@ThePentamollisProject
@ThePentamollisProject 6 жыл бұрын
because it is the way its done. I think you're getting C++ confused with java or c#. in C++ if you're calling a function before it has been defined ( i mean the function call is above the definition in the code ), the compiler will not be able to find the function. Consider the following code for instance : void do_stuff() { //code } int main() { do_stuff(); } this code will work fine because the function has been defined before its called. But most of the people like to keep the main function on the top in their code. Consider the following example: int main() { do_stuff(); } void do_stuff() { //code } this code won't compile because the compiler will not be able to find the function as it is defined afterwards. So you'll need to add a declaration before the function call that will tell the compiler that a function with that name exists and it has to look for it. the code: void do_stuff(); int main() { do_stuff(); } void do_stuff() { //code } :-)
@valizeth4073
@valizeth4073 6 жыл бұрын
Well it's really simple to work around it. Instead of for an example: void doStuff(const char* message); int main() { } void doStuff(const char* message) { } just: void doStuff(const char* message) { } int main() { } I've never gotten any issue with this, nor do I think it's needed, it basically just makes the program longer, I can't really see any benefit with doing it that way :*
@valizeth4073
@valizeth4073 6 жыл бұрын
AND usually with C++ you're using classes within different tabs of the window like: myClass.h + myClass.cpp + main.cpp. Then the main function is basically the only function in the main.cpp tab. Then the issue is gone aswell
@ThePentamollisProject
@ThePentamollisProject 6 жыл бұрын
if you have other functions in other files ( not main.cpp), you'll also need to provide declarations in either the main file or in the header file and then include the header in the main file. Thats another use of declarations. But if you're working with classes and objects, then there's a different story.
@Ethorbit
@Ethorbit 5 жыл бұрын
@@valizeth4073 Longer is better than messy, having the main function buried in the program is not very clean, most people (including me) prefer to use the prototypes, I personally do them in the header so that the function can be below the main function without any additional stuff like you said.
@serviciointegraldesegurida7276
@serviciointegraldesegurida7276 2 жыл бұрын
Excelent, thank you.
@jihwan816
@jihwan816 6 жыл бұрын
very good video thx
@Ibrahimkhan-uc8rw
@Ibrahimkhan-uc8rw 5 жыл бұрын
brother if you make a calculetor by using gui for us, it will help us much
@aceaspect2431
@aceaspect2431 4 жыл бұрын
18:44 he accidentally clicks spacebar
@urhur
@urhur 7 жыл бұрын
you are my master!
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
:-)
@Yilativ7
@Yilativ7 3 жыл бұрын
Thanks so much!
@kryptoid2568
@kryptoid2568 4 жыл бұрын
I don't know how to thank you
@youyiliu7556
@youyiliu7556 6 жыл бұрын
Great!
@takase5037
@takase5037 4 жыл бұрын
Desktop.
@calin5681
@calin5681 Жыл бұрын
Code (Tested, working): #include #define FILE_MENU_NEW 1 #define FILE_MENU_OPEN 2 #define FILE_MENU_EXIT 3 LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM); void AddMenus(HWND); HMENU hMenu; int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR args, int ncmdshow) { WNDCLASS wc = {0}; wc.hbrBackground = (HBRUSH)COLOR_WINDOW; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hInstance = hInst; wc.lpszClassName = L"myWindowClass"; wc.lpfnWndProc = WindowProcedure; if (!RegisterClassW(&wc)) return 1; CreateWindowW(L"myWindowClass", L"My Window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 500, 500, NULL, NULL, NULL, NULL); MSG msg = {0}; while (GetMessage(&msg,NULL,NULL,NULL)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_COMMAND: switch(wp) { case FILE_MENU_EXIT: DestroyWindow(hWnd); break; case FILE_MENU_NEW: MessageBeep(MB_ICONINFORMATION); break; } break; case WM_CREATE: AddMenus(hWnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProcW(hWnd, msg, wp, lp); } } void AddMenus(HWND hWnd) { hMenu = CreateMenu(); HMENU hFileMenu = CreateMenu(); HMENU hSubMenu = CreateMenu(); AppendMenu(hSubMenu, MF_STRING, NULL, L"Submenu Item"); AppendMenu(hFileMenu, MF_STRING, FILE_MENU_NEW, L"New"); AppendMenu(hFileMenu, MF_POPUP, (UINT_PTR)hSubMenu, L"Open Submenu"); AppendMenu(hFileMenu, MF_SEPARATOR, NULL, NULL); AppendMenu(hFileMenu, MF_STRING, FILE_MENU_EXIT, L"Exit"); AppendMenu(hMenu,MF_POPUP,(UINT_PTR)hFileMenu, L"File"); AppendMenu(hMenu, MF_STRING, NULL, L"Help"); SetMenu(hWnd,hMenu); }
WIN API for Game Developers, day 0, introduction
4:39
Low Level Game Dev
Рет қаралды 26 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
What is the Windows API?  What is Windows.h?
5:35
Guided Hacking
Рет қаралды 190 М.
Creating a window - Software from Scratch
1:04:12
Muukid
Рет қаралды 163 М.
Drawing Graphics with C and Windows API is Easy
5:17
Nir Lichtman
Рет қаралды 39 М.
Malware development 101: Creating your first ever MALWARE
28:00
Leet Cipher
Рет қаралды 395 М.
Emulating a CPU in C++ (6502)
52:28
Dave Poo
Рет қаралды 1 МЛН
Every Programming Language Ever Explained in 15 Minutes
15:29
Flash Bytes
Рет қаралды 361 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 842 М.
Windows GUI Programming with C/C++ ( Win32 API ) | Part -1 | Creating a window
23:53
The Pentamollis Project
Рет қаралды 441 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН