CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: dialog-based

  1. #1
    Join Date
    Apr 2002
    Posts
    6

    Question dialog-based

    Hi, everbody. I need a simple example or a tutorial at leaset some words about the following subject.

    How could I create a windows program that does not have a clasic window but only a dialog that I could use it as my main window for a simple application and use it from system tray.

    thanx ..

  2. #2
    Join Date
    Apr 2003
    Location
    Hyderabad,India
    Posts
    486

    Here is some Help..

    Hi,
    regarding Dialog Based applications,
    while creating your project
    Select MFC appWizard (exe)
    give some name to your project
    click next

    Select "Dialog Based Application" radio button in step 1

    it starts a project just based on dialog based.
    regarding System tray..
    there are vast number of sample applications done by some good guys.. So I feel you need not re descover anything.
    visit
    http://www.codeguru.com/shell/tbhide.html

    for more articles http://www.codeguru.com/shell and scroll down to Tray section where you can find few more samples.
    or you can search on net with related key words which may give your more broader view of the problem

    cheers
    harinath
    Thanks n Regards
    Harinath Reddy
    Learn Hello World Program
    A good scientist is a person with original ideas. A good engineer is a person who makes a design that works with as few original ideas as possible. There are no prima donnas in engineering. - Freeman Dyson

  3. #3
    Join Date
    Dec 2002
    Location
    La Plata, Buenos Aires
    Posts
    615
    Heres a sample Win32 WinMain function which uses DialogBox instead of CreateWindowEx to create a main dialog box:

    Code:
    int WINAPI WinMain (HINSTANCE hInstance,
    					HINSTANCE hPrevInstance,
    					LPSTR lpCmdLine,
    					int nCmdShow)
    					
    {
    	g_hInst = hInstance;
    	// show dialog-box
    	int dlgResult = DialogBox (g_hInst, MAKEINTRESOURCE(IDD_DLGMAIN), NULL, DlgProc);
    	return 0;
    	
    }
    This is for a dialog created in the Resource Editor named IDD_DLGMAIN (see the MAKEINTRESOURCE macro there).

    You need the dialog procedure for this to work:

    Code:
    BOOL CALLBACK DlgProc (HWND hwndDlg, UINT uMsg, WPARAM wparam, LPARAM lparam)
    {
    	switch (uMsg)
    	{
    		
    	case WM_INITDIALOG:
    ... (process messages here)
    return TRUE;
    
    }
    Process the dialog buttons with the EndDialog function.

    You should have a good start from here... look at MSDN for more info...

    Good coding.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured