0
theonlyski

WTF Microsoft?

Recommended Posts

Why make the coding so damn difficult to do simple shit.

http://msdn.microsoft.com/en-us/library/ff381409(v=VS.85).aspx

This is the code for a simple, empty window:



#ifndef UNICODE
#define UNICODE
#endif

#include

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
// Register the window class.
const wchar_t CLASS_NAME[] = L"Sample Window Class";

WNDCLASS wc = { };

wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;

RegisterClass(&wc);

// Create the window.

HWND hwnd = CreateWindowEx(
0, // Optional window styles.
CLASS_NAME, // Window class
L"Learn to Program Windows", // Window text
WS_OVERLAPPEDWINDOW, // Window style

// Size and position
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,

NULL, // Parent window
NULL, // Menu
hInstance, // Instance handle
NULL // Additional application data
);

if (hwnd == NULL)
{
return 0;
}

ShowWindow(hwnd, nCmdShow);

// Run the message loop.

MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return 0;
}

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;

case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);

FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW+1));

EndPaint(hwnd, &ps);
}
return 0;

}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}


I mean, WTF? I can do the SAME thing with AutoIT by doing something like:



MsgBox(0, "Learn to Program Windows")


I dont see why they have to make everything so damn difficult.

Ofcourse, the last time I coded C++ was Borland C++, and it was a DOS based app.
"I may be a dirty pirate hooker...but I'm not about to go stand on the corner." iluvtofly
DPH -7, TDS 578, Muff 5153, SCR 14890
I'm an asshole, and I approve this message

Share this post


Link to post
Share on other sites
Quote

Quote


Ofcourse, the last time I coded C++ was Borland C++, and it was a DOS based app.


That might have something to do with it. ;) Definitely more complicated though.


That was the last time I coded C++ I've written other apps for Windows since then, just figured I should learn how to do MS Visual stuff... didn't realize it takes 50 lines of code to put up an empty window.
"I may be a dirty pirate hooker...but I'm not about to go stand on the corner." iluvtofly
DPH -7, TDS 578, Muff 5153, SCR 14890
I'm an asshole, and I approve this message

Share this post


Link to post
Share on other sites
Quote

I dont see why they have to make everything so damn difficult.



There are a lot of fascinating things that you can do
with computers. However, in the real world, the goal is to get one to perform a function in a clear and cost-effective fashion.

That is why computers use high-level languages instead of assembler. 85% of coding dollars are spent on maintenance of existing systems, not primary development.

To this day, I love Basic. Easy to code and maintain.

Share this post


Link to post
Share on other sites
Quote


To this day, I love Basic. Easy to code and maintain.



+1

I learned how to program on an Apple IIe using 10 lines

10 Print Hello.

:D Ahh, the good old days.
"I may be a dirty pirate hooker...but I'm not about to go stand on the corner." iluvtofly
DPH -7, TDS 578, Muff 5153, SCR 14890
I'm an asshole, and I approve this message

Share this post


Link to post
Share on other sites
Quote

Quote


To this day, I love Basic. Easy to code and maintain.



+1

I learned how to program on an Apple IIe using 10 lines

10 Print Hello.

:D Ahh, the good old days.


I started using it on machines that no longer exist.
"IF A = B" is a lot better than whatever garble that C uses. I still think C was a practical joke of some sort. :D

I use VB for quick stuff in Excel, and sometimes Access. One of the more popular QA products uses VB also.

Share this post


Link to post
Share on other sites
Quote

Quote

Quote


To this day, I love Basic. Easy to code and maintain.



+1

I learned how to program on an Apple IIe using 10 lines

10 Print Hello.

:D Ahh, the good old days.


I started using it on machines that no longer exist.
"IF A = B" is a lot better than whatever garble that C uses. I still think C was a practical joke of some sort. :D

I use VB for quick stuff in Excel, and sometimes Access. One of the more popular QA products uses VB also.


Yeah, I think I might go to VB, I dont really like how C++ has their structure set up.
"I may be a dirty pirate hooker...but I'm not about to go stand on the corner." iluvtofly
DPH -7, TDS 578, Muff 5153, SCR 14890
I'm an asshole, and I approve this message

Share this post


Link to post
Share on other sites
I've worked with both and a lot of people would call me crazy but unless you are programming something extremely in depth I.e. Video games or something physics based then I would go vb all the way. It's easier to program, easier to maintain, manages memory automatically, and with the added control of adding pre-coded controls it's a no brainer.

Share this post


Link to post
Share on other sites
Quote

Yeah, I think I might go to VB, I dont really like how C++ has their structure set up.



C++ had two basic goals. It was supposed to provide
a higher level language based on C. It wasn't supposed to have
all the stupid memory leaks that would lock the operating system.

"They're not record layouts, they're structures."
Oh, look, a new word for the same thing. :S

Share this post


Link to post
Share on other sites
Quote

$10 is two good beers.
Almost a skydive.
;)



Seeing as I can't drink alcohol here, and no DZ around for many, many miles... rules those two out.
"I may be a dirty pirate hooker...but I'm not about to go stand on the corner." iluvtofly
DPH -7, TDS 578, Muff 5153, SCR 14890
I'm an asshole, and I approve this message

Share this post


Link to post
Share on other sites
Quote

Where did you find that deal at?



Normiss is right, got it via the army HUP. I'd give details, but you need a .mil email address to get it.
"I may be a dirty pirate hooker...but I'm not about to go stand on the corner." iluvtofly
DPH -7, TDS 578, Muff 5153, SCR 14890
I'm an asshole, and I approve this message

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

0