C++ straight Windows API Help github code

  • Release Candidate 6
    Guest:
    We are at a “proposed final” true release candidate with nothing known remaining to be changed or fixed. For the full story, please see this page in the "Pre-Release Announcements & Feedback" forum.
    /Steve.
  • Be sure to checkout “Tips & Tricks”
    Dear Guest Visitor → Once you register and log-in:

    This forum does not automatically send notices of new content. So if, for example, you would like to be notified by mail when Steve posts an update to his blog (or of any other specific activity anywhere else), you need to tell the system what to “Watch” for you. Please checkout the “Tips & Tricks” page for details about that... and other tips!

    /Steve.
  • Announcing “BootAble” – GRC's New Boot-Testing Freeware
    Please see the BootAble page at GRC for the whole story.
  • BootAble – FreeDOS boot testing freeware

    To obtain direct, low-level access to a system's mass storage drives, SpinRite runs under a GRC-customized version of FreeDOS which has been modified to add compatibility with all file systems. In order to run SpinRite it must first be possible to boot FreeDOS.

    GRC's “BootAble” freeware allows anyone to easily create BIOS-bootable media in order to workout and confirm the details of getting a machine to boot FreeDOS through a BIOS. Once the means of doing that has been determined, the media created by SpinRite can be booted and run in the same way.

    The participants here, who have taken the time to share their knowledge and experience, their successes and some frustrations with booting their computers into FreeDOS, have created a valuable knowledgebase which will benefit everyone who follows.

    You may click on the image to the right to obtain your own copy of BootAble. Then use the knowledge and experience documented here to boot your computer(s) into FreeDOS. And please do not hesitate to ask questions – nowhere else can better answers be found.

    (You may permanently close this reminder with the 'X' in the upper right.)


coffeeprogrammer

Well-known member
Jul 19, 2021
116
11
Hello,

I have been learning the Windows API, I do not want to include ALT stuff yet and the stuff from Windows 10 System Programming, just GUI at this point. I have written this program where I am making a ListBox, but I can’t seem to get things working correct. I created a second Window Procedure from the ListBox, I don’t believe that is exactly necessary but if there is a reason that might happen in practice, I want to know how to do that. Some of the code is from MSDN example about baseball players I think, if you have seen that. Anyway one of the messages is WM_INITDIALOG which would have been already processed by the time I change the ListBox window window procedure with SetWindowLongPtr function. So again I don’t know if it is a “normal” thing to change a window’s procedure for normal control windows that are built in. In any case it will not work with the SendMessage for LB_ADDSTRING if I leave it enabled because I don’t know how to process it in the procedure case statement. I am also unsure how to process thing when a user selected an item? I know it would need to go under WM_COMMAND and I might have to do LOWORD, HIWORD things to wParam and lParam, but I don’t know exactly? I welcome any advice and this effort is not to create a working program with a practical propose, it is only to learn Windows API GUI concepts. Feel free to add other advice to import this or learn. At some point I might get into custom made windows controls. Thank you.

https://github.com/coffeeprogrammer/HelloWinApi1/blob/first/HelloListBox1/main.cpp
 
Hello,

I have been learning the Windows API, I do not want to include ALT stuff yet and the stuff from Windows 10 System Programming, just GUI at this point. I have written this program where I am making a ListBox, but I can’t seem to get things working correct. I created a second Window Procedure from the ListBox, I don’t believe that is exactly necessary but if there is a reason that might happen in practice, I want to know how to do that. Some of the code is from MSDN example about baseball players I think, if you have seen that. Anyway one of the messages is WM_INITDIALOG which would have been already processed by the time I change the ListBox window window procedure with SetWindowLongPtr function. So again I don’t know if it is a “normal” thing to change a window’s procedure for normal control windows that are built in. In any case it will not work with the SendMessage for LB_ADDSTRING if I leave it enabled because I don’t know how to process it in the procedure case statement. I am also unsure how to process thing when a user selected an item? I know it would need to go under WM_COMMAND and I might have to do LOWORD, HIWORD things to wParam and lParam, but I don’t know exactly? I welcome any advice and this effort is not to create a working program with a practical propose, it is only to learn Windows API GUI concepts. Feel free to add other advice to import this or learn. At some point I might get into custom made windows controls. Thank you.

https://github.com/coffeeprogrammer/HelloWinApi1/blob/first/HelloListBox1/main.cpp
Well Thanks for the views, I think I figured out what I was confused about. I added more mess to my code, just playing around with the different GUI things. I basically wrote most of this from nothing, I have a Win32.chm file and MSDN for VS2008, I did use the internet some, but not too much. I am thinking I might try creating a simple process explorer. I have read must of the Windows 10 System Programming Parts 1 and 2, but I some times get confused as I do not use C++ that much. Anyway this is what I made with music blasting in my ears and drinking coffee. What an absolute MESS. Last branch so far:



 
  • Like
Reactions: Barry Wallis
Boy! That brings back memories. Have you read the Charles Petzold Programming Windows book yet?
 
Yes I own the 5th edition (Windows 98 era) of that book, and I read small amount of it, but not in whole. The newer edition is managed code C# I think. I also have the first two of three Windows 95 Win32 Programming Bible and Windows NT Win32 API Super bible by Richard Simon. I have a few other that I don’t recall the names and are not on my desk now. I’ve also read a good chunk of Essential COM by Don Box, which is little bit hard to get though until you have a good frame of reference for COM. I have a friend that is Java developer that seems to think this Win32 stuff is too old to learn. I’ve done C# and Java professionally, but nothing with Windows or just regular C or C++. I have clearly noticed that it seems much easier to find jobs for things like C# and Java than anything Windows specific. I noticed that the freelance site upwork.com does have profiles that claim to do Win32 and Windows Internals, Drivers and such, but that somehow feels a bit off. I guess what I am saying is I am not really sure where I am going with the Windows stuff, I do however enjoy learning it. I also purchased a few Udemy courses on create one own OS, but I haven’t started watching them. It is truly great stuff.
Boy! That brings back memories. Have you read the Charles Petzold Programming Windows book yet?
 
After working on this for a while, it made me remember the DNS benchmark, so I downloaded and ran it. I think Steve must have made some custom windows to get those graphs of information. That is cool, I don’t know how to do that, but I bet it involves GDI somehow in order to paint them. I will try checking out MSDN and google searches for examples.