I like programming, but...
Writing a Windows program using Windows API sometimes can be about as much fun as being covered in molasses, then buried up to your neck next to an ant hill!
Now, that said, it's not really fair for me to rant against something that, due to my ignorance of the subject, makes as much sense as quantum physics, but it's my damn site, so I'll rant at whatever the fuck I feel like!
It's probably obvious at this point that I am currently trying to write a Windows program, and am getting, to say the least, a tad frustrated! That said, perhaps every programmer out there requires a whole day to simply get a fucking button added to their main Window, and then another two days to get the fucking button to actually do something once you fucking click on it! I know if I understood the Windows API more, and general Windows programming, it wouldn't require me to go thru such trials and tribulations, but damn!
It seems every step of the way is more like a stumble, where I slowly grasp just enough examples and information from the web to apply to my program, and sit back and watch it fall on it's face, and the fucking thing will not even compile. On top of that, the error messages from the compiler are about as clear as trying to see thru tar!
One persistent error message was due to the fact that the settings of my project had to use a multi-byte character set instead of unicode. DAMN! How did I miss that one! Pretty bad when you read the answer to the problem, and the answer makes less sense than the original problem!
So, here I am, after three days of coding, and I've managed to get a program running that has one button, one listbox, and clicking on the button actually does something. Of course, it would sure be nice if I could get that fucking listbox to co-operate, with lines of text being written to it, but alas, we are at yet another stumbling block. Nothing another day or so of researching won't fix, assuming I can hold onto my sanity that long.
So here I am, the following day, and I've pretty much given up on the listbox thing. Sort of got it working, but not really the way I wanted it, so I figured I'd move onto an easier way to get my program to function. Basically, dump the stupid listbox, and use the simple TextOut function to simply spit out to the main Window the text that I want to display. Looks like I'm onto something as I don't really need to have a button on my Window. I was going to have the user click the button that would then execute the stuff that I need to run, but I can simply have the stuff run once the program launches. Beautiful! No fucking buttons to deal with, and with my newfound TextOut command, no fucking Listboxes either. I may actually be getting somewhere!
But of course this being Windows programming, it just has to get difficult, doesn't it.
And difficult it quickly became.
One thing I want my program to do is to simply find out how many files are in a given directory. Seems simple enough, doesn't it? I mean, there just has to be a function I can call that's built into Windows that will provide this number to me.
Well, after combing the web for a bit, I have come to the conclusion that this function either doesn't fucking exist, or it does, and I just cannot find the fucking thing!
How ludicrous is this!!!
It's no wonder that there are many people out there that hate programming!
In forging ahead, I created my own function that provides me with the count of files in a directory... hot fucking damn! Now we're getting somewhere! Though at this pace, that place is going to be the insane asylum!
Managed to plod along and got my program functioning, and providing the information to the user as I wanted. However, one more stumbling block! What else would you expect from Windows programming.
One of the things my program does is provide the number of records in a given Windows Event log. Managed to get this all working, but I wanted to refine it a bit. Once thing that is nice to do in any program is error checking. This is done as one should never assume that just because, for instance, a Windows event log should exist, that is does indeed exist. Windows might get rather upset if you call a function that has an Event log name as one of its parameters, when in reality the Event log name does not exist after all. Can be bad news as Windows will at times just go fucking nuts, as it pokes around looking for something, then basically says "ah, fuck it! You want a pointer to an object? OK, here's your fucking pointer!!!!", and proceeds to point to something like, oh, I don't know, an empty spot in memory? Can you say "blue screen of death"? I knew you could.
So, bottom line, error checking it a good thing.
Turns out the one function I use simply opens the supplied Windows Event log, and if it fails, it returns what they call a NULL value. I'm thinking, "Great! Doesn't get much simpler than this. All I got to do after the function call is to check if the returned value is NULL. It it's NULL, then print out an error message, and have the program exit".
But noooooo! Of course it can't be that easy. Wouldn't be Windows if something actually worked as expected!
What happens is that all compiles just fine, and the program runs just fine and dandy. Then, to test out the error checking, I supply a name for an event log that does not exist. Obviously if the function tried to access an Event log that does not exist, it HAS to come back with a NULL value... that's the way it's suppose to work. So, what does my program do? It moves merrily along with a returned value that is not NULL, meaning it was happy to open the Event log that does not even fucking exist! What the fuck, is this thing on crack!
I don't know, maybe another few days of banging my head against the wall will get this resolved. Either that, or an uzi to the fucking PC!
Thursday, March 13, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment