|
Are you seriously targeting Windows versions prior to 3.5 ?
All the fluff chSETDLGICONS goes through is completely useless. My advice would be to replace it with the last 2 SendMessage calls:
SendMessage(hwnd, WM_SETICON, TRUE, (LPARAM) \
LoadIcon(GetWindowInstance(hWnd), \
MAKEINTRESOURCE(idilarge))); \
SendMessage(hWnd, WM_SECTION, FALSE, (LPARAM) \
LoadIcon(GetWindowInstance(hwnd), \
MAKEINTRESOURCE(idiSmall)));
Mircea
|
|
|
|
|
Don't laugh about me I am learning WINAPI from an old book . ( I have understand it that is no sense
to check if windows is less than 3.5 )
Until now, I had to compile code that was written with WindProc procedure, but the author has now been found to shoot me
in the knee with message crackers ( now I am google it for them to understand them ).
I hope to go with this code until the finish, because I have to handle and with those macro funcions now.
Aniway I am confident because I have your help.
|
|
|
|
|
Honestly, I don't think it's that useful to learn Win32 API. World has moved over to other technologies in the last 20-25 years. Whatever books you find, they are old (not much money to be made by authors writing about a dead subject) and the skills you acquire they are not in high demand.
Mircea
|
|
|
|
|
I am feeling too that I am not quite on the right path. I wanted to enter in the world of programming and I started to
learn C++. Then I said that C++ is a tool, and I realized that I have to do something with this tool and I have start
to learn WINAPI beacause I wanted to be capable to design some interfaces from scrap. This was the path that I choose to
walk through and I keept going, good or bad that was what I knew to do. Now I am at the finish of this WINAPI book and I am
planning to learn and some data bases.
I want to enter in the world of programming and to be able to work on my own, if you have advices for me I am more than
glad to count on them.
Thank you very much,
|
|
|
|
|
coco243 wrote: if you have advices for me I am more than
glad to count on them. Well, I am sorry to say that you have probably wasted your time learning the Windows API. Especially so if you now want to learn database programming. You really need to move into the .NET field if you expect to make a career in programming. .NET Book Zero by Charles Petzold[^] is an excellent introduction. Beyond that there are plenty of free tutorials online, for advanced C# and database programming. A word of warning: stay clear of youtube tutorials as they tend to be less than good quality.
|
|
|
|
|
Richard MacCutchan wrote: Well, I am sorry to say that you have probably wasted your time learning the Windows API
I saw in that a possibility to learn making an user interface in my desire to make stand alone applications.
Richard MacCutchan wrote: Especially so if you now want to learn database programming
I don't necessary want to learn database programming but I consider that when you build applications you would need to use databases at some time.
Richard MacCutchan wrote: You really need to move into the .NET field if you expect to make a career in programming. .NET Book Zero by Charles Petzold[^] is an excellent introduction.
Thank you for the advice, and for the resource link.
|
|
|
|
|
coco243 wrote: I saw in that a possibility to learn making an user interface in my desire to make stand alone applications. Which is so much easier to do in .NET as the framework does all the detailed fiddling about, and leaves you to focus on the actual presentation and business logic.
|
|
|
|
|
Thank you for your thoughts, I will end this WINAPI subject book because I have a few chapters until the end and I have to finish what I have started and I will start reading your sugested documentation about .NET because, honestly I don't have a clear image about what .NET it is and could de but I think that the fact that I had learned something about WINAPI apps will help me to beter understanding.
Thank you.
|
|
|
|
|
If you learn something for the intention of making yourself an income, then the Win32 API is not the right choice in the year 2025. On the other hand ...
I learned Windows programming before there was a WIN32 API, it was way back in the 16-bit days of the "WIN16 API" (it was never called that). My primary learning was not an API, but event driven programming: Taking your data structures from one consistent state to another consistent state in well defined, atomic steps. Always leaving your data so that it can be properly used by anyone else the next time something happens. No loose ends, no garbage on the floor. Looking upon each event cycle similar to a database transaction. A great philosophy for building robust software.
Often, programmers show me code: 'See, I am doing event driven programming too - here is the switch case on the input value!' But even driven is so much more than a switch statement. What I see is a lot of other logic that is not at all related to the state and event, lots of loose ends, lots of garbage variables affecting the state without being treated as state data. The Windows model put a strong pressure on you to do 'clean' event driven coding.
Today, working in C#, I still think in event/state terms, taking data structures through well defined, finite processing steps from on consistent state to another. I didn't learn that from any book published this millennium. I didn't learn it from younger coworkers. I didn't learn it from browsing programming forums on the Internet. I learned it from the Windows API.
I am really happy to have that background when programming in the year 2022, with the tools of year 2022. Learning the Windows API / event driven programming was certainly no waste of time. It has great value for me, even today.
|
|
|
|
|
Although I am not initiated in programming, I felt it when I started to learn C++ and MFC despite C#, that C++ is more closer to the hardware components, to the heart of the machine, I felt that with C++ I can put my hands and get dirty, and so on that with WINAPI I can comunicate more closer with WINDOWS system, through the windows API functions, I felt that those are the right and honest stpes to get started in programming, I felt that these are the basics that I have to know to start an healty way of programming. But my goal is as you expressed yourself " to make myself an income" and for that appears that I have to learn more tools to be able to deliver a stand alone product. I don't know if my path is the good one but I keep pushing until I will succed.
Thank you.
|
|
|
|
|
I have and this error to, that I don't know how to solve it:
Quote: error C3861: 'GetWindowInstance': identifier not found
I don't know at where to take this function.
If you cand help me and with this to.
Thank you,
|
|
|
|
|
It appears that I have to include WindowsX.h to solve that.
Thank you,
|
|
|
|
|
Why would you use a macro for something that you only need once? Or even if you need it more than once you should make it a callable function.
|
|
|
|
|
I am trying to compile some code from a book to understand what the author wants to transmit. Maybe the book it is a bit old and that's why some tehniques are inappropiate.
|
|
|
|
|
The problem with using that sort of macro is that they are a pain to debug when something goes wrong. All you need to do is copy and paste the actual lines of code into your OnInitDialog function. And remember to remove all those backslashes. You can then easily step through line by line in the debugger if necessary.
|
|
|
|
|
Yes, I had wondered myself if it is any method to see where is the error in this macro functions because compiler says generally that is an error in a macro function but you have to search through all lines of the code to see where the error could be.
And those backslash are very wierd, I don't know what is their role.
|
|
|
|
|
The backslashes are there to tell the macro processor to include them all until it finds a line that just ends in a newline.
#define FOO(x) \ // means the definition continues onto the next line
x *= 25; \ printf("X = %d\n");
|
|
|
|
|
I would like to go over some old code and replace the use of CString (MFC / ATL) with a multiplatform, C++ 20 equivalent. Can I use std::format and if so, then how?
|
|
|
|
|
std::format is not directly compatible with sprintf formatting codes. From what I've seen there are different ways to go about this:
- do sprintf to a temporary buffer and assign buffer to a std::string
- switch to string streams (std::stringstream) and their "<<" operator
- switch to std::format and their "{}" style formatting.
None is automatic and about equally unpleasant.
Mircea
|
|
|
|
|
Message Closed
modified 15-May-23 19:06pm.
|
|
|
|
|
Yes, the option to remove blank lines doesn't usually exist.
|
|
|
|
|
|
I all I did was answer your question. What the did i do wrong?
Quote: I am asking - is this normal in any decent editor NOT to have an option to remove "white space" in between lines of code?
|
|
|
|
|
14968771 often answers like that. Similarly gives instructions in his questions as to how you must answer.
|
|
|
|
|
Wow.
The quality of the question directly dictates the quality of the answer.
|
|
|
|