|
is there any chance IDD_NEWCHAR1 has the same value as IDD_NEWCHAR2 ?
-c
Zzzzz...
|
|
|
|
|
Sorry for so much code, but I couldn't figure out how to attach the files to my message. The two ids IDD_NEWCHAR1 and IDD_NEWCHAR2 are defined in resource.h as 129 and 130 respectively. If someone can point out how to attach the files I would be more than happy to attach the code to make it easier to read.
Thanks again for the help,
-Eric
|
|
|
|
|
Firstly, its not possible to attach a file to a message on the CP boards.
As a possible solution, how is the DLL that has these dialog loaded? Is it dynamic? If it is, you may have to use the AFX_MANAGE_STATE() macro or the AfxSetResourceHandle() command to make sure that the correct resources are used when the DoModal() call is performed. Check you application that uses the DLL and see whether it has matching dialog resources using the same resource ID values (i.e. 129/130 as mentioned in the other reply).
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Roger,
Thanks for the help. The problem was that in the dll I had the resource ID defined as 129 & 130 as I already indicated. In the main application I also had some resource IDs with the same values. I did not realize that the two applications had to have seperate resource IDs.
The dll is statically linked to the main application, is this what caused this problem? If I were to dynamically load the dll would I still run into the same issue?
Anyways, thanks for the help! I was able to move on in the project again which I was stuck on for over a week.
Thanks,
-Eric
|
|
|
|
|
When you link to an MFC extension DLL, its resources are listed in a resource chain that is searched when looking for one. If its not found in the apps resources, each MFC extension DLL is checked in the order added to the chain until a matching resource is found (if available). This is why you were getting the problem as an existing resource already existed in your app with the same ID.
Its just a matter of being cautious.
Anyway, glad it solved your problem.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
I would like to be able to select some text (Specifically the URL in the Opera web browser), press CTRL+SomeKey or right click and select a command which copies the selected text into my program, which then changes the text and pastes the new text into the same place.
Is this possible using a shell extension? Or is there another way to accomplish this?
Thanks for any suggestions that could point me in the right direction.
|
|
|
|
|
Hello,
My suggestion is to use a global keyboard hook via the Win32 SetWindowsHookEx() API. Create your own keystroke combination and when that combination is detected by your hook, use other APIs to detect the current running process.
If the current process matches the required one (i.e. Opera), you can get hold of the current active text box and get the text from it and perform your processing (modify its text, etc) and then copy the resultant text into the clipboard.
You can then paste the clipboard text in the usual way.
Best of luck,
Bio.
|
|
|
|
|
Thanks for your help. Now I have a place to get started.
|
|
|
|
|
I have discovered an interesting behavior in Windows Messenger. When the app. is inactive (minimized to the system tray) it uses only about 4MB of physical memory, when it becomes activated (open main window), consumption of physical memory jumps to 7MB, and finally when the Windows Messenger is closed again (minimized to the tray), the physical memory consumption drops again (to about 2MB).
I was wondering how to duplicate such behavior for MFC/WTL/ATL or any other Windows apps? Is there a optimization option/switch in VS.NET? Or a Windows API to manage memory in such fashion?
Similar memory behavior occurs for VS.NET and Office XP applications. When minimized they use very little physical memory (at the expense of virtual memory).
Mike M
WinInsider.com
|
|
|
|
|
Take a look at SetProcessWorkingSetSize in the help.
John
|
|
|
|
|
Many thanks John!
I spend 30 min. talking to MS dev. tech supp. rep. telling me that it could not be done. Only tip that he would give is to make sure I delete all references to unused pointers (well ya!)
I should know better and to post question to CP , right away.
Thank you again
Mike M
WinInsider.com
|
|
|
|
|
I'm trying to resize a CProperty sheet, but keep getting a white block appearing over the default buttons and the right and bottom edges of the tab control. I have done the standard, sub-classing the CPropertySheet class, overriding OnDialogInit, OnApplyNow and OnNotify and used these to resize the Window, Tab Control and Current page. I haven't manged to find any articles relating to this problem, if it makes any difference I'm using the XP extensions.
Any help would be great!
|
|
|
|
|
Does an application ever need to bother about security? I see many applications being developed which require a login from the user and the application maintains its own user/pwd database. Wouldnt simply creating a user group and giving that group executable permissions on the executable files for the application suffice?
|
|
|
|
|
hi. i am working on a project with a graphical interface. when i run my project after 1 or 2 minutes my projects became very Very Slow. is there any resources that i should had released them ?? i am using GDI+. i did my best but i didn't find any resources that can be released.
thanx AnyWay
void CCheckersView::OnPaint()<br />
{<br />
CPaintDC dc(this);
<br />
Graphics graphics(dc.m_hDC);<br />
<br />
ColorMatrix colorMatrix = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f,<br />
0.5f, 1.0f, 0.0f, 0.0f, 0.0f,<br />
0.0f, 0.0f, 1.0f, 0.0f, 0.0f,<br />
0.0f, 0.0f, 0.0f, 0.2f, 0.0f,<br />
0.0f, 0.0f, 0.0f, 0.0f, 1.0f};<br />
ImageAttributes imageAtt;<br />
imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault,ColorAdjustTypeBitmap); <br />
for (int n=1;n<=18;n++) {<br />
for (int i=1;i<=del.n;i++)<br />
graphics.DrawImage(Bitmap::FromResource( AfxGetInstanceHandle(), (LPCWSTR) AKEINTRESOURCE(IDB_BMP)),Rect(0,0,67,67),0,0,67,67,UnitPixel,&imageAtt); <br />
<br />
SolidBrush s(Color(255, 114, 70, 57));<br />
for (int j=0;j<=7;j++)<br />
for (int i=0;i<=3;i++)<br />
graphics.FillRectangle(&s,i*(l*2)+x+(((j+1)%2))*l,y+j*l,l,l);<br />
<br />
<br />
<br />
<br />
}
|
|
|
|
|
I guess the Bitmap * returned by Bitmap::FromResource should be delete d after use.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Does anybody know how to make a controlbar that resizes when the framewindow resizes?
I've tried a couple of different approaches: catch the WM_RESIZE msg, used the RecalcLayout and looked around for information ... but I can't get it to work!!! Can somebody please tell me how this is done.
What I want to do can't be that difficult. I want to build a Search_bar that acts like the Address controlbar in windows explorer where the combo-box rezises to fit the main-frame.
|
|
|
|
|
Okay> I finally figured out thanks to CP gurus, how to create a submenu appended to a top level menu dynamically. I know the titles of the submenu items. THey have no IDs (maybe I need them after all?)
I want to give each submenu item its own little flyout dropdown menu (doesnt need to do anything when clicked).
So how do you give a dynamic submenu item a flyout? Should this be done in the same breath as creating the dynamic submenuitem, while one still have all the handles etc? Or later afte rall the submenu items have been dynamically created?
SO far I find the toplevel menu items pos, and then do:
CMenu* submenu = mmenu->GetSubMenu(pos);
Then do an Appendmenu on the "submenu" pointer. For each submenu I want a subsubmenu.....
To use the appendmenu I had to create a physical dummy resource submenu, or else GetSUbMEnu retiurns a null pointer. But definitely at the point when I want the subsubmenu I cant create a dummy resource for each submenu item (since its not been created in the resource editor...)
Appreciate your help,
ns
|
|
|
|
|
While awaiting perhaps more sensible responses, I am going to implement the WM_MENUCOMMAND when the non-ID bearing submenu item is clicked.....
Except the snag is that my flyouts are contained as the values in the container:
std::map<cstring, std::set<cstring="">> myMAp, and the key of this map is the submenuitem and the values of each key are in the flyouts. It would be better if I went along iterating through the CString keys recognizing them on the submenu titles and triggering the WM_MENUCOMMAND instead of my index..
Appreciate your help,
ns
|
|
|
|
|
Its done the same way you added the "flyout" menu as a top level one. Create a new sub menu and append/insert that to the previous sub-menu that was added as a flyout.
I wrote a function to do this a while back that worked with Brent Corcums BCMenu class. I have a modified version of it here to work with CMenu. Its basically a hacked version of that to use CMenu. Its not been checked/tested, so some of the calls on CMenu may be wrong, but you should be able to find the correct version of the function in MSDN
bool AddMenuItem(CMenu *menu, CString& menu_name, CString& menu_option, int menu_index, bool first, int suggested_position)
{
int sub_menu = 0 ;
int num_items = 0 ;
CString pop_up_menu_name = "" ;
CString name ;
int pos = 0 ;
pos = menu_name.Find('\\') ;
if (pos < 0)
{
num_items = menu->GetMenuItemCount() ;
for (sub_menu = 0 ; sub_menu < num_items ; sub_menu++)
{
menu->GetMenuString(sub_menu, pop_up_menu_name, MF_BYPOSITION) ;
if (pop_up_menu_name == menu_name)
break ;
}
if (sub_menu == num_items)
{
CMenu *menuPopup ;
menuPopup = new CMenu ;
menuPopup->CreatePopupMenu() ;
menuPopup->AppendMenu(MF_STRING, menu_index, _T(menu_option)) ;
if (first)
menu->InsertMenu(num_items - 2, menu_name, MF_POPUP | MF_BYPOSITION, (UINT)menuPopup->m_hMenu, NULL, 0) ;
else
{
if (suggested_position < 0)
menu->InsertMenu(num_items, menu_name, MF_POPUP | MF_BYPOSITION, (UINT)menuPopup->m_hMenu, NULL, 0) ;
else
menu->InsertMenu(suggested_position, menu_name, MF_POPUP | MF_BYPOSITION, (UINT)menuPopup->m_hMenu, NULL, 0) ;
}
}
else
{
menu->GetSubMenu(sub_menu)->AppendMenu(menu_option, MF_OWNERDRAW, menu_index);
}
}
else
{
name = menu_name.Left(menu_name.Find('\\')) ;
menu_name = menu_name.Right(menu_name.GetLength() - name.GetLength() - 1) ;
num_items = menu->GetMenuItemCount() ;
for (sub_menu = 0 ; sub_menu < num_items ; sub_menu++)
{
menu->GetMenuString(sub_menu, pop_up_menu_name, MF_BYPOSITION) ;
if (pop_up_menu_name == name)
break ;
}
if (sub_menu == num_items)
{
CMenu *menuPopup ;
menuPopup = new CMenu ;
menuPopup->CreatePopupMenu() ;
AddMenuItem(menuPopup, menu_name, menu_option, menu_index, bitmap, false, suggested_position) ;
}
else
{
CMenu *menuPopup ;
menuPopup = menu->GetSubMenu(sub_menu) ;
AddMenuItem(menuPopup, menu_name, menu_option, menu_index, bitmap, false, suggested_position) ;
}
}
return true ;
}
If there is anything about MF_OWNERDRAWN, just remove it.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Hi Roger,
I havent checked out your sample code yet.
The one snag I can see with repeating the flyout technique is that for the toplevel menu, to get the submenu pointer I had to have a dummy submenu item already created via the resource editor, else I got a null submenu pointer. I cant very well supply a resource editor drawn in flyout submenu dummy item for the flyout sussubmenus pointer.......................
Appreciate your help,
ns
|
|
|
|
|
Actually, the code I posted takes care of that condition. If you have a top level menu of:
"File Edit Window Help"
And need to add "Options\MyOptions", it will look for an exisiting "Options" menu. If it exists it will all the items, if not, it will be created and inserted into the top level menu.
THe only way I see it not working would possibily be if you subsequently removed all the sub-menu items and tried to append to an empty top level menu, but your delete menu item function should be written to take care of this situation.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Using segmenyts of your code I got my flyouts to work. Many thanks.
Appreciate your help,
ns
|
|
|
|
|
The menu_index you have in your code: are you just creating something like menu_index = 5000, and doing a menu_index ++ on it to append subsequent sublevel 1 submenus? How d oes one know if 5000 is "safe" to use as an ID? Presumably to capture clicks on the menu itemn you identify it by the menu_index...?
Appreciate your help,
ns
|
|
|
|
|
7 years later...
Needed sub menus, found your post, helped, thanks!
|
|
|
|
|
Long time ago someone showed me how to set up the release version so it can be debugged just like the debug version. But I dont remember it...???
Appreciate your help,
ns
|
|
|
|
|