Failed to customize the dialog box of toolbar #3

I cannot fill the left-hand list box of toolbar's dialog box,and if I
delete one
button in toolbar,I lost it.
It's hard to format code here,are there any tricks?

Below is my code:

#include<windows.h>
#include<commctrl.h>
#include"resource.h"

#defineID_TOOLBAR20001

staticchar*szAppName="StudyToolbar";

LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);

TBBUTTONtbButtons[]=
{
{STD_FILENEW,IDM_FILE_NEW,TBSTATE_ENABLED,
           TBSTYLE_BUTTON|BTNS_SHOWTEXT,0,0},//1
{STD_FILEOPEN,IDM_FILE_OPEN,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//2
{STD_FILESAVE,IDM_FILE_SAVE,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//3
{0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0},//4
{STD_PRINTPRE,IDM_FILE_NEW,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//5
{STD_PRINT,IDM_FILE_NEW,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//6
{0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0},//7
{STD_COPY,IDM_EDIT_COPY,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//8
{STD_CUT,IDM_EDIT_CUT,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//9
{STD_PASTE,IDM_EDIT_PASTE,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//10
{0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0},//11
{STD_FIND,IDM_FILE_NEW,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//12
{STD_REPLACE,IDM_FILE_NEW,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//13
{0,0,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},//14
{STD_HELP,IDM_FILE_NEW,TBSTATE_ENABLED,
           TBSTYLE_BUTTON,0,0},//15
{0,0,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},//16
};


intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,
                                 PSTRszCmdLine,intiCmdShow)
{
HWND                  hwnd;
MSG                     msg;
WNDCLASS       wndclass;

wndclass.style=CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName="MainMenu";
wndclass.lpszClassName=szAppName;

if(!RegisterClass(&wndclass))
{
MessageBox(NULL,TEXT("ThisprogramrequiresWindowsNT!"),
szAppName,MB_ICONERROR);
return0;
}

hwnd=CreateWindow(szAppName,
                                     szAppName,
                                     WS_OVERLAPPEDWINDOW,
                                     CW_USEDEFAULT,
                                     CW_USEDEFAULT,
                                     CW_USEDEFAULT,
                                     CW_USEDEFAULT,
                                     NULL,
                                     NULL,
                                     hInstance,
                                     NULL);

ShowWindow(hwnd,iCmdShow);
UpdateWindow(hwnd);

while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

returnmsg.wParam;
}

LRESULTCALLBACKWndProc(HWNDhwnd,UINTmessage,WPARAMwParam,LPARAMlParam)
{
HDC                 hdc;
HWND             hToolBar;
LPNMHDR      pnmh;
intitemNo        = 0;

switch(message)
{
caseWM_CREATE:
hToolBar=CreateToolbarEx(
hwnd,
WS_CHILD|WS_VISIBLE|
TBSTYLE_FLAT|TBSTYLE_LIST|
CCS_ADJUSTABLE,
ID_TOOLBAR,
1,
HINST_COMMCTRL,IDB_STD_SMALL_COLOR,
(LPCTBBUTTON)&tbButtons,
16,
0,0,0,0,
sizeof(TBBUTTON)
);
return0;

caseWM_NOTIFY:
pnmh=(LPNMHDR)lParam;
if(pnmh->code==TBN_QUERYINSERT||
   pnmh->code==TBN_QUERYDELETE)
    returnTRUE;
elseif(pnmh->code==TBN_GETBUTTONINFO)
{
LPTBNOTIFYlpTbNotify=(LPTBNOTIFY)lParam;
itemNo=lpTbNotify->iItem;
if(itemNo<16)
{
ZeroMemory(&lpTbNotify->tbButton,sizeof(lpTbNotify->tbButton));
lpTbNotify->tbButton.iBitmap = tbButtons[itemNo].iBitmap;
lpTbNotify->tbButton.idCommand = tbButtons[itemNo].idCommand;
lpTbNotify->tbButton.fsState = TBSTATE_ENABLED;
lpTbNotify->tbButton.fsStyle = TBSTYLE_BUTTON;
lpTbNotify->cchText = 0;
returnTRUE;
}
}
return0;


caseWM_DESTROY:
PostQuitMessage(0);
return0;
}
returnDefWindowProc(hwnd,message,wParam,lParam);
}

0
wei.niu (41)
11/23/2006 4:55:21 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
471 Views

Similar Articles

[PageSpeed] 33

For more readable code,please click below:
http://www.codeguru.com/forum/showthread.php?p=1495447#post1495447

0
wei.niu (41)
11/23/2006 5:34:39 PM
Reply:

Similar Artilces:

Customize Outlook Today #33
The Customize Outlook Today option has quit working. Stuck on the Summer view. I have uninstalled and reinstalled, and applied all updates. Still stuck on summer view and not responding. Any Ideas? ...

Send email to custom entities in CRM 3.0
How do I send email to entities other than account, contact, leads and users? Not possible. "Andy" wrote: > How do I send email to entities other than account, contact, leads and > users? > I found out the following: It turns out every CRM 3.0 email is made out of three types of records, all of which are tied together through a common ActivityId: activitypointer - this is the main record and it holds the fields common to all activities email - this holds fields uniquely related to emails such as the mime type, tracking token, etc. activityparty - this holds sender and...

windows updates installation fails
Hello there, I am using XP Pro sp3, I just installed it and when running the windows updates from IE I am able to download the updates bu then the installation fails. How can I delete all downloads and reset the windows client update settings? Thank you, T Which is the update(s) failing to install? Further information required: How to view the Update log in Windows Click Start, and then click Run. In the Open box, type %windir%\windowsupdate.log and then click OK. Scroll down towards the bottom for the latest entries to locate the error code(s) associated with the ...

Personal.Xls #3
Hi There, I changed some code in a macro inside my Personal.xls file and saved it. Now when I try to run the macro I get an error message saying that a file called Personal.xls is already open and I can not open another. What have I done wrong? Thanks for your help, Steve Wilson. It's OK I have sorted this out. I saved Personal.xls to another drive and when I opened Excel it loaded Personal.xls from the XLStart Dir as usual but when I clicked on my macro button in the toolbar it was pointing to the macro in personal.xls on the other drive. All the best, Steve Wilson. "Alway...

Report generated from text box fields
hello. i have a 3 column report. The 3 products compared on the report are assigned when the report opens and asks the user for the ID.. is there are way to create 3 unbound text fields and have the report compare the IDs of the products listed in the text box.. i have done something similar that searches based on what was entered in a text box, but wasnt sure how to have the report pick up three different text boxes.... this is an example of what i have in another application that opens up a query Like "*" & [forms]![SEARCHMENU]![text37] & "*" -- Message po...

Toolbar + &
Before I reinvent the wheel, I'm looking for sample code to implement toolbar buttons for (+( Increasing and (-) Decreasing magnification and for setting a percentage, either from a list or as a user-entered number. Any URLs, book references, or suggested places to look in the M/S SDK would be greatly appreciated. TIA Norm The buttons are just buttons, but for the percentages you'll probably want a combo box so users can type in a percentage that is not in the list. Here's a couple of links to articles that put a combo box on a toolbar. It's pretty simple really so yo...

Black box when printing embedded chart to XPS
On a machine with Excel 2007 installed, open WordPad. Insert -> Object. Choose "Microsoft Office Excel Chart". A generic looking chart gets inserted into the document. Print it to a printer, and it prints fine (at least for me). Print it to the XPS printer (or PDF printer) and you get a black box where the chart is supposed to be. This is causing havok on a program I maintain that uses embedded excel charts. I thought it was a problem in my program, but now I've replicated it only using WordPad, Excel 2007, and the Microsoft XPS printer. ...

Left Lookup Custom function
Hello all I am trying to write a custom function to do the work of my current function, so that all I have to do is type the custom function name in and select the cell. This is what I have so far, but is not working for me. As I am new to Custom Functions some help would be greatly appreciated. This is the original function =Left(A2,Search(" ",A2,1)-1) This is what I am trying to use in VBA Function LeftSearch(textStr As Variant) LeftSearch = Left(textStr, Search(" ",textStr,1) - 1) End Function Thanks in Advance Jacob VBA has the equivalent of =Search() in i...

Dialog won't run from static library
I have a static library that I want to run a dialog from. I added a resource file and created the dialog and it's class, but it won't run. When my application makes the library call that ultimately ends with DoModal being called, it just locks up the application. There is a brief flicker like the dialog is trying to display, but that's it. What am I doing wrong here? On Mar 16, 12:07 pm, "Ajay Kalra" <ajayka...@yahoo.com> wrote: > Debug and see what particular call fails starting from the constructor on > and into OnInitDialog. Its possible that the dial...

How to add customer's totalSales without transaction?
Some customers transaction record are lost. I only have their totalSales. Now I want to add these customers to rms with their totalSales. How can I do it? Jerry wrote: > Some customers transaction record are lost. I only have their totalSales. Now > I want to add these customers to rms with their totalSales. How can I do it? > You can add the customers and their totalSales only from QS Administrator with SQL query.. example: UPDATE Customer SET TotalSales = <AMOUNT> WHERE AccountNumber = <CustomerAccountNumber> bye antonio ...

Can I create custom theme fonts?
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I have a variety of office documents where the fonts that I use are not available in any of the theme fonts. I would like to be able to modify the standard fonts that are part of a theme the same way that I can modify the colors that are part of that theme. I've searched Help and the web to no avail, so I'm assuming this feature doesn't exist. ...

Spend in Customer Profile Purchase History to include Tax?
Is there any way to have this field (Customer Properties > Purchase History) reflect the total spend for a customer (including tax)? Regards, -=RFM=- ...

Reply Address #3
Using Exchange 2003 and outlook 2003 is there a way to force the "reply to address" to be something besides the Sending address. The example is listed below. These are the sending addresses PHostetter@domainname.com JRoetman@domainname.com DKrischel@domainname.com This is the address I want all replies to be returned to. dp@domainname.com This is the address I want all replies to be returned to. On Sat, 25 Jun 2005 07:30:19 -0500, "Roger Crawford" <rcrawford@nospam.scci.com> wrote: >Using Exchange 2003 and outlook 2003 is there a ...

Open File Dialog
In a database I use an Open File Dialog to open multiple files using an Array and then I use the Array to populate a list and process it. This works great, until I select over 7 files, at which point the array remains empty without the error handler triggering. Is there a logical reason and/or solution for this? Further research indicates that when the number exceeds 7 the following line starts giving a False instead of a True: aht_apiGetOpenFileName(OFN) ...

Excel Cell Formatting #3
How do I centeer a picture in an Excel cell? Hi you can't as such objects 'float' above the cells in Excel -- Regards Frank Kabel Frankfurt, Germany "Tom Coffey" <Tom Coffey@discussions.microsoft.com> schrieb im Newsbeitrag news:8E7356E1-4318-42F3-B9C6-3D7EDFBBEEA1@microsoft.com... > How do I centeer a picture in an Excel cell? ...

WMP Libraries and Custom extension.
Hello, I am not sure this is the proper forum for what I need but it was the closest one I found. What I want to do is add a custom extension to WMP libraries. I have searched alot then I have changed the registry: Windows Registry Editor Version 5.00 ; Parts are set, but type already exists [HKEY_CLASSES_ROOT\.mntit] @="mntit_auto_file" "PerceivedType"="video" ; WMPlayer extension [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Multimedia\WMPlayer\Extensions\.mntit] "PerceivedType"="video" "Permissions"=dword:00000008 &quo...

How can I get a combo box to get data based on a text box?
Hi, I have a text box that looks up an ID number from a table. I want the User to type in an ID and then have a combo box on the same form that gives a list of dates that correspond to that ID in the text box. Right now, the combo box displays all the dates from all the ID's. I want it to only show the dates that are linked to that ID. Please help, Thanks Use the text box's AfterUpdate event to modify the combo box's RowSource property: Me.ComboBox1.RowSource = "SELECT ... FROM ... WHERE FieldID=" & Me.TextID & ";" tyler.deutsch@gmail.com wrote...

Printing Different Invoice Forms depending on Customer Class ID
We bill in multiple currencies for multiple countries. Does anyone know how to automate the procedure to print the SOP Invoice document on different forms based on customer Class ID or currency? -- Burke Gladding How different are the formats? You might be able to use one format with conditional formatting for elements on the report. "Burke Gladding" wrote: > We bill in multiple currencies for multiple countries. Does anyone know how > to automate the procedure to print the SOP Invoice document on different > forms based on customer Class ID or currency? > -- ...

Check boxes to text 05-12-10
Is there any way that I can have check boxes automaticaly transfer their information to text? example: Check boxes = red, blue, green If you click the red and green check boxes, the title would be as bellow. Title on the page = Lable order for: red, green Thank you Again, what you ask is at present incomprehensible. If the link I posted earlier does not work for you then the alternative is a userform - For the basics, see Word MVP FAQ - Userforms http://word.mvps.org/FAQs/Userforms.htm for a more in depth explanation, see http://gregmaxey.mvps.org/Create_and_employ_a_User...

Expedia Map function fails
The map an address button found in the contacts view of Outlook 2000 now sends me to a Microsoft Website instead of sending me to Expedia. I've not been able to find anything in the KnowledgeBase on this. Has this function been disabled by Bill's minions or is there a problem with my Outlook 2k installation. The original URL was broken and no redirect was provided. No official fix from Microsoft yet, but there's a registry hack to make it work -- look here for instructions: http://www.poremsky.com/displaymap.htm -- Jocelyn Fiorello MVP - Outlook *** Replies sent to my...

Combining data from 3 fields (colums)
I have a list of doctors on a spread sheet. Column A is "First Name", Coumn B is "Last name" and Column C is "Degree". I would like to combint the three columns to in Column D to read Joe Smith, MD. Note that I would have to add comma after last name. Any help is greatly appreciated. Hi Try this: =A1&" "&B1&", "&C1 Andy. "Tom S." <anonymous@discussions.microsoft.com> wrote in message news:8519C2FC-74C7-4ADE-97F3-978F4C0E0682@microsoft.com... > I have a list of doctors on a spread sheet. Column A is &...

How do I display the invoice toolbar for unique invoice #'s?
I do not see the Invoice toolbar under the regular View - Toolbars menu option. I am creating invoices and need to have unique invoice numbers. Where do i go to display it. Please help. Thanks. QueenZoie, Excel does not have an invoice toolbar as far as I know, have a look here for ways to do it http://www.mcgimpsey.com/excel/udfs/sequentialnums.html -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "QueenZoie" <Qu...

How to install CRM 3.0 on Windows Server 2003 x64 version?
Hi there, I have a x64 CPU machine with SQL 2005 x64 version installed. Now I want to install CRM 3.0 on this machine. Is it possible for this? Thanks! Bennett sql 2005 x64 is supported but the web side of things is not. ============================== John O'Donnell Microsoft CRM MVP http://www.crowechizek.com/microsoft "Bennett" <Bennett@discussions.microsoft.com> wrote in message news:D737C886-2010-4328-A6EE-7A6FEBF20F49@microsoft.com... > Hi there, > > I have a x64 CPU machine with SQL 2005 x64 version installed. Now I want > to > install CRM 3.0...

Stuck email in my out box (15 MB)...cannot delete becuase it is "already transmitting."
Help!!! How do I delete it...I cannot delete a 15MB email in my out box becuase it said it is "transmitting." It's been transmiting for three days! Check: File | Work Offline and in: View | Layout: Uncheck the Preview Pane. Can you delete it now? -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "THP" <teresahparker@sbcglobal.net> wrote in message news:3EDD2EEF-6FFE-4FF7-982E-D20FB1D53B91@microsoft.com... > Help!!! How do I delete it...I cannot delete a 15MB email in my out > box becuase it said it is &quo...

Outlook 2003 Customized Folders
It seems like it should be an obvious option, but I can't find it...does it exist? I've finally got the view setting on my Inbox the way I like them (View - Arrange By - Current View - Customize Current View) and would now like to apply those settings to all my other folders and have it be the default set-up for new folders. I have found that I can change one folder at a time by using File -> Folder -> Copy Folder Design. But I can only do one at a time and I have more than 30 subfolders. It would seem there would be an option to change the default settings for all...