Click here to Skip to main content
15,887,596 members
Everything / Dialog

Dialog

dialog

Great Reads

by Michael Chourdakis
C++, Direct2D, one function and you got a nice picker
by veen_rp
A small JavaScript module to create a modal dialog box or user input box in the familiar .NET style
by Howard 9448490
Windows Forms Print Dialog for rich text with accurate page preview and zooming
by Andy Point
Android Alert Dialog Tutorial : Working with Time Picker, Date Picker and List Dialogs In this tutorial we will discuss how to use dialogs and alerts in Android Apps. A Dialog is a small popup shown to the user to get some additional information from the user or ask him to make some decision. Alert

Latest Articles

by Member 16179004
Capture Enter key in edit control with no dialog box and no subclass.
by ToughDev
Retro68 GCC-based SDK for 68K Mac
by Roger65
How to type text into a static control, change the font used and then save it into a bitmap
by Evoluteur
A web color picker which looks like the one in Microsoft Office 2010

All Articles

Sort by Score

Dialog 

2 Jun 2020 by Michael Chourdakis
C++, Direct2D, one function and you got a nice picker
13 Oct 2017 by veen_rp
A small JavaScript module to create a modal dialog box or user input box in the familiar .NET style
13 Aug 2020 by Howard 9448490
Windows Forms Print Dialog for rich text with accurate page preview and zooming
18 Jan 2011 by creizlein
Is there any way to programmatically call and host the default property dialog for a file and/or for a service ? So far I haven't found anything related but I'm pretty sure that there has to be a way; at least using some Win32 API calls.As answers start to appear i found that display the...
18 Jul 2016 by Andy Point
Android Alert Dialog Tutorial : Working with Time Picker, Date Picker and List Dialogs In this tutorial we will discuss how to use dialogs and alerts in Android Apps. A Dialog is a small popup shown to the user to get some additional information from the user or ask him to make some decision. Alert
21 Mar 2022 by Roger65
How to type text into a static control, change the font used and then save it into a bitmap
26 Jan 2024 by Member 16179004
Capture Enter key in edit control with no dialog box and no subclass.
29 May 2010 by Nuri Ismail
Here is an example for you that will enable/disable the close button in runtime:BOOL bEnable = FALSE; // TRUE to enable and FALSE to disable//.....UINT nMenuf = bEnable ? (MF_BYCOMMAND) : (MF_BYCOMMAND | MF_GRAYED | MF_DISABLED);CMenu* pSysMenu =...
17 Jan 2012 by Jochen Arndt
This is usually done calling DoModal() of your dialog and using the return value:if (condition){ CMyDialog Dlg; if (Dlg.DoModal() == IDOK) { // OK pressed } else { // Dialog cancelled }}
29 May 2013 by Surendra Adhikari SA
Implimenting a message box that closes automatically using thread.
5 May 2010 by fdkhb
Hello, I am looking forward to create a property page like CFileDialog's interface(listing files and selecting folders), but not intend to use shell ctrl. There are some suggestion to handle it by subclasswindow method, but I don't know how to do it exactly. So hope for your help. Thank you!
29 Sep 2010 by Sandeep Mewara
Post the same here: CP Article writing Forum[^].Moderators keep a continous watch over there - uyou would get back exact needed reply very soon. :thumbsup:
8 Dec 2010 by ARopo
I found this thread, it suggests using the windows API GetOpenFileName, which you can change the size of unlike the .NET version.http://www.dotnet247.com/247reference/msgs/17/86277.aspx[^]
18 Jan 2011 by Nish Nishant
One easy way to show file/folder properties is via ShellExecute. See:A newbie's elementary guide to spawning processes[^]Scroll down a bit to see how this is done.Not sure what you mean by property dialog for a service though.
18 Jan 2011 by Nuri Ismail
In addition to Nish's answer here[^] is a C# example of using ShellExecute to display a file property dialog. :)
15 Jun 2011 by barneyman
wrap the text in _T(), you're working with wide strings, and giving Format a narrowm_dbFeeAmt.Format(_T("%.2f"), FeeAmt); // Errorm_dbPkUpAmt.Format(_T("%.2f"), PickupAmt); // Error(nods to SA)The _T() macro is extremely useful, it substitutes as appropriate, for the string...
1 Mar 2012 by Richard MacCutchan
The short answer is "No", as the standard for a dialog box is set in the Windows class used to create it. However, you could possibly use a standard Window of your own design and modify its shape by Window Skinning[^] to achieve what you want.
7 May 2013 by Aydin Homay
This tip/trick discusses about hosting a Windows Form user control in an MFC dialog box and View windows.
13 Jun 2013 by Deepali Dhingra
This tip explains how to create a to do or Shopping List app with listview, sqlite, dialog and customadapter
4 Apr 2014 by KarstenK
you must transform with the right HWNDHWND hParent = GetParent(hwnd);ClientToScreen( hwnd, &ptTreeUL );ClientToScreen( hwnd, &ptTreeLR );//dont write such code ;-)ReleaseDC( GetParent(hwnd), pDC );tip: create the bitmap globally once to improve performance
11 Jun 2015 by Richard Deeming
This thread on StackOverflow seems to have the answer:http://stackoverflow.com/a/19174721/124386[^]Create an include file called resource.h and add this line to it:#define IDD_ABOUT 100Then include it at the top of your .cpp and .rc files:#include "resource.h" // add this...
11 Jun 2015 by Afzaal Ahmad Zeeshan
You need to first call the getView() function to get the view of the fragment and then you can call the findViewById(). Like this, private EditText city = (EditText) getView().findViewById(R.id.cityDialog);Now it should work. Or you can use the getActivity() for the fragment...
13 Jun 2018 by Patrice T
Quote: yes i want to click the button from code. if variable entered in edit control box is even then button get clicked. This is a bad idea ! Imagine the user want to enter the even number 123456. As the user type the number, you have: 1 => odd 12 => even 123 => odd 1234 => even 12345 => odd...
23 Jan 2019 by Michael Haephrati
If you go over all Windows styles[^], and Extended Windows Styles[^], you should find the answer. Also you can remove the close button using the following code (assuming you get a handle to hwnd): HMENU hMenu = GetSystemMenu( hWnd, 0 ); int nNbItems = GetMenuItemCount(hMenu); ...
12 Mar 2020 by phil.o
You could give Form2 a constructor accepting an enumeration of integers as parameter, which you would use to populate the second listbox: public Form2() { InitializeComponent(); } public Form2(IEnumerable values) : this() { ...
12 Mar 2020 by Maciej Los
In addition to @phil.o solution, i'd suggest to read these very interesting tips/articles: Transferring information between two forms, Part 1: Parent to Child[^] Transferring information between two forms, Part 2: Child to Parent[^] Transferring...
5 May 2010 by CPallini
You may find this DavidCrow's article [^] helpful. :)
13 May 2010 by Sauro Viti
Just replace:m_txtImageCtrl.SetWindowText( _T("0/0" ));with:if (::IsWindow(m_txtImageCtrl.m_hWnd)) m_txtImageCtrl.SetWindowText( _T( "0/0" ));
18 May 2010 by Jeson.DJ
My project is a MFC project based on dialogs. The class name of my parent dialog is CdialogchangDlg and my child dialogs are CPicture2 and CPicture3. I can access my child dialogs. Now I want to go to another child dialog from one child dialog, I use buttons to do this.The code is:void...
18 May 2010 by Chris Meech
You are just filling the stack up with CPicture2 and CPicture3 dialogs. Eventually you will run out of resources. I would recommend that instead of switching from child to child, have the parent create modeless dialogs instead. :)
7 Dec 2018 by vivek.chauhan2009
Hi,how to disabled close button in a simple dialog?ThanksVivek chauhan
6 Sep 2010 by Richard MacCutchan
You should add the color.dlg resource to your project's resource file and add or modify the controls to meet your own requirements. Then add a callback function to handle messages raised by the new controls. The dialog operates much the same as a user defined dialog but with the additional...
22 Oct 2010 by Nish Nishant
Use PostMessage to send a user defined message to the main thread/dialog, and in the handler for that, update the UI.
28 Oct 2010 by JF2015
Your icon file "res\icon.ico" should have the standard resolutions (16x16, 32x32) that may be needed for the Windows desktop. You can add them to your icon file by using one of the free icon editors from the internet.
5 Nov 2010 by ARopo
Have you tried, for testing purposes, doing the initialisation after on Init Dialog, e.g. on a button press or a timer tick. I suspect the problem is to do with it being in onInitDialog.If it works in thuis scienario , you could consider disabling the dialog in OnInitDialog, then doing your...
23 Nov 2010 by Versile
Add an InstallerClass to your main project, then Custom Actions of your Setup file will call it. On the properties of the InstallerClass you can execute AfterInstall, BeforeInstall, etc. You can pop up a form here (though this is bad form and SEPERATE from your installation, i.e. very difficult...
8 Dec 2010 by User 7429338
A good alternative could be to put all file names in a text file, and then accept that text file as your program's input.
9 Dec 2010 by Prerak Patel
You should allow user to pick the directory. Then you list all the files and let them select as many files, there will not be any problem.I am talking the same way as ftp clients are designed.http://screenshots.en.softonic.com/en/scrn/40000/40069/3_fireftp1.jpg[^]
29 Jan 2011 by weylspinor
Dear Colleagues,I'm attempting to use a dialog box to select the filename of an AVI file that I want to use in OpenCV. The OpenCV function is called: cvCaptureFromAVI. To create the Open File dialog box, I am using the Windows function:GetOpenFileNameI suspect that the trouble I am...
22 Apr 2011 by DannyStaten
Ok I figured out what is happening. The button that executes the show modal actions is inside a wpf popup control. I modified the popup to StaysOpen="false". So the popup hides the moment it loses focus (when the modal shows up) and thus the context that called the modal is killed so it just...
22 Apr 2011 by Sergey Alexandrovich Kryukov
A side note: Don't write return "", use string.Empty (or null if you wish). Avoid immediate constants (such as "") in all cases.—SA
27 May 2011 by Not Active
I think if you researched patterns like MVC or MVVM you would get a solution. Anything that required access or manipulation of a UI element should, of course, be in the form or dialog. Anything else can be moved to an external class so it can be used in any situation. Use databinding to...
6 Jun 2011 by Resmi Anna
suppose you have l_DailogData in your MyProjectDoc.cpp. suppose Its type is CString.Now what you have to do is1.Add a member variable to your CresultDlg class, CString m_DailogData2.write a member function of your CresultDlg class void SetData(CString str) { m_DailogData = str;...
15 Jun 2011 by Sergey Alexandrovich Kryukov
You use immediate string constant in the form of literal "%.2f". For C++ this is an array or string of char, but your Format function require wchar_t.So, prefix the string literal by 'L' to fix it: use L"%.2f".—SA
30 Jun 2011 by Albert Holguin
All you have to do is reload the dependent combobox every time the user selects something on the first.Topics to research:Load CComboBox Dynamically[^]Capture user selection in CComboBox[^]A couple of different approaches you can take on the dependent box:- Leave it blank until...
17 Jan 2012 by CPallini
In a glance, you need a modal dialog. I think there's a plethora of tutorials[^] on the web.
17 Jan 2012 by Albert Holguin
This is trivial... If you only need to display information, use a AfxMessageBox() (it's easy to use), if you need a dialog, then make a dialog derived from the CDialog MFC class and use the CDialog::DoModal() method to bring up the dialog (this is if you want to make it modal, to make it...
26 Jan 2012 by Sergey Alexandrovich Kryukov
In the data fields like the text box or a file dialog, all path names are read as is, with not backslash escaping or other foolishness. Such escaping is only needed in source code string literals, due to C, C++ or C# syntax.However, in the past I saw a lot of really brain-damage C and C++...
8 Feb 2012 by Eugen Podsypalnikov
Please try to set the same (or another special) fontat the WM_INITDIALOG part of ActivateWlsMsgDialog :)
23 Feb 2012 by SandipG
Please read this[^] article. I hope it helps.
12 Apr 2012 by Diego2la
Hi!I create Cdialog which contain different handlers. On this Cdialog I create CSizingControlBar: resizable control bar(who can dragged outside Dailog) So, can I use Cdialog only as event handler and not to call .doModal() for him? In other words, I whant not to show Cdialog but his...
12 Apr 2012 by TRK3
I'm not sure that what you are asking is the best way to do what you want. I'd think if you don't actually want to show the CDialog, then you'd create the CSizingControlBar in some other parent window and use the handler there. In any case, to answer your question:If you don't want to...
18 Dec 2012 by Jibesh
use the same Instance second time. do not create new instance each time you display the color dialog.If you want to clear the selection, call the selection method of ColorDialog.
11 Dec 2013 by bbirajdar
I have a Gridview and I am using the Base Admin Bootstrap HTML 5 theme from here Base Admin Bootstrap theme[^]My Gridview code is as follows:
27 Feb 2014 by Member 3027893
I want the existing EnquireNow.cshtml View to be rendered on a JQuery-UI dialog on click of a link named 'Enquire Now' on my ProductDetails page.Following is the snapshot of the ProductDetailspage.$(function () { $('#dialogbox').dialog({ ...
12 Nov 2014 by barneyman
from some distant memory of this, try doing the adjustRect and child movewindow AFTER the insertion ... the tab control changes size ISTRBTW, you'll have to do an adjustRect, movewindow for all children after each insert (or once after a block insert), because the tabControl header resizes...
27 May 2015 by KarstenK
You must use the right formatter options and format it as a string. Like thattext.Format("0x%2X", theByte);Read the documentation
9 Mar 2017 by Jochen Arndt
You are creating a modeless dialog. In this case you must track the state of that dialog. Your existing code can be used as starting point:void CMy3D_Med_ViewerDlg::OnBnClickedShowDicomTag(){ m_DCMTagDlg.Create(IDD_DICOM_Tags, this); m_DCMTagDlg.ShowWindow(SW_SHOW); ...
23 Jan 2019 by Chopin2001
I don't know how to remove menubar from dialog that inherit CDockablePane, create by CreateEx function in mainframe of MDI(MFC). My Dialog's problem is have a menubar that have a 'X' icon for close. I want to remove that. Thanks. What I have tried: m_wndOptionBar.CreateEx(NULL, NULL, this,...
12 Jun 2018 by CPallini
Get the integer, say n, from the edit box. Check is n is even, namely: bool is_even = (n % 2 == 0); Call the button code (I would put it in a separate method say DoMyWonderfulAction and then call it appropriately both from code and the button). Please note, there are several ways to...
3 Oct 2018 by KarstenK
You need some common data, possible is it as member in a permanent class object (like the app or document) or as global object. You can this achieve via some PostMessage architecture and send the data as parameters, or as global model object which is accessable via pointers to both dialogs.
30 Dec 2009 by lyp2060
hi, guys how to change the background color of group box in dialog of MFC?there are several group boxes in my dialog, i want to change some of them to different color, how to do this?thanks
30 Dec 2009 by lyp2060
hi ,Pallini I used that method but nothing happens HBRUSH CTempDetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if(pWnd->GetDlgCtrlID()==IDC_STA1) ...
27 Jan 2010 by Christian Graus
You can use a function pointer to call a method back in your positioner, to tell it to update the values exposed by this child dialog, or you can use a timer. I assume the second dialog is modeless, otherwise there would be no problem, you'd just access properties you exposed.
31 Jan 2010 by voisdnull
Hello all,so I created a modeless dialog to display some results that update periodically (via resource script). I know that I can get the handle of the dialog by FindWindow("#32772","Results"). But, I want to make the class name to my modeless dialog box unique. I tried adding CLASS...
1 Feb 2010 by Richard MacCutchan
See this MSDN Documentation[^] on creating custom dialog boxes.
11 Feb 2010 by Abelk
Hi to all, I have been developing a project lately using VB.NET ... and some processes take time to finish and I want to display a progress dialog box or something to display a process is going on ...... and unfortunately I have no idea how to do it .... any one with ideas, comments,...
11 Feb 2010 by William Winner
It sounds like you're wanting a basic answer...not how to do multi-threading. It sounds like all you're asking how to do is show a ProgressBar. I could be wrong though. To do that, you add a StatusStrip to your form. Then, you can add a ToolStripStatusLabel or ToolStripStatusBar.You can...
17 Mar 2010 by dharshinicpriya
hello everyone.. I have just started learning vc++ and mfc. Im creating a simple project with Dialogbar. my question is how to set background color for the dialogbar. Plz help me out of this. thanks in advance.
17 Mar 2010 by Eugen Podsypalnikov
You could implement a reaction on WM_ERASEBKGND for your bar :) :...BEGIN_MESSAGE_MAP(CYourBar, CYouBarBase) ON_WM_ERASEBKGND()...END_MESSAGE_MAP() BOOL CYourBar::OnEraseBkgnd(CDC* pDC){ CRect cClientRect; GetClientRect(cClientRect); pDC->FillSolidRect(cClientRect,...
18 Mar 2010 by sksksksksksksks
In a dialog based application,I m having 2 threads one for reading a block from file1 and another for writing the block read from file1 into file2.The fopen()for *fp and *fpout for reading and writing file respectively defined in InitDialog().The 2nd thread is not writing anything but file...
18 Mar 2010 by Christian Graus
sksksksksksksk...
21 Mar 2010 by Avi Berger
If you have one thread for reading from an input file and a second thread for writing to an output file, it seems to me that having the thread that handles the file be the one that is responsible for opening and closing it makes sense. Since you are splitting the handling of the output file...
10 Apr 2010 by voisdnull
I'm trying to create a custom class name for my modeless dialog box.The following shows a snippet from my .rc file and the code to createthe dialog. Everything works fine until I get a NULL handle returnedwith CreateDialog (which I understand to be a wrapper forCreateWindowEx). The...
10 Apr 2010 by voisdnull
I figured it out. This is how I did it: HWND hwndDlg = NULL; WNDCLASSEX wcx; wcx.cbSize = sizeof(wcx); if(!GetClassInfoEx(hInst,"#32770",&wcx)) ErrorExit(TEXT("GetClassInfoEx")); wcx.lpszClassName =...
19 Apr 2010 by Richard MacCutchan
The first part is fairly simple as you should populate your listbox in the OnInitDialog() method. The second part will require obtaining the listbox handle and getting the current selection from it. However I do not think that using dialogs in this way is good design and would suggest you put...
19 Apr 2010 by @Intersect☺™
Let me understand ur prob:Dlg1 has 2 CommandButton as cmd1->which create Dlg2 with a pre populated Listboxcmd2->which will pass the Selected Value from Dlg2 to Dlg1 (this is where ur stucked, am I ri8?)Could you plz post ur cmd2 function, it will enable me to solve ur prob.I am...
4 May 2010 by K ARUN KUMAR
Got the solution with OnMoving(..) event handling..Here is the linkhttp://www.codeproject.com/Messages/3461670/Re-How-To-Restrict-Dialog-Box-in-an-SDI-to-be-With.aspx
15 May 2010 by vivek.chauhan2009
Hi all, I want WM_CTLCOLOR message send to dialog window with help of SendMessage. Please help me out, which parameter should I use with SendMessage(hWnd,WM_CTLCOLOR,----,----); I am just trying to change background color in window.ThanksVivek chauhan
5 May 2010 by Eugen Podsypalnikov
Please see CMFCShellTreeCtrl and CMFCShellListCtrl in the VS2008 MFC set :)(Since VS2010 is it also possibleto "mount" them directly in the resource view)
9 May 2010 by LittleYellowBird
I don't know if this helps but when I want to update a dialog box with 'real time' data I normally setup a timer to read and display the latest value. I'm not sure if that's is what you are asking, so I hope that helps. :)
10 May 2010 by harinathcau
Hi Alison,I have added timer to update Edit box. The following code i have in the timer function.void CSerialCommView::OnTimer(UINT_PTR nIDEvent){// TODO: Add your message handler code here and/or call default CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd(); CEdit*...
13 May 2010 by Radhakrishnan G.
Yes,I have too many controls to be subclassed with in the dialog,Is any other way than checking the handle.Now I used a boolean for this, it is set to true after CDialog::OnInitDialog()
16 May 2010 by krmed
Instead of calling Invalidate() after you set the text, try this:CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();CEdit* DispBox=(CEdit*)pFrame->m_wndDlgBar.GetDlgItem(IDC_DISPLAY_BOX);DispBox->SetWindowTextW(mystr);DispBox->UpdateWindow();That will cause only the edit control to...
19 May 2010 by Hellraiser123
HI, I have a MFC dialog which is a parent window. This dialog contains several child windows which are dialogs themseleves having other child controls like button, edit box etc. My problem is that I need to change the default behaviour of the Enter key such that, no matter which child...
1 Jun 2010 by Radhakrishnan G.
Is there any possibility of changing the parent of a modal dialog?I created a dialog from an application by calling DoModal() from a posted user message, But unexpectedly the parent of that dialog is not the main window of that application. Parent window is another application's...
1 Jun 2010 by Anthony Mushrow
I suppose you could use this:SetParent[^]It should do exactly what you want.
8 Jun 2010 by Itsuki Kuo
I want to know, how to put a border on a window (such as Kaspersky Sandbox) have? Does anyone know how to get this effect?I can draw and show window in XP. But Vista and Win7 have the Aero effect.So, how can I show the same effects when I use Windows 7?Thank you very much.
10 Jun 2010 by alij_juma
Hello,Try setting your form border style to none and use a container that has a border you can manipulate e.g. panel. Dock the container to fill the window 'borderless' window.Add your controls including a close, min and max button and code them appropriately.You should have your...
17 Jun 2010 by zwhate
I have written a program, it can run on Windows SP2 and SP3, but today it can not work correctly on one colleague's computer. I have tried other person's computer, where it always work well. So I use MessageBox to debug the program. When I use EndDialog to close a modal dialog, it failed and...
19 Jun 2010 by Jayant Dash
yeah u must call EndDialog in side the window procedure. Or else you can post a message to window procedure to exit your dialogOther wise you can use SendMessage to exit the windowpublic const int WM_COMMAND = 0x0112;public const int WM_CLOSE = 0xF060;SendMessage(pWnd, WM_COMMAND,...
18 Jul 2010 by 4288
Hi all, I have written a MFC application in Visual C++ and I'd like to add something like a fancy effect (a rotating 3D logo or something like that, I already have a logo to insert into) in the about window.For once, I am not asking for help solving a big programming trouble.. but I am...
18 Jul 2010 by 4288
A shaped window with scrolling text sounds good and not too bad to implement (I suppose)Thank you for the idea, I think I'll proceed this way
7 Sep 2010 by Member 2722225
what about this one :if (new frm().ShowDialog().Equals(true)) { //do something }
6 Sep 2010 by symreds
Hi everyone,I must modify the Windows default CColorDialog. I want to put a combobox instead of "define custom colors" pushbutton. I found some explanations, but I did not understand how to use the color.dlg template and CHOOSECOLOR structure.Someone could help me?Thanks
7 Sep 2010 by symreds
I know what's a pointer, but I doubt this is the right way to use:CHOOSECOLOR *lpcc = new CHOOSECOLOR;ChooseColor(lpcc);Anyway, the callback function is also for MFC?
14 Sep 2010 by Eli Huang
How to make a tool always on the Desktop but the windows isn't TopMost like Windows7's Desktop tools. When we press the key of "Win+D" or press the Desktop button of "Show Desktop",the tool also on the Desktop.my project created by VC.anybody help me!thank you !
14 Sep 2010 by E.F. Nijboer
One way would be to simply use the desktop window as your window and make desktop window the parent of your controls.Simply create a form and put all the control on a panel. Then use the handle from GetDesktopWindow to set the parent of that panel. Maybe some adjustments to place it...
28 Sep 2010 by NaveenSoftwares
HP - Exstream(Commonly known as Dialogue)is a new tool developed by HP and is widely used by many MNC IT companies. There are no articles for this tool in almost in entire WWW.But there are many enquiries and doubts which are asked related to this tool in every company. Further new joiners...