Can you call SetWindowText on a modal form?

I have a DLL that is called by Visual Basic and which 
displays a modal form. I have compiled this DLL and it 
works perfectly, apart from the fact that I want to be 
able to pass it a string to display in the title bar, but 
the SetWindowText function doesn't seem to do anything.
My code is shown below. Any help would be much appreciated.

void __stdcall GetLogin(BSTR appname, BSTR caption, BSTR* 
username, BSTR* password, bool reshow)
	//read the current username from the registry for 
this application
	CString currentuser = theApp.GetProfileString

	//read the current password from the registry for 
this application and decrypt it
	CString currentpassword = Encrypt(

	//variables to represent new password
	CString retuser, retpass;
	if(reshow || (currentuser.GetLength() == 0))
	{ //if we need to show the form because either 
there is no existing username or because we are told to...
		Login flogin;
		//update the caption of the form

		//show the form modally

		//retrieve the values entered
		retuser = flogin.m_Username;
		retpass = flogin.m_Password;

		//update the registry settings for this 
application, after encrypting the password
USERNAME, retuser.operator LPCTSTR());
			Encrypt(retpass).operator LPCTSTR
		//if values already exist in registry, 
just set return values to these
		retuser = currentuser;
		retpass = currentpassword;

	//copy return values to byref parameters passed in
	LPCSTR luser = retuser.operator LPCTSTR();
	LPCSTR lpass = retpass.operator LPCTSTR();
	*username = SysAllocStringByteLen(luser, 
	*password = SysAllocStringByteLen(lpass, 


anonymous (74722)
11/26/2003 9:22:36 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 22

  Till you call Create or DoMoal function of Dialog, dialog windows doesn't
be created.
  So when you call SetWindowTest(...), there is no window to display the

  If you wanna control the modal dialog box test from outside of the dialog,
  add function SetWindowTitle(LPCSTR pstr) and contain the name.
  And then call SetWindowText(..) in overrided OnInitDialog().

  class CTestDialog : public CDialog
      void SetWindowTitle(LPCSTR pstr);
    CString m_strTitle;

void CTestDialog::SetWindowTitle(LPCSTR pstr)

void CTestDialog:;OnInitDialog()

yjkim (7)
11/26/2003 9:34:57 AM

Similar Artilces:

Can I fade the edges of photos that I use?
I am trying to use photos in a publisher document that I want to fade the edges of, is this possible to do with publisher? -- D:o) krazy-4-coke wrote: > I am trying to use photos in a publisher document that I want to fade the > edges of, is this possible to do with publisher? Not really. You should use dedicated image manipulation software for this, such as Photoshop Elements, Paint Shop Pro, or Microsoft Digital Image. -- Ed Bennett - MVP Microsoft Publisher Ed, Are any of these programs typically come loaded on a computer?? I have another question - ca...

Can I delete my switchboard and make a new one?
I do not like my switchboard and would like to delete this one and start all over. But when I did delete it I couldn't make another one, because I couldn't delete the default. What should I do?Thanks,Dustin Just delete the form and the table that were created by the wizard, then start over.-- Rick B"Dustin" <> wrote in message>I do not like my switchboard and would like to delete this one and start >all> over. But when I did delete it I couldn't make another one, beca...

Using different form strings to filter
Hello. Is there a way to code a query to have it use a filter string if a form is open, or ignore it if the filter is not open? Example: Query Name: Query1 Form: Form1 and Form2 Query fields: Field1 and Field2 I have a string in field 1 and 2 Forms!Form1!Field1 in the first field of the query, and Forms!Form1! Field2 in the second field. Can I also have Forms!Form2!Field1 in the query as well? I have tried this, but a box pops up and asks for the information from form 2 when it is not open. Thank you. hi, wrote: > Hello. Is there a way to code a query to...

how can I drag formulas with other cell references
example cell A1 contains formula "=stdev(a2:a7) cell a2 contains formula "=stdev(a8:a13) Is it possible to drag the formula down so that cell a3 contains "=stdev(a14:19) and cell a4 contains "=stdev(a20:a25) and so on for cells a5, a6, a7 etc. etc. Hi Bram, See B1: =stdev(OFFSET($A$1,6*ROW()-5,0):OFFSET($A$1,6*ROW(),0)) B2: =stdev(OFFSET($A$1,6*ROW()-5,0):OFFSET($A$1,6*ROW(),0)) It was easier to test and verify using SUM instead of stdev, but the formula is same NOTE the formulas are in a different colu...

can i have more sender in outlook setting ?
i using win server 2003 , exchange 2003 , i using exchange client in outlook to send & receive , but my boss have more than one mail address , can i use another AD mail address for send out mail , i have try to add a pop3 , the sender also is computer user thank your ...

IE8 can't access Microsoft Office site when all other browsers can
When trying to access the Microsoft Office page using IE8 I keep getting the "Internet Explorer cannot display the webpage" message. If I use any other browser (Firefox, Opera, Safari, Chrome) I have no problem accessing the page. This happens whether running in normal or No Add-on's mode. Despite how many people keep complaining about all the problems with IE8, neither the MVP's or Microsoft acknowledge that they exist. Asus P5E Intel E8400 Core2Duo 3.0GHz 4 GB PC2-6400 DDR2 Windows 7 Ultimate (with all the latest updates installed) NIS 2010 (all up to date)...

I can't get rid of 1 "Payment to Send' Reminder-M07
On my Home Page in the Reminder section, I have a "1 Payment to Send" listed there. But there is NO payment to send. I"ve opened up back-up copies as far back as May and the reminder is there, but there is no payment that needs sending. Does anybody have an idea how I can get rid of this Reminder? Just removing the Reminder from Home Page doesn't do it. When you put the Reminder back on the Home Page, the "Payment to Send" is still there. Clicking on the link just takes me to Bill Summary page. ...

MapQuest Buitton on Form
Arvin: Hope you see this post. Mapquest must have changed their code. My Mapquest button on the form does not work anymore. The reason is that in Canadian Postal Codes there is a space (ie. E3A 3N7). My data is stored this way. Mapquest used to accept this format but not anymore. How do I delete the space in the hyperlink created from the event on click (button on Form). Your help would be greatly appreciated again. Here is my code. Private Sub cmdHyperlink_Click() Dim strPath As String If Not IsNull(Me.Postal_Code) Then strPath = "" &a...

is there any way I can trap for the use of navigation buttons?
Hi Is there any way I can trap for the use of navigation buttons, such as Next, Previous and New record? Stapes Probably. Trap what and when? "Stapes" <> wrote in message > Hi > > Is there any way I can trap for the use of navigation buttons, such as > Next, Previous and New record? > > Stapes On Wed, 16 Jan 2008 05:14:20 -0800 (PST), Stapes <> wrote: No. And there shouldn't be a reason for that. There are plenty of events in...

Close a form when it loses focus
Hello All Is it possible to make a form close as soon as the user clicks elsewhere on the screen? The form in question is a trivial popup form that is best shown in datasheet view, so I can't add a button. I know the user could close it with the 'X' in the top-right corner, but for other reasons it would be much better if I could force it to close as soon as they click elsewhere. I have tried adding the following OnLostFocus event to the form, but nothing happened! DoCmd.Close acForm, "[frm contacts]", acSaveYes Second question (or does this need to be in a...

Forcing Input as Uppercase on User Form
Hi can any one advise me how to amend the following code to ensure :- (a) only two letters are input (b) they are converted to upper case (c) how do you centre the text in a message box header as I have use spaces to achieve this Code used inputVal = TextBox1 Do Until ActiveCell = inputVal ActiveCell.Offset(1, 0).Select If ActiveCell = "" Then MsgBox ("Sorry Not Found - Please Input the first two letter only e.g. RG ") ", vbInformation, " Warning !! " Unload UserForm1 UserForm1.Show End Else End If Loop Excel v...

how can I look into store.exe
I have an email sobig that i cant even download it on my outlook express 6.0.... The adviced for is to locate it on the Queues in Outbound or inbound messages on IMC, but if it is not in there the message may be stuck up in Store. How can I locate it and delete the massega in store.exe they say I can use the MFCmapi but i'm a newbie how can do this. Do I have to download the MFCMapi? what is it? thanks ...

can't change/delete bills and deposits
suddenly one day i realized that when i tried to change a bill, i could click "ok" but nothing would happen. I thought it was because i upgraded to 2004, so i deleted the bills and rescheduled. about 5 of the bills will not delete either. the error message is: "Money could not write to your Money file. The operation could not be performed or another application finished this task before you. Please try again." Now some of the newly scheduled bills will not allow me to change the properties, i click ok but nothing happens when i edit the series. I have repaired ...

Can't Install IBF for CRM on CRM Server
first i'm install IBF On my CRM v1.2 (it's name testcrm) after that i'm try to install IBF for CRM on my CRM Server but in Step "Publish Metadata" i'm type "http://testcrm:8082" and click next button but it's show message box "The Information Bridge metadata service location is not avaliable" and can't install it. -_-' . but i can access "http://testcrm:8082/IBFWriteService.asmx" and "http://testcrm:8081/IBFReadService.asmx". so how can i install it ? I had the same problem - try using http://localhost:8082 for...

Can Work thread get a windows class and manipulate it?
Suppose that I create a work thread when my dialog box started, then in the thread I get the pointer to the dialog mfc class and call updateData method. Does that work? I tried, but failed. Is there any other way to do? thanks!! No, it won't work, don't even waste time trying. It is almost guaranteed to fail. You do not manipulate the windows owned by one thread from a different thread. What you do is PostMessage requests from the worker thread to the main UI thread, usually to the window that contains the controls. The fact that you are using UpdateData already says you are in t...

When I open a workbook, another one called Book1 is also opened. W
This Book1 becomes the current book. If I go to Window on the toolbar I can switch to my correct workbook. Why is this Book1 being opened? I can cure it by closing Book1, then saving my correct workbook, then closing that one. The next time I open my workbook, Book1 has disappeared. Do you mean two different sheets within the same workbook? "Ian@MarlandLtd" wrote: > This Book1 becomes the current book. If I go to Window on the toolbar I can > switch to my correct workbook. Why is this Book1 being opened? I can cure it > by closing Book1, then saving my correct workbo...

Form with desktop shortcut
I created a form which displays one record. The record is chosen at random by a query. It works fine within Access 2003. However, when I create a shortcut to the form on my desktop and run it that way, it always gives me the same record. How can I get the random record I'm looking for? -- CindyLuWho Cindy, I'd say you're probably better off creating a macro that opens the form at the required record. Your desktop shortcut should call this macro, rather than the form. Regards, Graham R Seach Microsoft Access MVP Sydney, Australia "CindyLu" <CindyLu@discus...

Subform doesn't work once added to main form
Hi, I've been searching around looking for some help and can't find anyone that has had quite the same problem. I have a main form called 'Sites' and have added a subform called 'Previous Year Flows' into the main form. I do not enter data into this subform. Instead, data on previous years is drawn through from a table called prev yr flows into this subform. When I open the subform on its own it draws through all the necessary data, but when it is embedded within the main form, none of the actual data is pulled through at all, although the linked fields, Site ID and A...

Why can't I send email messages with Trial Outlook 2007?
I have a new HP laptop that came with the 60 day trial of Office'07. I receive email but the send/reply/compose functions are grayed out. I am certain my settings are correct. Why can't I send email? KK What happens when you use the Test Account Settings? What is the exact error message you get? -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. ALWAYS post your Outlook version. How to ask a question: After furious head scratching, KK asked: | I have a new HP laptop that came with the 60 day...

How can I keep the header in view at all times
In Word, a header and footer s always in view when you work in th document. However, I cannot seem to do the same in Excel - any suggestions please. Thanks - M Select a cell below your column header and just right of your ro header, then goto "Window" and select Freeze Panes. HTH J -- pinmaste ----------------------------------------------------------------------- pinmaster's Profile: View this thread: ...

DrawItem not called for CListCtrl derived class
I have set the ownerdatafixed to true , overriden the virual DrawItem. I have created a member variable & also called DDX in DoDataExchange. I have inserted this list control in the dialog. So some one can help me how to make the DrawItem function to get called. ...

Someone must have asked this before but I can't find it!
Being a relative Excel newcomer I,m not sure of all the terminology so may have used the wrong terms when searching. What I am trying to do is create a worksheet in which a cell shows one of 3 values (LOW,AVERAGE or HIGH) according to the value in the cell to the left of it, which itself is the sum of the 2 preceding cells. To be more specific, cell D6 is Men, E6 is Women and F6 is"=SUM(D6,E6)". I then want G6 to show "LOW" if F6 is less than 5, "AVERAGE" if it is between 5 and 20, and "HIGH" if it is over 20. If anyone understands the question and can h...

Print Full Bleed in Publisher? Can I eliminate the non-printable a
Hi there I have a "Print Merge" document I am printing. It's basically tickets 6 up on a page and I'm using Print Merge to number the tickets. Also have it set up to print multiple (page size is 2.75inch by 5.5inch). I have the margins set to ZERO and the horizontal, and sides set to ZERO as well. My printer supports full bleed and I can print full bleed from this PC using the same driver with all other programs (Adobe Illustrator, Photoshop, etc, etc), just not with Publisher. I've checked the forums here and can't seem to find a solution. I've selected t...

The code below worked for a few days and just totally stopped working. What can I do to make sure it continues to work? Thanks!
The code below worked for a few days and just totally stopped working. What can I do to make sure it continues to work? Thanks! ----- Private Sub Worksheet_Change(ByVal Target As Range) Dim C As Range, D As Range Set D = Intersect(Range("A:A"), Target) If D Is Nothing Then Exit Sub For Each C In D On Error Resume Next Target.Offset(0, 6).FormulaR1C1 = "=RC[-2]&RC[-5]" ' - For Column E Target.Offset(0, 7).FormulaR1C1 = "=RC[-2]&RC[-5]" ' - For Column F Target.Offset(0, 9).FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC7,I.O.! R2C1:R5...

PopUp Form is blank white
I have a PopUp Form that works fine - - except if the query which is its record source returns (has returned) no record. In this case the form opens to a blank white - not even labels show. Have never seen this before and would welcome advice that explains why even labels do not appear. Related to this; in the remote situation where there is no record I probably need a default message in this popup form and was initially thinking a non-visible label made visible if a field was null . But in seeing the entire form blank when there is no record (which I suppose is a state different t...