dll question #5

my Win32 application call a Regular MFC dll which I want to show a
dialog box.

In the dll, I implement:

void CDLLApp::ShowDialog()
        CDialog_Dll_Main dlg;
        int nRet = dlg.DoModal();

But no dialog show up.

Then I step through, I find nRet=-1,  Why?

yqin_99 (193)
7/31/2006 9:41:26 PM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 23

I fogot to add:

AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

yqin_99 (193)
7/31/2006 9:56:57 PM
"kathy" <yqin_99@yahoo.com> wrote in message
> I fogot to add:
> AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

Did it work after adding this?

Ajay Kalra [MVP - VC++]

ajaykalra (6842)
8/1/2006 1:50:06 AM
Consider single-stepping through the DoModal() call.  I would have suggested the
manage-state call, but it appears you've already handled that.  When you are
single-stepping, you will come to a place where it loads the dialog template; make sure
the instance handle you see used there is the instance handle of your DLL.  This may
suggest what is going wrong.

On 31 Jul 2006 14:41:26 -0700, "kathy" <yqin_99@yahoo.com> wrote:

>my Win32 application call a Regular MFC dll which I want to show a
>dialog box.
>In the dll, I implement:
>void CDLLApp::ShowDialog()
>        CDialog_Dll_Main dlg;
>        int nRet = dlg.DoModal();
>But no dialog show up.
>Then I step through, I find nRet=-1,  Why?
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
newcomer (15975)
8/1/2006 1:30:28 PM

Ajay Kalra wrote:
> "kathy" <yqin_99@yahoo.com> wrote in message
> news:1154383017.058671.108130@h48g2000cwc.googlegroups.com...
> > I fogot to add:
> >
> > AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
> Did it work after adding this?
> --
> Ajay Kalra [MVP - VC++]
> ajaykalra@yahoo.com

yqin_99 (193)
8/1/2006 3:21:59 PM

Ajay Kalra wrote:
> "kathy" <yqin_99@yahoo.com> wrote in message
> news:1154383017.058671.108130@h48g2000cwc.googlegroups.com...
> > I fogot to add:
> >
> > AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
> Did it work after adding this?
> --
> Ajay Kalra [MVP - VC++]
> ajaykalra@yahoo.com

yqin_99 (193)
8/1/2006 3:23:48 PM
> Yes

I also want to point out that unless you have a specific reason, you
should use a MFC Extension DLL instead of a Regular DLL. You then avoid
all this state switching.


ajaykalra (6842)
8/1/2006 4:30:05 PM

Similar Artilces:

Outlook and Hotmail #5
Hi, I retreived my Hotmail with Outlook for months without a glitch. My system is on 24/7 and is set to retreive the mail every 10 minutes. About a week ago, upon the scheduled checking suddenly a dialog box comes up asking me for my hotmail password If I fill in the password, it says: username or password incorrect. (which isn't). I have to shutdown Outlook (not OE) and restart the program and it will connect fine without having to re-enter the password. It then will run for about 24-30 hours, checking mail every 10 minutes fine, but then the password dialog box shows up again and...

I'm currently using Outlook 97 on a W98SE machine. Have been using this for a couple of years now with no problem but over the last month have been receiving the following error message: OUTLOOK caused a general protection fault in module DIBENG.DLL at 0005:00002ba2. Registers: EAX=fffe7ff9 CS=03c7 EIP=00002ba2 EFLGS=00010207 EBX=00003000 SS=5bc7 ESP=d1606e34 EBP=00006fa0 ECX=00003000 DS=686f ESI=005941dc FS=1147 EDX=fffe7ff9 ES=113e EDI=0000c004 GS=0000 Bytes at CS:EIP: f3 a5 66 a5 a4 03 f0 03 fa 66 ff 8d 4c ff ff ff Stack dump: 03b7318d 3b7e5bc7 0000e882 0000726a 0062e500 00000001 ...

upgrading 2004 to 2007 -- on-line banking and other questions
I've been a user of Money since 95, and this month updated from 2004 to 2007 -- not because I wanted to, but because the meter ran out. And I have a couple questions. First, I have a credit card and loan at the same bank. The loan has never downloaded before, but now does it not only download, it set up a new account all on its own. But it's set up as a credit card account, not a loan, making separation of principal and interest impossible. I can't merge it into the correct loan account, and if I try to delete it, it warns that it will delete all other accounts from the...

Mfc42.dll compatibility
I have an Mfc app built with VC6 and linked with shared mfc library. Under Win2k it works well. Under winXP sp2 it will crash during startup. Then I copy the mfc42.dll released with vc6 to the app installation directory of WinXP machine. Launch the app, it will still crash, however. In event viewer, it says the fault module is mfc42.dll. Without recompiling the project with static mfc lib, is there any other way to solve the problem? Thanks for any help! Eric Try remote debugging to the XP machine. This is not normal & is almost certainly a bug in your program you are not aware o...

Webbot Form question
I have scaled through the questions and still i am no wiser to solving my problem. I am using the forms and have a submit button which i require to go back to my email account. etc Now i do not plan to publish this website i have developed i have used the save as option to convert it to a web page. the file is stored on our server and appears on our desktop, so really it is functioning like a website just not publish via HTTP. Every item works as it should like a web apge however i get this webbot porblem like others. how do i solve the problem if i am not technically pulshling the we...

VBA/Modifier Customization Question
For one of my clients, I've used Modifier to add a button to a the Customer Maintenance form in GP 10 (Cards >> Sales >> Customer). I've also created some VBA code which brings up an input box when that button is pressed. When the form is loaded from the Cards Menu, the form works as it should, but when it is loaded from another form (for example, selecting Customer Maintenance from the Customer ID shortcut on the Invoice Entry form), the Input Box opens automatically, as if the button was pressed. I implemented a work-around by creating a boolean varible called IsNe...

Exchange 2003 Active Sync question
Exchange 2003 Active Sync question I have been receiving conflicting information in tech docs. Some Technet info states that Active Sync requires Windows 2003 Active Directory controllers AND Windows 2003 AD in NATIVE mode. Another document I have states that Only WIndows 2000 Servers SP3 are required as AD controllers. This matters to us because our AD controllers are Windows 2000 SP4, our Exchange server is a member server Exchange 2003 on a Windows 2003 server. There are NO WIndows 2003 domain controllers. We want active sync to work, but it does not. I want to determine defin...

RMS license transfer question
I have a client who has decided to close their doors. I am not an MBS partner, so I am not very familiar with the licensing. What I need to determine is whether or not they can sell the license to another organization. I know that some EULAs state that the license is not transferrable, but I have not read the RMS EULA, so I'm hoping someone else has.... This is a multi-part message in MIME format. ------=_NextPart_000_0616_01C6F885.CE65BA70 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Allen, It's not transferable. The EULA i...

Problem while installing Business Portal 2.5
While installing Business Portal 2.5 for Great Plains i get the following exception An unhandled exception of type 'Microsoft.BusinessFramework.Security.DatabaseAuthenticationProviderException' occurred in microsoft.businessframework.packager.dll Additional information: DatabaseAuthentication Provider GetConnectionString Failure: Failed to get connection string on provider: SQL Server DatabaseAuthentication Provider Failure: Failed to create connection string: QueryInterface for interface Microsoft.BusinessFramework.Security.IDatabaseAuthenticationProviderIdentity failed... Does a...

tri-fold question
I have Publisher 2003. I set up newsletter starting with a blank document and then set up three text boxes for my three columns of text for the page. I could edit and adjust the three text boxes independently. I have done something which fused them together. Now when I lengthen or shorten one box, the other two are lenghened or shortened as well. I would like to get it back to how it was. I know this may be asking a lot. But does anyone know what I may have done? Thanks for any suggestions. Susan Susan wrote: > I have Publisher 2003. I set up newsletter starting with > a b...

Microsoft Forms 2.0 Label(FM20.dll) in VC2005
I use VS2005 standard edition to create MFC dialog based app, put MSForm2.0Label activeX control on the dialog, it is ok to show it. After I move "CPaintDC dc(this);" to the first line of OnPaint function, the label is not showed when I run it. CPaintDC dc(this); //this will cause the label not be showed. if (IsIconic()) { // CPaintDC dc(this); // device context for painting ..... This is worked in VC6. Thank you very much in advance. ...

Silly Question on Contacts
One of my users is complaining that the default 'Display As' field in Outlook 2003 is Full Name (email address) and that when he prints a distribution list it looks messy and replicates data. I'm probably going to have to write a script that will correct his existing addresses (he has over 5000), but I just wondered if there was a way to fine tune the Display As formatting? Many thanks for any help Simon M ...

Invalid page fault in module KERNEL32.dll
How do I troubleshoot and fix the problem at 0167:bff7b9a6? Have re-installed Outlook, changed names of several files to old (mapi32x.dll, mapi32.dll, etc.) and repaired Office, and deleted tmp files in Temp folder. What now? ...

EXC5.5: IMC crashing on mail with unknown addresses
Hi, We have a severe problem on two sites in our exchange organization. (Exchange 5.5 SP4 + postSP4 Hotfixes, Trend Micro SMEX 3.82_1160) When sending emails to addresses, which were moved in the organisation, the IMC seems to crash (bridge head server in a site of 5 exc servers, holding @3000 mailboxes, bridgehead itself has @5- max.50 mailboxes). On the address field properties of the sent email you only see the X.400 address of the old location of the user, no display name, etc. is set (old entry may be grabbed from a user out of the GAL due to replication delays). Checking IMC queue...

Restore 5.5 to 2003
We are currently running Exchange 2003 on a Win2k3 box. Everything is great. However, we need to restore either a mailbox or a store. We migrated from 5.5 so the mailbox or store that we need to grab is in the 5.5 format. The situation is that we need to go back and get calendar items for a user for 2 years. What would be the best way to do this? We are thinking that the worst case scenario would be to build up a box with 5.5 and just restore to that box. Unless we can open the store or mailbox in 2003 without messing with our current store? Maybe we can mount an additional stor...

Novice Question 2
Hi folks, Well, now that I have completed my little Dialog program in MFC and it is up and running I would now like to change it so that it has some nice graphic elements. Ideally i would like a graphic background and some nice custom made graphic buttons. So now I am at the stage where I am asking myself, should my new app be a Dialog one again, or should I use SDI? The Dialog one does everything I need but I'm not sure if I can put graphical elements like bitmap buttons in my dialog app? Also, I would like to get my head around the Document View Architecture so I'm thinking t...

False 5.5.2 error.
As the admin, I have unlimited email space. (Exchange 2000 spk 4 on 2000 server)When I attempted to send myself a 8 meg message from my outside account (yahoo) It bounced with this message. [ failed after I sent the message. Remote host said: 552 Requested mail action aborted: exceeded storage allocation] Why would the server say this if it isnt so. I used symantec premium for spam put that doesn't set incomming limits. Please help so I han retreve our large mail. Thank You. unlimited email storage space does not mean the same thing as unlimited message size...this messa...

OFFSET question #2
I seem to be having a problem using the OFFSET function. The problem seems to be that it does not work when linking to another file. Example, in file 1 I have a grid that is 5X5 filled with numbers in cells A1..E5 as follows: A B C D E 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 From file 2 I have set the formula as =OFFSET(A1,3,3) which should return the result of 8 (3 cols over and 3 rows down from cell A1). The formula seems to work fine as long as my source document is open but when the sourece document is closed, I get a #VALU...

hello everyone.im new here and have a question.
i was having Seagate 160 gb hardisk and recently i got a new 320gb seagate hdd and put it as secondary disk. nw i have 4 drives i.r (C:,D:,F:,G:)..'C & D belongs to previous hardisk'.. 2 days back .i was on facebook and someone sent me a message.(link) and when i clicked it a file is downloaded automatically and from that time drives f: and g: are not opening correctly.maybe its due to some virus and ther's no use of scanning for viruses.i tried "norton, eset nod32, mc afee, avast ,avg.".but didnt work..................... if you try to open them directly...

FindFirst question
hello When using code to find a table record that matches a given value, does the 'FindFirst' need to be preceded by 'MoveFirst'? should the code read as... Dim... ......etc Set rs = Me.recordset.Clone rs.FindFirst strSearch .... or... Dim... ......etc Set rs = Me.recordset.Clone rs.MoveFirst rs.FindFirst strSearch .... When studying code samples in this site and others, I've seen it done both ways. Things seem to work fine without the MoveFirst, but maybe I'm just getting lucky. Is MoveFirst needed? Why/Why not? thanks in advance T...

Declare Sub Sleep Lib "kernel32.dll" ( ByVal dwMilliseconds As Lon
Greetings, I Have a few questions, and am quite stumped 1. In Word is there an alternitive to the API call to pause the applications progress? 2. Does the Sleep Procedure halt the OS or just the application? 3. My over all problem is I am moving a file from one folder to the another. The trouble is at runtime I get a "Permission denied" error, If I place a Break Point on the sub procedure to move the file or step through it it works fine this problem only occurs @ runtime. See Code below Sub MovePrintedFile(ByVal sFileName As String) Dim oFSO As Object Dim sDest...

lookup function Question
Hi, I am currently in charge of creating a spreading sheet where certain groups of zip codes correspond to individual salesmen (e.g. zips 30000-30300 are for Bob and 30500-30700) are for John. Our database records the 5 digit zip code, while our territories are broken down into the first 3 digits. How can I create a lookup function to tell me that zip code 30301 is in Bob's region and 30507 is in John's territory? Thanks Hi, Let' say your zip codes are in column B and you want to know who's region is it in another column enter =if(and(B1=>30000,B1...

Userform question
What do I need to do if I want to access a cell in my worksheet if I have a userform open? (I have to close the userform in order to access the cell) Thank you in advance In the forms properties set the Property ShowModal to False. Alternatively in the code to show the userform UserForm1.Show vbModeless The opposite of the above line is UserForm1.Show vbModal -- Regards, OssieMac "Dawna" wrote: > What do I need to do if I want to access a cell in my worksheet if I have a > userform open? (I have to close the userform in order to access the cel...

how do I rename scanned documents with odd/even numbers: 1,3,5,7
I have scanned some documents printed on two sides, therefore now, I have all the odd pages in one file and all the even pages in another file. To re-arrange them in order, how can I rename the documents in sequence such as 1,3,5,7,..... and 2,4,6,8,..... and then mix them together to have them all in sequence 1,2,3,4,5,,6...... Thank you Are they scanned as documents or as pictures? -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "frenchrivieracharles" <frenchrivieracharles@discussions.microsoft....

Undeliverable mail #5
I wonder if anyone can help, I have a client running SBS2003 and they have an exchange problem they get the following error - I have never come across it before: This is an SMTP protocol error log for virtual server ID 2, connection #5. The remote host "", responded to the SMTP command "mail" with "553 sorry, syntax error or rejected address, please forward to your postmaster (#5.7.1) ". The full command sent was "MAIL FROM:<x@x.co.uk> ". This will probably cause the connection to fail. I have replaced the MAIL FROM addre...