athlon32 56 Junior Poster in Training

Is this your first time with GUIs??? If so, i suggest learning Gtk+ first, it makes understanding Win32 much easier

Technically, you could make a window with just this:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int CmdShow)
{

    MessageBox(NULL, TEXT("First Program"), TEXT("First"), MB_OK );

    return 0;
}

But normally a Win32 window looks like this:

#include <windows.h>

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
  MSG  msg ;    
  HWND hwnd;
  WNDCLASS wc;
	
  wc.style         = CS_HREDRAW | CS_VREDRAW;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = 0;
  wc.lpszClassName = TEXT( "Window" );
  wc.hInstance     = hInstance ;
  wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
  wc.lpszMenuName  = NULL;
  wc.lpfnWndProc   = WndProc;
  wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
  wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
  
  RegisterClass(&wc);
  hwnd = CreateWindow( wc.lpszClassName, TEXT("Window"),
                WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                100, 100, 250, 150, NULL, NULL, hInstance, NULL);  

  ShowWindow(hwnd, nCmdShow);
  UpdateWindow(hwnd);

  while( GetMessage(&msg, NULL, 0, 0)) {
    DispatchMessage(&msg);
  }
  return (int) msg.wParam;
}

LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
  switch(msg)  
  {
    case WM_DESTROY:
      {
        PostQuitMessage(0);
        return 0;
      }
  }
  return DefWindowProc(hwnd, msg, wParam, lParam);
}

seems like a lot of crap for just a simple window, right? Well everything in that example has a purpose.

This explains it very well:
http://zetcode.com/tutorials/winapi/window/

As for a good tutorial look at this one:
http://zetcode.com/tutorials/winapi/

athlon32 56 Junior Poster in Training

Welcome to Linux!

First of all not all programs for Linux are open source!!! Infact, in some cases it is illegal to look at certain programs source code!!! (just thought I'd mention that)

>I haven't really seen anything
Your probably not looking right...for example...in Ubuntu you can view the Linux Kernel source code by going to the directory: /usr/src/ cd /usr/src generally when you install a program, you don't really work with the source code(you work with binaries), unless you compile it, almost always the project supplies the source code in a separate tarball for downloading, you just gotta find them.

A good example of this is the mozilla FTP server:
the binaries are located here:
ftp://ftp.mozilla.org/pub/firefox/releases/3.5rc3/linux-i686/

and the source is here:
ftp://ftp.mozilla.org/pub/firefox/releases/3.5rc3/source/

get it?

Sometimes however, programs installed also will bring the source, this is generally stored in a directory called "src"

for example there might be a pidgin/src/ or mozilla/src/ directory on your system. Those would hold source code

Just for your reference
/bin - binaries
/lib - libraries
/src - source

> When applied to a folder, the execute permission has nothing to do with
running programs. Instead, the execute permission controls who can
access or modify the small folder file.

That just means if you have a program located in a file, and you aren't allowed to access that folder, you can't run that …

valinux commented: Thanks a lot. That explained it really well. I read that bit about the binaries and compiling it, but it didn't make sense before. Thanks again. +1
athlon32 56 Junior Poster in Training

>I'll try to help you to the best of my abilities, and if I did help you, please add to my
>rep ;D
ROFL.
I think begging is against rules or something isn't it?
Even I would have put that to my signature if DaniWeb could redeem those points with equivalent dollars ;)

I'm not begging, it's just a friendly reminder ;)

Salem commented: Yes, far too much stuff goes "unsolved" and unrecognised +36
athlon32 56 Junior Poster in Training

Oh no please. Not Sams teach X in Y days. I hate it.
Read this : Teach Yourself Programming in Ten Years by Peter Norvig
. An excellent article to reply Sams

Hey man! Those books rock. Sure you can't become a pro overnight, but those books really do help build solid foundations

iamthwee commented: *nods* +21
athlon32 56 Junior Poster in Training