Results 1 to 7 of 7

Thread: Newbie Forum

  1. #1
    Senior Member Regular Contributor
    Join Date
    Nov 2002
    Location
    USA
    Posts
    254

    Newbie Forum

    This Forum is Dedicated to Newbie's that are new to OpenGL Programming and that have questions about OpenGL, GLUT, C++, and/or Anything Else.

    Welcome.

    - VC6-OGL

  2. #2
    Halcyon
    Guest

    Re: Newbie Forum

    Ok...i don't mean to seem rude about it....and i'm sorry if i do...but isn't this why it's called the beginners forum? But yeah it's nice that u actually made this post, because sometimes I read a few threads that are SO OVER my head and i wonder if i'm even good enough to BE a beginner. But hey...this is what the forum is for

  3. #3
    Guest

    Re: Newbie Forum

    hello.
    i'm trying to show a dialog box WITHOUT using MFC.
    do you know how?

  4. #4
    Halcyon
    Guest

    Re: Newbie Forum

    First of all i see what you were trying to do...I thought you were telling everyone that this is where you make those kinda posts (the whole forum...not just this thread) So sorry about that.

    To Allon: http://www.gametutorials.com/Tutoria.../Win32_Pg2.htm

    This is a good place to start...you have to scroll down a little bit to get there. Basically you create it like any other resource and then make a 'wndProc' procedure to handle all of it's messages...except you can call it anything u like (usually WndProc is taken up by the main window so it's something else ) Well hope it helps...that's a great site of opengl tutorials too!!

  5. #5
    Senior Member Regular Contributor
    Join Date
    Nov 2002
    Location
    USA
    Posts
    254

    Re: Newbie Forum

    Allon > Are you trying to create a Dialog Box using a resource script or not?

    - VC6-OGL

  6. #6
    Halcyon
    Guest

    Re: Newbie Forum

    To VC6-OGL: I think allon is using the dialog as a resource, but I think what he needs help with is doing it in Win32 instead of MFC. But i'm not sure...i'm not super good at Win32 either. I cant get everything i need done and that's about it.

    Say is there a way to make dialog boxes without having them as resources?? Sorry I don't know much about Win32...just what i need to make a window, buttons and all that fun stuff.

    - Halcyon

  7. #7
    Senior Member Regular Contributor
    Join Date
    Nov 2002
    Location
    USA
    Posts
    254

    Re: Newbie Forum

    Here is a Sample Win32 Window without a resource:

    #include <windows.h>

    /* Functions */
    ///////////////
    LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
    const char ClassName[ ] = "Dialog";
    ///////////////

    /* Variables */
    ///////////////
    HWND hWnd;
    HWND button_hWnd[2];
    HINSTANCE hInstance;
    const int button_ok = 1;
    const int button_cancel = 0;
    static int xpos, ypos;
    ///////////////

    int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) {
    HWND hWnd;
    MSG messages;
    WNDCLASSEX wincl;
    hInstance = hInstance;
    wincl.hInstance = hInstance;
    wincl.lpszClassName = ClassName;
    wincl.lpfnWndProc = WndProc;
    wincl.style = CS_VREDRAW | CS_HREDRAW;
    wincl.cbSize = sizeof( WNDCLASSEX );
    wincl.hIcon = LoadIcon( NULL, IDI_APPLICATION );
    wincl.hIconSm = LoadIcon( NULL, IDI_APPLICATION );
    wincl.hCursor = LoadCursor( NULL, IDC_ARROW );
    wincl.lpszMenuName = NULL;
    wincl.cbClsExtra = 0;
    wincl.cbWndExtra = 0;

    wincl.hbrBackground = ( HBRUSH ) COLOR_BACKGROUND;

    if( !RegisterClassEx( &wincl ) ) {
    MessageBox( NULL, "Could not register", "ERROR", MB_OK | MB_ICONERROR );
    return 0;
    }

    xpos = GetSystemMetrics( SM_CXSCREEN );
    ypos = GetSystemMetrics( SM_CYSCREEN );

    hWnd = CreateWindowEx(
    0,
    ClassName,
    "Dialog",
    WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
    ( ( xpos / 2 ) - 143 ),
    ( ( ypos / 2 ) - 102 ),
    286,
    177,
    HWND_DESKTOP,
    NULL,
    hInstance,
    NULL );

    ShowWindow(hWnd,nCmdShow);

    while( GetMessage( &messages, NULL, 0, 0 ) ) {
    TranslateMessage( &messages );
    DispatchMessage( &messages );
    }
    return messages.wParam;
    }

    LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {
    switch(message) {
    case WM_CREATE: {
    button_hWnd[1] = CreateWindow( "Button","OK",WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,180,20,80,22,hWnd,(HMENU) button_ok,hInstance,NULL );
    button_hWnd[2] = CreateWindow( "Button","Cancel",WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,180,50,80,22,hWnd,(HMENU) button_cancel,hInstance,NULL );
    break;
    }

    case WM_COMMAND: {
    if( HIWORD( wParam ) == BN_CLICKED ) {
    switch( LOWORD( wParam) ) {
    case button_cancel:
    DestroyWindow( hWnd );
    break;
    }
    }
    break;
    }

    case WM_DESTROY: {
    PostQuitMessage(0);
    break;
    }
    default:
    return DefWindowProc( hWnd,message,wParam,lParam );
    break;
    }
    return 0;
    }

    - VC6-OGL

Similar Threads

  1. Cad forum ?
    By HanWu in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-25-2004, 03:26 AM
  2. Feeble minded newbie invades the real forum, got to do it.
    By Eber Kain in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-15-2001, 05:35 PM
  3. Help Forum or Fudge Forum 2?
    By ironduke in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 07-04-2000, 07:07 AM
  4. Help Forum or Fudge Forum 2?
    By ironduke in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 06-29-2000, 08:11 PM
  5. Help Forum or Fudge Forum?
    By ironduke in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 05-17-2000, 02:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean