How to set custom class name for MFC frame window?

When you create a frame window in MFC using following code:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CMDIFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	cs.lpszClass = AfxRegisterWndClass(0);

	return TRUE;
}

In Spy++, the default frame name is Afx:00400000:0. How can I set custom 
name instead of the default name?

Thanks.


Michael
0
Michael5492 (655)
11/16/2005 10:49:47 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
2012 Views

Similar Articles

[PageSpeed] 41

On Wed, 16 Nov 2005 14:49:47 -0800, "Michael"
<Michael@discussions.microsoft.com> wrote:

>When you create a frame window in MFC using following code:
>BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
>{
>	if( !CMDIFrameWnd::PreCreateWindow(cs) )
>		return FALSE;
>	// TODO: Modify the Window class or styles here by modifying
>	//  the CREATESTRUCT cs
>
>	cs.lpszClass = AfxRegisterWndClass(0);
>
>	return TRUE;
>}
>
>In Spy++, the default frame name is Afx:00400000:0. How can I set custom 
>name instead of the default name?
>
>Thanks.
>
>
>Michael

May be if you change the zero ended string wich exists on this
adress...
0
darkio (1)
11/16/2005 11:35:49 PM
The cs.lpszClass = AfxRegisterWndClass(0) will return the default class name, 
but if I change it to the one I want, the window creation will fail.
Any more ideas?


Michael

"darkio@mail.ru" wrote:

> On Wed, 16 Nov 2005 14:49:47 -0800, "Michael"
> <Michael@discussions.microsoft.com> wrote:
> 
> >When you create a frame window in MFC using following code:
> >BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
> >{
> >	if( !CMDIFrameWnd::PreCreateWindow(cs) )
> >		return FALSE;
> >	// TODO: Modify the Window class or styles here by modifying
> >	//  the CREATESTRUCT cs
> >
> >	cs.lpszClass = AfxRegisterWndClass(0);
> >
> >	return TRUE;
> >}
> >
> >In Spy++, the default frame name is Afx:00400000:0. How can I set custom 
> >name instead of the default name?
> >
> >Thanks.
> >
> >
> >Michael
> 
> May be if you change the zero ended string wich exists on this
> adress...
> 
0
Michael5492 (655)
11/17/2005 2:11:07 PM
The solution is to use AfxRegisterClass to register the class instead of 
AfxRegisterWndClass. 

// Register your unique class name that you wish to use
    WNDCLASS wndcls;

    memset(&wndcls, 0, sizeof(WNDCLASS));   // start with NULL
    //you can specify your own window procedure
    wndcls.lpfnWndProc = ::DefWindowProc; 
    wndcls.hInstance = AfxGetInstanceHandle();
    wndcls.lpszMenuName = NULL;

    // Specify your own class name for using FindWindow later
   wndcls.lpszClassName = "MyWindowName";
    // Register the new class and exit if it fails
    if(!AfxRegisterClass(&wndcls))
    {
       TRACE("Class Registration Failed\n");
       return FALSE;
    }

"Michael" wrote:

> The cs.lpszClass = AfxRegisterWndClass(0) will return the default class name, 
> but if I change it to the one I want, the window creation will fail.
> Any more ideas?
> 
> 
> Michael
> 
> "darkio@mail.ru" wrote:
> 
> > On Wed, 16 Nov 2005 14:49:47 -0800, "Michael"
> > <Michael@discussions.microsoft.com> wrote:
> > 
> > >When you create a frame window in MFC using following code:
> > >BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
> > >{
> > >	if( !CMDIFrameWnd::PreCreateWindow(cs) )
> > >		return FALSE;
> > >	// TODO: Modify the Window class or styles here by modifying
> > >	//  the CREATESTRUCT cs
> > >
> > >	cs.lpszClass = AfxRegisterWndClass(0);
> > >
> > >	return TRUE;
> > >}
> > >
> > >In Spy++, the default frame name is Afx:00400000:0. How can I set custom 
> > >name instead of the default name?
> > >
> > >Thanks.
> > >
> > >
> > >Michael
> > 
> > May be if you change the zero ended string wich exists on this
> > adress...
> > 
0
Michael5492 (655)
11/17/2005 3:00:06 PM
Reply:

Similar Artilces:

MFC to open IE
Hello, What is the best programmatic way to open a URL explicitly using IE (assuming IE is installed on a machine, but not assuming as a default browser)? Thanks, Janiv Ratson. It would appear that the easiest way to do it is to just run (via ShellExecute, CreateProcess or whatever function you choose) the following commandline: iexplore http://www.abc.com/def/ Internet Explorer (at least as it is installed in my windows XP SP2 machine) will take a URL as a parameter and when passed a URL with no other parameters, it opens that URL in a window (in my case, a new IE window will be...

Check this update for MS Windows
--qyvlrvkybmjf Content-Type: multipart/related; boundary="hwrqgqycrxi"; type="multipart/alternative" --hwrqgqycrxi Content-Type: multipart/alternative; boundary="lvllmcrxbhi" --lvllmcrxbhi Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Customer this is the latest version of security update, the "October 2003, Cumulative Patch" update which eliminates all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to maintain the security of your computer from these vulnerabil...

Cannot send from Windows shortcut or Acrobat
Using Office/Outlook 2003, winxp sp1. Ever since I installed Office 2003 (and I use Outlook 2003 with pop3 email accounts from my website hosting provider), I can't right click a file and "Send To a Mail Recipient" anymore. Nothing happens. I get the same problem in Acrobat 6.0 Professional. It won't let me send a pdf file when viewing it from the file menu like it use to. In both cases, I use to have these capabilities when office xp, or even office 2000 was installed. Any ideas? Thanks! ...

same date and set up on complete workbook
Is it possible to set the date only once for the complete workbook? I have 12 pages. Thank you. Ed, Not exactly sure what you mean. If you mean, insert it onto 12 different tabs/worksheets within a workbook and they're all in the same cell (e.g. A1), you can select cell A1 in Sheet 1, and then shift click on the final tab/worksheet. This will select cell A1 in all tabs. Press Ctrl ; to insert the date and press Ctrl Enter to enter it onto all 12 cells spread across the sheets. Clive -- Clivey_UK ------------------------------------------------------------------------ Clivey_UK's...

Help with Html Help in MFC
Hi; I am using Visual Studio .net 2003. I have created a CDhtmldialog. I also created a html help file using Html help workshop. According to some source from web saying that I can call this method: BOOL HtmlHelp( HWND hWndMain, LPCTSTR lpszHelp, UINT uCommand, DWORD dwData ), directly from anywhere in my code. So I include the htmlhelp.h and htmlhelp.lib to the project. But I don't know how to call this method, since there is a another htmlhelp method in Cdialog too: HtmlHelp( DWORD_PTR dwData, UINT nCmd = 0x000F ); Please give me a hand. Thx in advance. Pan Wilson. ...

Settings
Under Connect to Bank there are 2 url entries for one of my banks. Please can you advise where I can edit this. Thank you. Regards. ...

V4 Mail Merge on Custom entities
Hello We have noticed that new entities added at v4 appear in the mail merge list but that custom entities carried over when upgrading a v3 system do not. Does anyone have any information on how this is controlled and whether there is an option to set an entity as included once it has been created ? All info gratefully received Thanks...Phil That should help: http://blog.sonomapartners.com/2008/01/enabling-mail-m.html Cheers -- George Doubinski CRM Certified Professional - Developer Blog: http://crm.georged.id.au/ "Phil Kedward" <Phil Kedward@discussions.microsoft.com...

how to arrange list by first or last name
I am trying to make a list with first, middle, last name , street address, and phone numbers. I like to know how you can review the list by any combination of first name, last name, city, state, and or phone number? hi can you give examples of how your list is layed out. i am thinking a helper column with an extraction formula might work. regards FSt1 "Andy" wrote: > I am trying to make a list with first, middle, last name , street address, > and phone numbers. I like to know how you can review the list by any > combination of first name, last name, c...

Last name, first name
I have a list with lastname, firstname in a cell. I would like to change it to firsname lastname. Any clues? officexp. Thank you. Mich - Insert a column after your name column, highlight the name column, go to Data, Text to Columns, Delimited, select comma, finish. This will give you two columns, lastname, firstname. Insert a column before your lastname column. Move the firstname column to the new column. Your third column should now be blank. Enter in the formula =CONCATENATE(,A1," ",B1)in the third column. This will put your firstname space lastname in the third ...

Custom lists from different sheets
Hi to all, I want to create a custom list from linked data from other sheets. Lets say we create the list on 'sheet10' and the values will be taken from: 'Sheet1!A1' , 'Sheet2!A1' , 'Sheet3!A1' ect....and i want the list to continue till 'Sheet9!A1'. I tried to drag the first three link cells (on sheet10),in order to create the list but the next cells didnt jump to: 'Sheet4!A1',Sheet5!A1'.... Does somebody knows the answer.... Thanks in advance Hi One way is to link your formula to the row number, and use this to increment your sheet numbe...

No Smart Tag help: just a blank "MS Excel Help" window
When I invoke "help on this error" on a Smart Tag drop-down, a blank "MS Excel Help" window appears with no content. The general help pane that appears via <F1> etc. is fine - it's just the Smart Tag help option that doesn't show anything, just a blank window. Any suggestions? Win XP Home SP2 Excel 2003 (11.6355.6360) SP1 ...

A Customized View in Microsoft Project Professional 2003 on the EP
Dear Sir or Madam, In our company, we use MSP 2003 in a EPM. Planners customize a specific view(table and screen) and whenever they connect to the server, they want to have their own view(for instance, name, start, duration, baseline start...and on the screen comparison between plan and baseline bars and so on). I tried to develop a new table and then a new view and set it as a default view, but this is not the ultimate solution; since I want to have customized bar chart always and old projects get open in the old format. Could you please give me a hand? Regards Saeed ...

Windows 2008
Hi, I am an admin in windows 2008 server. However, I am not able to access the c:\Users\<user name>\Local Settings\History Anyone knows how to change the settings so I can access the folder? Thank you, "Jack Black" <gwklocker01@gmail.com> said this in news item news:60b578d9-ce73-4ab8-851b-9039ea6cfee5@n16g2000yqm.googlegroups.com... > Hi, > > I am an admin in windows 2008 server. However, I am not able to > access the > c:\Users\<user name>\Local Settings\History > > Anyone knows how to change the settings so I can...

Naming new server
Cana anyone tell me if there are any implication with Exchange 2003 with having the server physically named "xyz.company.com" and having a cname in the internal dns that point "mail.company.com" to "xyz.company.com"? I'd sooner not have to have users needing to know the specific name of the server they need (whether using pop3/imap/smtp/webmail) but I don't know if using an alias is likely to cause problems? TIA, Paul On Fri, 27 Jan 2006 02:56:43 -0800, Paul Hutchings <paul@spamcop.net> wrote: >Cana anyone tell me if there are any implicat...

PSTL Customer Modifier
Does anyone know if the Customer Modifier in the prof svcs tools library works for national/parent accounts? We currently own the Customer Combiner and I know that one doesn't work with national accounts. Thanks. Irish, I'm not familiar with the Customer Modifier, but I did a huge project with the Account Modifier / Combiner. All the Microsoft documentation said the tool would not do the 2 main taks we wanted to do - reduce the number of segments in the chart and reduce the size of a segment. It turned our that hte tool does do that. The process isn't documented...

Stop running sum(Over All) when customer change
Dear All I hv report based on tblTransaction which contains many customers with their transactions by date wise. I grouped report on CustomerID sub Group by Fromat(trnDate,”MMM-YY”) to get monthly transactions for each customer. I made calculated field to obtained closing balance with running sum over Group. I want to make the Running sum – over all but when customers is changing it must stop and start again, by default it will give running sum of all the customer, exactly this I don’t want. Any idea to stopped or make running sum based on customer when month is changing it ...

Tracking a Custom Outlook Form
One of our users has created a custom Outlook Contact form. It basically contains an additional text field and the form has no scripting in it whatsoever. He'd like to track these Outlook contacts in MSCRM. When the user attempts to track the contact by clicking the "Track in CRM" button on the CRM Outlook toolbar, he recieves the following error: This item type is not valud for promotion to Microsoft CRM. I attempted to reproduce the problem, yet the CRM isn't even available on the contact form on my computer. Is it possible to track Outlook contacts that are usin...

LDAP Issue
Hello, We work with an Authentication Service which does LDAP Connections to 3 different Domains. The Server with the Authentication Service is in a separate Domain and Network zone. The Server is running Windows Server 2003 R2. Tha Authentication Service retrieves information from the 3 domains: DomainA: All DCs running Windows Server 2003 DomainB: All DCs running Windows Server 2003 DomainC: All DCs running Windows Server 2008 The LDAP Bind for Domain A and B works fine. But the Server is unable to make a LDAP Bind to the Windows 2008 DC. More Information: - The F...

Email naming standards
I'd like to take a survey of email address naming standards and which ones you use. I've looking online for a "naming conventions" FAQ but had very little luck. At my company, it's currently lastnamefirstinitial@company.com, or smithj@company.com. I would like to lobby to change it simply because it's so out of step with the rest of the world. The way I see it, when it's jsmith@company.com there's a logical progression from left to right. We are changing the company name (and domain name), so the way I see it this is the perfect time to do it. Opinions? ...

automatic capitalize first letter of payee names
I just transferred from Quicken. I had it set to automatically capitalize payee names as I typed them. Is there a way to do it in Money 2004? No. "GB" <garyburkhardt@centurybt.com> wrote in message news:OZT4Yz1jDHA.3256@tk2msftngp13.phx.gbl... > I just transferred from Quicken. I had it set to automatically capitalize > payee names as I typed them. Is there a way to do it in Money 2004? > > Type them correctly once. The next time you start to type, the field will autofill. When you tab to the next field cap and all will be as when you originally typed the...

Lexar USB Flash ("Jump") Drives and Windows 98
Hi, I posted this (below) last year in Sept. I thought perhaps it can help someone who also uses Lexar "Jump" drives. Note: I did not buy another Lexar "Jump" drive after I posted this: I am a very active user of Windows 98se, and Lexar's "Jump" USB flash drives. Lexar's web site, the last time I checked over a year ago, provided the Win98 driver, but "JDUSBMS.INI" did not include the newer flash drives. What was missing is the PID in the .INI file of some of the newer Lexar flash drives (the ones I bought). ...

Printing through MFC
Hi All, I want to print a html file through MFC application. How can i do this? I have bypass print dialog window. Thanks for your inputs. Regards, Manohar On 1 May 2007 23:21:28 -0700, Manu <manoharbasireddy@gmail.com> wrote: Hi Manohar, > I want to print a html file through MFC application. >How can i do this? I have bypass print dialog window. Thanks for >your inputs. you might consider using and embedded webbrowser control in your MFC app. You might Google for some code samples, e.g. on CodeProject. I found the following url: http://...

Ftp service to a non windows machine.
With an FTP task in SSIS, I get the error: Error at FTP Task [FTP Task]: Remote path "PRIS:CSV.1" doesn't start with "/". The other machine is a non windows machine, there the filenames (system/directory) do not start with a slash. A 'normal' FTP server does work there the 'file' does not have toe start with a slash. How can I circumvent this problem? Is this the correct group for SSIS related questions? Sorry if I am in the wrong group, but I could not find a SSIS group. thanks for your time and attention, Ben Brugman Also tr...

how can I get outlook to set up my email accounts and have the se.
I keep getting error messages that the email server would not allow access, then the message now says that the email address line in outlook may be wrong, but I have checked it several times, and it is correct. It acts as though my previous attempts have somehow not been erased from the memory of the program. cjseals3 wrote: > I keep getting error messages that the email server would not allow > access, then the message now says that the email address line in > outlook may be wrong, but I have checked it several times, and it is > correct. It acts as though my previous attem...

Windows Installer Error 1635
I am getting the following error message when I try to import a CSV file to the calander. Starts off by saying can not start the required translator, tries to install then I get the error message. ...