What's the CreateDialogIndirect() function used for?

Hello, All:

I am here having met a problem that my code likes following cannot run out,
and when I debugged this,I found that would have a proble at calling
CreateDialogIndirect() function in CDialog::CreateDialogIndirect() ,and
indeed,it's wrong at
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
 CWnd* pParentWnd, HINSTANCE hInst) function by using a global function like
this:
// create modeless dialog
  AfxHookWindowCreate(this);
  hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,
   pParentWnd->GetSafeHwnd(), AfxDlgProc);
I don't know why it likes this,is there anybody who knows how I can deal
with this problem?

The following is my code from the InitInstance() function.

CMyDlg dlg;
 m_pMainWnd = &dlg;
 int nResponse = dlg.DoModal();
 if (nResponse == IDOK)
 {
  // TODO: Place code here to handle when the dialog is
  //  dismissed with OK
 }
 else if (nResponse == IDCANCEL)
 {
  // TODO: Place code here to handle when the dialog is
  //  dismissed with Cancel
 }


Thanks in advance!


0
Carl
4/30/2005 8:30:31 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
951 Views

Similar Articles

[PageSpeed] 36

Carl wrote:

> Hello, All:
> 
> I am here having met a problem that my code likes following cannot run out,
> and when I debugged this,I found that would have a proble at calling
> CreateDialogIndirect() function in CDialog::CreateDialogIndirect() 

CreateDialogIndirect is responsible for creating the dialog window and 
its controls.  Failure usually means that the dialog contains an 
Internet Explorer control that requires you to call InitCommonControlsEx 
before attempting to create the control.  Review the help on each 
control type you have on the dialog.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
4/30/2005 2:16:30 PM
One way to determine what controls are failing is to check the dialog box option that says
it is OK to create a dialog even if there are errors. The controls that are missing are
the ones responsible for the original failure. I forget the name of the option, but it is
in one of the styles available to the dialog box and has a fairly evident name...
				joe

On Sat, 30 Apr 2005 09:16:30 -0500, "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
wrote:

>Carl wrote:
>
>> Hello, All:
>> 
>> I am here having met a problem that my code likes following cannot run out,
>> and when I debugged this,I found that would have a proble at calling
>> CreateDialogIndirect() function in CDialog::CreateDialogIndirect() 
>
>CreateDialogIndirect is responsible for creating the dialog window and 
>its controls.  Failure usually means that the dialog contains an 
>Internet Explorer control that requires you to call InitCommonControlsEx 
>before attempting to create the control.  Review the help on each 
>control type you have on the dialog.

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
5/2/2005 6:34:47 PM
Reply:

Similar Artilces:

weekday function
Hi, Im trying to automate the process where when i enter someones date of birth, i get the actual day that they were born. The function weekday when used only returns a value between 1 to 7. How can i convert this Number value to an actual day? Thanks to any replies John Hi John you can do this by formatting the cell without using any functions at all enter birthday in A1 click on A1 and choose format / cells / number tab - custom, in the white line type dddd to get just the day or something like dddd dd mmmm yyyy to get day at date click OK and make the cell wider. If you want ...

time functions
how to convert a local time to universal time. local time is of type time_t . thanks "Tyagi" wrote: > how to convert a local time to universal time. > local time is of type time_t . > thanks > CTime::GetGmtTm , this fucntion may help "Tyagi" <kamesh_tyagi@yahoo.com> wrote in message news:OVzHHxoOFHA.2468@tk2msftngp13.phx.gbl... > how to convert a local time to universal time. > local time is of type time_t . > thanks > > > If you use XP and above then take a look at the TzSpecificLocalTimeToSystemTime() API. -- Cheers Check ...

How to use Paint?
I have Win XP SP3 and the version of the Paint that comes with it (Programs > Accessories). Is this the correct NG to ask questions about Paint? If not, what then? My question.... I use ctrl-PrintScreen to capture the display. Then I run Paint and paste the image. To copy a subset of the image, I use the box Select tool to outline the area, then press ctrl-C and ctrl-V. At that point, I have trouble "selecting" the two different objects: the original PrintScreen image and the subset I just pasted. By "select", I do not mean the box Select tool...

How do I get certificates to use to send from email addresses???
Everything seemed to go well in setting up email addresses in outlook. They tested fine and I have no problem receiving messages in outlook. The problem comes when I try to send messages .... and I've tried sending from outlook using each and every email address I've set up. This is the message I get: "Microsoft Outlook could not sign or encrypt this message because you have no certificates which can be used to send from the email address mpenza17@verizon.com." I've tried going to sites and downloading certificates. They don't seem to appear in outlook??? A...

What is CreateDialogIndirect() used for?
Hello,All: When I tried to use Carl wrote: > Hello,All: > > When I tried to use Then you died?-) Anyway, Raymond Chen just did a blog entry on the indirect dialog stuff: http://blogs.msdn.com/oldnewthing/archive/2005/04/29/412577.aspx -- Jonathan Arnold inSORS ...

Using a variable 'Top n' value from a form control
Is it possible to have a form control that can adjust the 'Top n' value that is based on a criteria in a query? I have a query that I want to use with of a varying number of Top n values based on the dynamic figure that I input into a control on a form. Is this possible?. I seem to remember from the early days of Access 1.0 & 2.0 that the 'Top n' value can be used in a criteria on the QBE grid, or did I imagine that? No. You cannot use a parameter for the TOP n value. You could build the query statement dynamically, and assign it to the SQL property of the QueryDe...

Case function
Does Excel have a function similar to the "Case" command in other programming languages? In VBA, yes Select Case myVal Case 1: 'do something Case 2: 'do something else Case Else; ' exception End Select -- HTH RP (remove nothere from the email address if mailing direct) "Al" <Al@discussions.microsoft.com> wrote in message news:F99619C8-E32C-4B61-9C81-5663E8CE879C@microsoft.com... > Does Excel have a function similar to the "Case" command in other programming > languages? XL itself doesn't, si...

Outlook 2003 Using over 2 GB of memory
Ok, I have been using Outlook 2003 for a while now and have had an odd problem for a while. If I leave outlook open for a long time, it will consume all of of my free memory. I am talking about 700-800 MB of actual memory, and 1.5 - 1.7 GB of my virtual memory by just leaving it open over night, and this repeats as many times as I leave it open. I have restarted the computer, and no luck. Now it is also happening with my laptop, and I am not sure where to go with this. Any Ideas? Do you have a desktop search program installed? --� Milly Staples [MVP - Outlook] Post all replies to the gro...

Inserting Schema fields using Custom Code
Here is my problem. I have to write an installer to install the custom fields to an account. Is there any way I can do this using code. I looked at the DMsnapin.dll and there is an interface with SchemaEditor method , which I think will do what I want. But I get a return code of 70 (ERROR). Has anybody done this before. Please help. Thanks ...

Adding function to DLL project
I've made a DLL project in VC 6. I want to add some functions to it throughout their headers. I add those files to project (*.cpp and *.h), but when I include them to DLLs cpp I've got error redefiniton. I'm aware that I need to export functions in DLLs header, but i'm looking a way not to include a funcitons body in DLLs cpp, but to import them via headers. Thanks Aleksandar This is a common problem. Take a look at my article "The Ultimate DLL Header File" on my MVP TIps site, which explains the likely cause of the errors and shows my workaround. joe On 28 S...

Function is not functioning
Why wont this work? Ideas on how to make it work? Function Molecular_Wt(Component) Range("C2:AI4").Select Selection.Find(What:=Component, After:=ActiveCell, LookIn:=xlValues, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext _ MatchCase:=False).Activate ActiveCell.Offset(0, 1).Select Molecular_Wt = ActiveCell.Value End Functio ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com Try to run in debug > step into (or F8). This will run the code...

Re: Stored Proc Question: Use ad hoc Where Clause
Ive got a question on how to implement the following: I Have an sp_ that accepts two parameters. Here's essentially what the sp looks like: /****************************************************************************************************** Create Procedure sp_SearchResults @Status_ID Int, @Location_ID Int As Declare @SqlString varchar(100); /** Check values passed in to sp and based off these construct @sqlString to use in Where clause **/ If @Status_ID <> 0 Begin Select @SqlString = 'Where Mytable....

User defined functions
Hello: I have a nested function that is uncomfortably long for typing: =SUMPRODUCT(SUMIF(INDIRECT("'" & wslist & "'!A1"),"<>0",INDIRECT("'"& wslist & "'!A1"))) As is, the function applies to the A1 cell. If I wish to use it with another cell, say C3, (but the same wslist) I would type =SUMPRODUCT(SUMIF(INDIRECT("'" & wslist & "'!C3"),"<>0",INDIRECT("'"& wslist & "'!C3"))) Is it possible to define a function, e.g. My...

How do I use excel names with INDIRECT with charts
Hello, I want to create a Chart that does not directly reference cell-ranges (i.e. A1:A6), but excel-names that make the reference sheet-independent. My aim is to be able to copy one chart to other worksheets, which have their dataareas at the same places like the source-sheet. Problem: This works fine in cells but not in charts Excel name definition: =INDIRECT("R3C2";0):INDIRECT("R3C5";0) Any idea about this? Thanks in advance, Holger. You have to include the sheet name in the final formula that you want XL to use. -- Regards, Tushar Mehta www.tushar-mehta.co...

Change XmlDocument Function to XPathDocument Function
After everything I have read and some of my own testing I am convinced that XPathDocument are more efficient if you are only using XML for read only and not modifying the XML. However, I have been having problems doing same procedures I do with XPathDocuments in XPathDocuments. I have a configuration XML document, which holds all the configuration information for an application (see below sample). I extract the information from the document and use it in the application. In the XMLDocument solution (see below) I load the XML document and build a SQL connection string. I am unable to repr...

Using CRM Application Pool for Custom ASP.NET application
Hi All I am having 2 server based CRM configuration set that is CRM database is on other server, My intallation on multi server went well and CRM is working fine. I have asp.net application which also uses the same database server as CRM and it is deployed on CRM web server. I have added this ASP.NET application to the Application Pool that CRM is using so that I don't have problem in Connecting to Database server however though CRM is able to connect to the database my ASP.NET application is not getting trusted connection on sql server. What am i doing wrong here? Do I have to ...

::DrawText function
Forgive me if I appear to be thrashing a dead horse here, but I am making progress. I'm using the DrawText function in a windowless ActiveX control. This is working fine, although for some strange reason it is outputting the text on a white background - i.e. there is white surrounding the text, but nowhere else. I have managed to prove to myself that it is not because there is a white brush selected into the device context at the time, because I changed the definition of white to be RGB(255,255,0) i.e. yellow, instead of white, and it was still white. Besides there is a black brus...

Some first problems using word 2007
Hello. I have some problem using word 2007 first time. Old documents don't appear as they used to. When there is a header-style, I see that it is incorrect, and there is an annoying number (1bu, 2bu , ... 20bu) at each header. Second thing : I change a line and other lines are change too. I don't know where can I change a header-style, so I assume this may be the problem. Thanks :) Are you saying that all of your existing documents have a problem with numbering? I'm assuming you are referring to *headings* and heading numbers rather than headers (the area abov...

CreateDialogIndirect()'s silent failure...
Hi, ENV: Visual Studio 2003, MFC-VC++ I have following along with main MFC application project: 1> MFC extension DLL having dialog with its class exported from this DLL - say DLL#2. 2> No collision of resources between this DLL and any other DLL or application resources 3> Said dialog above having a custom control in it which in terms is exported from another DLL - say DLL#1. When I invoke DoModal() it fails to create dialog. Resources are getting loaded very well. There is no debug assertion failure. dwError after CreateDialogIndirect() is zero only. I am wondering what is causi...

Using XP with Outlook 2000 Messages stay in outbox
I am using Outlook 2000 with XP. When I send a message it stays in my outbox. ????????????? I tried all the troubleshooting options on the Microsoft website and non of them are working. Any suggestions. ...

Copy Function
I hope I can explain what I need to do. In cell A2 I want to copy the number that is in cell P37 In cell A3 I want to copy the number that is in cell P38 (repeat for 8 rows, ending with..........) In cell A11 I want to copy the number that is in cell P46 Skip 5 rows and continue pattern In cell A17 I want to copy the number that is in cell P52 Is there a way to key in on cell P37 and tell the next line to copy the result in one cell below P37 In the final row it would say something like copy the result of 13 rows below P37. Thanks to whoever wants to tackle an explanation. - Genie ...

Datevalue function
I am trying to use the datevalue function to convert a column of dates to the serial numbers which represent those dates in another column. When I type in the cell address the serial number comes up in the function box but when I hit OK #VALUE comes up in the cell where I am trying to see them. How do I fix this please? Jenny DATEVALUE is for converting text to dates. If you want to see the serial number that your dates represent, just reformat the cell as General. Andy. "Jenny" <anonymous@discussions.microsoft.com> wrote in message news:E0F0C9D7-1551-4E82-A4FC-7957CD29B508...

problem using tab
When I hit the tab button the selection jumps several columns over instead of going to the next column. What's strange is that this seems to happen only on one computer in the network and not on the others. The document is shared so I think it is maybe the formatting for that computer's excel. Does anyone know what is going on? Hi Tools > Options > Transition, uncheck "transision navigation keys". HTH. Best wishes Harald (Not knowing what's going on, just how to get rid of it :-) "officebug" <officebug@discussions.microsoft.com> skrev i me...

Function SUMIF
Hi guys It's there any way I can us the function SUMIF with multiple criteria or conditions on two different columns. I'll appreciate your help. Hi no you can't use SUMIF with more than one criteria. Use SUMPRODUCT instead e.g. the following will sum column C based on the criteria in col. A and col. B =SUMPRODUCT((A1:A1000=criteria_1)*(B1:B1000=criteria_2),C1:C1000) -- Regards Frank Kabel Frankfurt, Germany Ricky wrote: > Hi guys > > It's there any way I can us the function SUMIF with > multiple criteria or conditions on two different columns. > I'll ap...

Function "Workingdays" query error date
I am trying to calculate the number of days, excluding weekends, between two dates. I am using the "workingdays" VBA code. I have pasted the code in a module, naming it "mdlWorkingdays". The code is listed below along with a sample of the data. "mdlWorkingdays" Option Compare Database '*********** Code Start ************** Public Function Workingdays(Start_Date As Date, End_Date As Date) As Integer '.................................................................... ' Name: WorkingDays ' Inputs: StartDate As Date ' EndDate As Da...