Thread: Dialog box, I created it... but I can't see it.

  1. #1
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Question Dialog box, I created it... but I can't see it.

    The dialog box never shows up!!?! Oh by the way I'm using this tutorial:

    http://sunlightd.virtualave.net/Wind...alogBoxes.html

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Downloaded the code..opened it in VC++ (as that's what Sunlight used for coding it).....works AOK for me...

    Might I guess that you are not using VC++???

    If you are porting it to another compiler like CodeWarrior, Devc++ or Borland, be careful that the

    MAKEINTRESOURCE(IDD_DIALOG1)

    in the call to DialogBoxParam actually refers to the dialog box in your project...some resource editord store the identifier of a resource as a string.....but MSVC prefers them as an int......

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Originally posted by Fordy
    some resource editord store the identifier of a resource as a string.....but MSVC prefers them as an int......
    Borland does too.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    nope...

    i'm using borland and i did what you said and it still doesn't come up...

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: nope...

    Originally posted by drdroid
    i'm using borland and i did what you said and it still doesn't come up...
    Ok.....make the following change to your _tmain func...

    Code:
    int _tmain(void)
    {
    	TCHAR buff[50];
    	int x = DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1), 
    		NULL, (DLGPROC)MainDialogProc, 0);
    	if(x== -1){
    		wsprintf(buff,"Error - %d",GetLastError());
    		MessageBox(NULL,buff,NULL,MB_OK);
    	}
    	
    
    	return 0;
    }
    If you dont have a dialog, you shoud get a messagbox.....tell me what that messagebox says...

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Sorry...had to edit tha above code after posting...make sure it says IDD_DIALOG1...not 20

  7. #7
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    ...

    doesn't work

  8. #8
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    ...

    the window doesn't come up at all... for thoughs new to this thread.

  9. #9
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Post your code?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. Parent of a BrowseForFolder dialog box
    By @nthony in forum Windows Programming
    Replies: 4
    Last Post: 01-08-2007, 02:54 PM
  3. How to program a "back" button with MFC
    By 99atlantic in forum Windows Programming
    Replies: 3
    Last Post: 04-26-2005, 08:34 PM
  4. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM