Clear up this code if you have time!

This is a discussion on Clear up this code if you have time! within the Windows Programming forums, part of the Platform Specific Boards category; Can someone clear up this code so it will compile in visual c++ 6.0 #include <windows.h> #include <tchar.h> #include "resource.h" ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    3

    Clear up this code if you have time!

    Can someone clear up this code so it will compile in visual c++ 6.0

    #include <windows.h>
    #include <tchar.h>
    #include "resource.h" //this is a basic dialog box with a ok and cancel button

    BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    switch (uMsg)
    {
    case WM_COMMAND:
    return MainDialog_OnCommand(hWnd, LOWORD(wParam), HIWORD(wParam), (HWND)lParam);
    case WM_CLOSE:
    EndDialog(hWnd, 0);
    return TRUE;
    }
    return FALSE;
    }

    BOOL MainDialog_OnCommand(HWND hWnd, WORD wCommand, WORD wNotify, HWND hControl)
    {
    switch (wCommand)
    {
    case IDOK:
    MessageBox(hWnd, _T("Bye-bye world!"), _T("Sample Application"), MB_OK);

    // fall through

    case IDCANCEL:
    EndDialog(hWnd, wCommand);
    break;
    }
    return TRUE;
    }

    int _tmain(void)
    {
    DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainDialogProc, 0);
    return 0;
    }

  2. #2
    Banned Cgawd's Avatar
    Join Date
    Oct 2002
    Posts
    405
    clean up ur messagebox

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    3

    New Thread on Message box

    You say clean up my message box. Well I don't know what you mean... You have to explain it like I am a little kid... What should I right...

  4. #4
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    > You say clean up my message box.
    For what it's worth, here's a message box's code.
    Code:
    #include <windows.h>
    
    int main ( void )
    {
    	char * Program = "c:/program files/internet explorer/iexplore.exe http://VortexOfTech.cjb.net"
    	char * MsgBoxMsg = "Would you like to see my website?";
    
    	if ( MessageBox ( NULL, MsgBoxMsg, "Website plug", MB_YESNO ) == IDYES )
    	{
    		WinExec( Program, SW_SHOW );
    		printf("Processing..\n");
    	}
    	else
    	{
    		MessageBox( NULL, "Fine", "You're no fun.", "Fine", 0 );
    	}
    	return 0;
    }
    Last edited by Shadow; 11-25-2002 at 10:13 AM.
    The world is waiting. I must leave you now.

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    People are more likely to help you if you follow the board guidelines for posting code, i.e. with code tags, look in the FAQ for details.

    Another thing, if I copy and paste your code into VC++ and try to compile it, it will fail. Why? Because I do not have your resource file and header file do I!
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #6
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    Another thing, if I copy and paste your code into VC++ and try to compile it, it will fail. Why? Because I do not have your resource file and header file do I!
    He's right.
    I already went through that myself.

    Tried to help...didn't have all infrormation needed.
    The world is waiting. I must leave you now.

  7. #7
    Emotionally Unstable DarkViper's Avatar
    Join Date
    Oct 2002
    Posts
    343
    Code:
    #include <windows.h>
    
    MessageBox(NULL, "this is my messagebox", "MINE!", MB_OK);
    return 0;
    this is about as advanced message box i can do on my own, so i cant help
    ~DJ DarkViper signing out
    ----------------------------------------
    My Site:
    Black Jaguar Studios

    Languages:
    Fluent English, Starter German, HTML, Javascript, Actionscript, Intermediate PHP

    Verteran Despiser of: ASP, Java, BASIC, Pascal, Cobalt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sending an email in C program
    By Moony in forum C Programming
    Replies: 28
    Last Post: 10-19-2006, 11:42 AM
  2. obscure code and clear code
    By lo_tek in forum C Programming
    Replies: 5
    Last Post: 04-19-2004, 12:57 AM
  3. Killing someones grandparents
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 37
    Last Post: 09-07-2003, 08:56 AM
  4. Results - 4th contest, saturday, august 11
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 08-12-2002, 10:41 AM
  5. clear screen code, can't get it to work
    By Unregistered in forum C++ Programming
    Replies: 11
    Last Post: 01-25-2002, 01:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21