Windows GUI Programming with C/C++ ( Win32 API ) | Part -8 | Open File Dialog

  Рет қаралды 44,200

The Pentamollis Project

The Pentamollis Project

Күн бұрын

Пікірлер: 77
@veggieboy1
@veggieboy1 2 жыл бұрын
Fantastic video. So helpful to have this explained clearly by someone, instead of having to figure everything out for myself from the documentation!
@geofflord4797
@geofflord4797 2 жыл бұрын
Hi these are amazing tutorials, very clear throughout the whole series of videos: For anyone using Visual Studio 2022: the Lib file name is "ComDlg32.Lib" Just for good measure i added the line of code at the top just under the header files: #pragma comment(lib, "ComDlg32.Lib") To add to the Libraries on VS right click the Solution Name-> Properties then click Linker->Input and in the Additional Dependencies->edit and add the Filename ComDlg32.Lib and click ok. Then Click apply and Ok and this should run. The Lib Files on my system are located by default on VS install: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64 I hope this helps someone.
@GrandNecro
@GrandNecro 4 жыл бұрын
for anyone having trouble with the GetOpenFileName() function. you need to add include the #include library and add -lcomdlg32 when compiling the program: gcc .\test_gui.c -lcomdlg32
@baltazarus3307
@baltazarus3307 5 жыл бұрын
Hy people if char *data = new char[size+1] doesn't work, try to put *(char *)malloc(size+1)* instead of *new char[size+1]* but you've to include , library (for C++ files) or , for C and of course after put *free(data)* to deallocate "data" memory. It worked for me. edit: For C++ file, feel free to use char* data = reinterpret_cast(malloc(size+1))
@iansapelino6407
@iansapelino6407 5 жыл бұрын
Okay.
@iansapelino6407
@iansapelino6407 5 жыл бұрын
But how do you interpret it in c? for I know that this kind of argument is in C++?
@andreimiga8101
@andreimiga8101 4 жыл бұрын
Some clarifications: 1. In C++, you don't need to include any header files for the allocation. Also, the deallocation is done with "delete data;" 2. In C, you need to #include . To allocate you need to do "data=malloc(size+1);" (no need to cast the result unless you want the code to also compile in C++), and to deallocate you need to "free(data);" EDIT: I have noticed the purpose of the comment just afterwards. Not a single time have I come across a C++ compiler which doesn't have a working 'new' operator, since memory management is one of the most basic operations in C++.
@Lugmillord
@Lugmillord 6 жыл бұрын
Phew, I had real issues finding the libcomdlg32.a since the search function didn't help at all. I forgot, that MinGW is inside the Code::Blocks-Folder, in my case it was in C:\Program Files (x86)\CodeBlocks\MinGW\lib (Windows 10). Maybe that helps others failing at finding it.
@Keys_9914
@Keys_9914 2 жыл бұрын
finally a channel I understand ...
@stefanmoser4348
@stefanmoser4348 7 жыл бұрын
hi Ed :-) your tutorials are becoming always better. I know, that c++ is very tricky, but when you want to do graphics and program games, you'll have to use it. I'm already looking forward to the next part & thank you for showing ;-)
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
glad to have your feedback. I'll try to upload the next part ASAP.
@ВладСергачёв-и2ш
@ВладСергачёв-и2ш 4 жыл бұрын
Hello guy! I want to thank you for this tutorial series. It really helped me out because I tried to learn winapi with other tutorials but It wasn't succesfully.. So now at least I can to write some primitive program) Thank you very much!
@wanderingpalace
@wanderingpalace 3 жыл бұрын
just read the winapi programming by charles petzold i found it really useful indepth and lengthy tho
@aibou2399
@aibou2399 5 жыл бұрын
Great vid. For anyone compiling from mingw console line, i used "g++ Main.cpp -o Main.exe -lcomdlg32"
@venkateshnagaraju888
@venkateshnagaraju888 5 жыл бұрын
can some one help me to implement the drag and drop event using window 32 API in c++
@veggieboy1
@veggieboy1 2 жыл бұрын
Can you also allow the user to select a folder (directory) in this fashion?
@carlos144
@carlos144 2 жыл бұрын
a value of type "char *" cannot be assigned to an entity of type "LPWSTR"
@therandomsomeone.
@therandomsomeone. 2 жыл бұрын
that's because char* is not lpwstr and i do not think you can cast a char* to lpwstr
@TechWithSwag
@TechWithSwag 6 жыл бұрын
error C2664: 'void display_file(char *)' : cannot convert argument 1 from 'LPWSTR' to 'char*'
@mistakenmeme
@mistakenmeme 5 жыл бұрын
Replace your parameter with ‘wchar_t*’ and see if that works.
@MisterTyken
@MisterTyken 5 жыл бұрын
fopen(path, "rb"); doesnt work for me. the error that pops up says --- Severity Code Description Project File Line Suppression State Error C4996 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. WindowFile c:\users\faceo\source epos\windowfile\windowfile\main.cpp 50
@andreimiga8101
@andreimiga8101 4 жыл бұрын
Add the following line at the very top of your source file: #pragma warning(disable:4996) This is just some microsoft bullshit, don't worry about it.
@disekjoumoer
@disekjoumoer 2 жыл бұрын
@@andreimiga8101 It's not microsoft bullshit. use fopen_s instead.
@Seventro7
@Seventro7 3 жыл бұрын
which software you using ?? or you done everything by handcode ??
@mmafandude1338
@mmafandude1338 Жыл бұрын
Why are my characters in Chinese, Korean?? the window that shows the file is frozen as well
@peterSobieraj
@peterSobieraj Жыл бұрын
Shoudn't nMaxFile be 99 ? Since file_name have 100 elements, including terminating 0.
@pierreforget3357
@pierreforget3357 2 жыл бұрын
Works fine, except for one thing. Once the file has been inserted in the main box, it stays white characters on white background until I select the text. Once selected, then it's black on white characters. Anybody has an idea?
@cmacc6477
@cmacc6477 6 жыл бұрын
If you use "new" you have to use "delete" too. Or malloc/free.
@scramjet4610
@scramjet4610 4 жыл бұрын
Not in the case of a simple application like this because when the application ends, the allocated memory is returned to the system. You need to delete allocated memory only when function runs a long time with repeated large memory allocations.
@TechWithSwag
@TechWithSwag 6 жыл бұрын
I am facing an issue : Please help me out; error C2440: '=' : cannot convert from 'const char [51]' to 'LPCWSTR'
@khairulalom1488
@khairulalom1488 6 жыл бұрын
use Function_Name without appending W
@readmoreon2390
@readmoreon2390 2 жыл бұрын
or use L" "; since unicode stuff
@aliasdude3288
@aliasdude3288 4 жыл бұрын
I'm having an issue getting the libcomdlg32.a to be used on dev-c++
@rd4603
@rd4603 4 жыл бұрын
How can I select more file types, for example "JPG files\0*.jpg,*.jpeg\0" because this doesn't work? EDIT: I figured it out You can search for multiple data types in the explorer like "*.jpg OR *.jpeg". You have to be careful because the OR is case sensitive. It doesn't work in the program. Here you have to write "*.jpg;*.jpeg"
@grizzly9180
@grizzly9180 5 жыл бұрын
when I build this as GUI Application, it freezes the shit out my i7 computer and the main window won't show up.
@jericogaming1952
@jericogaming1952 5 жыл бұрын
you need to configure your projects settings first in order to use WinMain, just check the error if one exists,also try to allocate memory for wnd class: memset(&wc,0,sizeof(wc));
@ubaidullah5127
@ubaidullah5127 3 жыл бұрын
How do I assign tasks to my "Enter Key" ??
@glebmatveev2914
@glebmatveev2914 7 жыл бұрын
Thank for your video. It's help me with my course project. I saw everything i needed. Thank you so much!
@bamster64
@bamster64 6 жыл бұрын
Please keep making these tutorials
@ThePentamollisProject
@ThePentamollisProject 6 жыл бұрын
I've been inactive in this series for a long time cuz I've been working on the opengl ,c++ tutorials for a while, but I've planned the next video I upload will be an addition to this series. stay tuned, it'll be up within a week or two.
@bamster64
@bamster64 6 жыл бұрын
Thanks, I will be sure to check your other videos too ^^
@raveltammeleht6278
@raveltammeleht6278 16 күн бұрын
That is strange, why char works on your machine?? I had to modify the code to get it to working. Firstly I had to define the file_name as TCHAR file_name[256] = TEXT(""); and secondly, the lpstrFilter must be defined as TEXT("\0*.wav\0") and then it starts to work. I find it interesting that char works on your case...
@raveltammeleht6278
@raveltammeleht6278 16 күн бұрын
Oh .. I suspect you were using OPENFILENAMEA instead ... that explains, because now I am able to use chars! So it turns out, that you have to chose between UNICODE or ANSI characters in the editor. Afterwards you Should decide wether to use OPENFILENAMEA(ansi) or OPENFILENAMEW (for unicode, best compatibility as I understood). Either way thanks. Informative tutorial.
@nutcrackzengine1232
@nutcrackzengine1232 7 жыл бұрын
Hi could you please make a tutorial on how to create a list box and adding items to it and select them (for example using a message box to show which item has been selected)
@Lee-jh3rv
@Lee-jh3rv 7 жыл бұрын
Hi, thanks for the tutorial. I have some problem with generating "open file" button. After I did everything you showed, the place that supposes to be a button is just grey...I have the same problem with Image, too. Do you have any idea about that?
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
please copy paste your source code here in a reply, or mail it to me at edratulthakur0@gmail.com. I'll look into it.
@sayedkazimi6214
@sayedkazimi6214 3 жыл бұрын
Hi man, I am following your tutorial. I followed your code but I got multiple errors and the big one is: A head has been corrupted. the debugger shows it "DispatchMessage(&msg);" I searched a lot on Ggle but could not find any solution. Thanks
@Fleekz_
@Fleekz_ 7 ай бұрын
I have the same exact issue right now. Have you fixed it? If yes please tell me how.
@aerahtv0000
@aerahtv0000 6 жыл бұрын
what if i use Visual studio , how this library libcomdlg32.a will be named and where to find it?
@disekjoumoer
@disekjoumoer 2 жыл бұрын
If you have included windows.h, you don't need to include anything else.
@akarshitbatra1754
@akarshitbatra1754 2 жыл бұрын
@@disekjoumoer but he have to give -llibcomdlg32.a while compiling after the file name .
@game-br5ow
@game-br5ow 7 жыл бұрын
My app crashed. The reason is that the char needs to be new char[_size+1] and not char(_size+1). But I don't understand what exactly was allocated using the new char(_size+1).
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
thanks a lot for reporting this error. I'm gonna remake the tutorial replace it ASAP.
@gladeare
@gladeare 5 жыл бұрын
@@ThePentamollisProject Are you still planning on doing this? Especially with all the _s functions and other functions being split to _w functions, this would be really helpful. :)
@disekjoumoer
@disekjoumoer 2 жыл бұрын
@@ThePentamollisProject Except you never did. But you do still delete comments.
@Gizego
@Gizego 7 жыл бұрын
Why are the videos at 480p?
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
i only record a part of my screen .. and thats why i get a lower resolution. Although, i'm soon going to upgrade my setup. The quality will get better. :-)
@Gizego
@Gizego 7 жыл бұрын
Is using 2 monitors good for a programmer? I am coding a lot in c#.
@stefanmoser4348
@stefanmoser4348 7 жыл бұрын
@Ed, the resolution is totally ok. a good idea is, that you are coding black on white. so the text is better readable than on a dark background
@stefanmoser4348
@stefanmoser4348 7 жыл бұрын
hi @gizego. more than 1 monitor is good for every kind of work on pc's. also in work I use 2 Monitors. when you are writing programs, you can install the IDE on one monitor and on the second screen you can look up things in the Internet, or watch viedeos, for example :-)
@Gizego
@Gizego 7 жыл бұрын
My idea was keep the program running in the 2nd screen
@rashaadahmad2517
@rashaadahmad2517 4 жыл бұрын
it is comdlg32.lib in digital mars c compiler
@623-x7b
@623-x7b 5 жыл бұрын
link against -lcomdlg32 for those not uses visual studio. Type g++ myfile.cpp -lcomdlg32
@mnada72
@mnada72 7 жыл бұрын
Hi, are you going to add more topics to this tutorial ? I really enjoyed it, but please consider your speed in the next videos :) Many thanks
@MasterMindmars
@MasterMindmars 2 жыл бұрын
Very good
@FLStudioTutorialsMyanmar
@FLStudioTutorialsMyanmar 7 жыл бұрын
Thank You Very Much For All Tutorial.I' m From MYANMAR .What is Your Country?
@ThePentamollisProject
@ThePentamollisProject 7 жыл бұрын
glad to have your feedback. I'm from India. ...north India
@FLStudioTutorialsMyanmar
@FLStudioTutorialsMyanmar 7 жыл бұрын
Ohh!....Indian are very good in making software.
@FLStudioTutorialsMyanmar
@FLStudioTutorialsMyanmar 7 жыл бұрын
Do you have facebook account?
@khaledshifullah434
@khaledshifullah434 3 жыл бұрын
Awesome ❤️
@jackieAZ
@jackieAZ Жыл бұрын
You wouldn't download a car...
@szaman6204
@szaman6204 5 жыл бұрын
thanks
@disekjoumoer
@disekjoumoer 2 жыл бұрын
Test comment
What's inside a .EXE File?
8:27
Inkbox
Рет қаралды 437 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Cross Platform Graphical User Interfaces in C++
44:49
javidx9
Рет қаралды 874 М.
Handmade Hero Day 152 - New Win32 File API Implementation
1:38:52
Molly Rocket
Рет қаралды 9 М.
Let's Create a Compiler (Pt.1)
1:11:03
Pixeled
Рет қаралды 574 М.
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 572 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 842 М.
Win32 - Drawing Pixels (C)
20:39
Samuli Natri
Рет қаралды 28 М.
Become a shell wizard in ~12 mins
12:25
CODE IS EVERYTHING
Рет қаралды 263 М.
How the C++ Linker Works
15:52
The Cherno
Рет қаралды 646 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН