|
Okay,
So I have a menu from a system tray icon. In this menu is a static
popup menu. Inside that menu is a dynamic series of further popup
menus. In each of those menus are the actual menu items...
So far I handle WM_INITMENUPOPUP. Grab a CMenu* to the top level
static popup. Then loop: Create a dynamic popup menu. Create a new
menu with all the elements that will go in that dynamic popup. Then
AppendMenu that menu to the dynamic popup menu.
The problem, an Assert when expanding any dynamic popup menu (going
out of scope?). The code seems to work fine if I use a CMenu* popup
instead but ofcouse leaks memory.
How should I be doing this properly (ignore messages for now). CMenu*
or not? Where to delete? Handle one popup at a time perhaps? i.e.
First when initial menu is selected, then when popup expands etc. Any
pointers much appreciated...
<br>
void CMyDlg::OnInitMenuPopup( CMenu* pPopupMenu, UINT nIndex, BOOL
bSysMenu )
{
...
CMenu* pBase = pPopupMenu->GetSubMenu( 0 );
for( int i = 0; i < m_nPopups; i ++ )
{
CMenu popup;
popup.CreatePopupMenu();
for( int j = 0; j < m_nItems; j ++ )
{
popup.AppendMenu( MF_BYPOSITION | MF_STRING, 0, "test" );
}
pBase->AppendMenu( MF_STRING | MF_POPUP, ( UINT )popup.m_hMenu,
"popup" );
}
}
|
|
|
|
|
Every time through the for(i) loop, the popup object gets destructed, which destroys the underlying menu. You can call Detach() at the end of the loop so CMenu doesn't destroy the menu. This won't leak resources as long as you properly destroy the top-level menu, since doing so automatically destroys all submenus.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Thank you sir, that worked like a charm...
|
|
|
|
|
Hello everybody:
i need to produce the zoom in out function at eVC..
who can tell me how to do it .. Please.
|
|
|
|
|
What is eVC ? What do you want to zoom ? Are you using MFC ? Doc/View ? Some info would help...
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Please post a real email address to your preferences, the one you put bounces.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
hello Christian:
my email address is tony@alleyoopcomm.com
and i want to zoom the map or graphics not the document
and the eVC is Microsoft eMbedded Visula C++..
thank you every much!;)
|
|
|
|
|
Am I right in thinking evc = Windows CE ?
I assume this means you're using doc/view ? You need to remember the zoom factor and draw the image scaled accordingly. Based on the limited information you provide I can't really help further.
I can't do anything with your email, except tell you it's totally different to the address you've put in your profile, so I get an undeleverable message every time I resond to you.
Jonathon
|
|
|
|
|
Hi Jonathon:
Yes you right,i am using Microsoft eMedded Visual C++ to develop application at Windows CE.
I am first time to develop about the graphics application..
and my email is correct i try to put anther email address in my profile ..
thank you
|
|
|
|
|
Hello all,
I have a NT Service running on localSystem account that will read a mapped drive. In the service, I used LogonUser and ImpersonateLoggedOnUser to get security rights to the mapped drive before i do any reading/writing to the mapped drive. I have mapped the drive in the explorer.
The problem occurs is that when my machine boot up without logging in, the error log file says that the network path is not found (referring to the mapped drive). I am guessing that a script/ service to map all drives was not ran when my service started.
My question is, is there any way that i can call that particular script/service to run and map the drives from my service before any login is done.
thanks
|
|
|
|
|
As mentioned when you asked this question previously, you can't guarantee that the mappings will be made when your service starts. You should use fully qualified UNC names rather than mapped drive letters:
CreateFile("\\My_Network_Machine\C_Disk\Temp\SomeFile.log"...);
CreateFile("M:\Temp\SomeFile.log");
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
|
I've noticed that the base dialog class in WTL doesn't handle adjusting the font of the dialog template to the shell font. MFC does handle this, but I'd prefer to use WTL due to its light weight. I'm contemplating modifying the WTL source directly, but if someone has another solution, I'd love to hear it.
Thanks,
Jim
|
|
|
|
|
Yeah, set the FONT line in your dialog resources to "MS Shell Dlg" and add the dialog style DS_SHELLFONT. You'll have to do that by manually editing the .RC file, and if you ever modify your dialogs with the resource editor, it will remove those changes and you'll have to make them again.
I think the MFC way of modifying the font on the fly is some serious legacy code, since the purpose of MS Shell Dlg is to have the OS pick the right font automagically.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Problem is, extended dialog templates aren't supported on Windows 95 (they cause a GPF). I suppose one could simply choose not to support Windows 95 (as Microsoft has), but I'd prefer to have the option of supporting it.
Jim
|
|
|
|
|
Really? That seems odd, and the DLGTEMPLATEEX docs say it's supported on Win 95. I'll have to try that out myself since I have code that uses DIALOGEXs.
The docs for DS_SHELLFONT say "It is also recommended that you use the DIALOGEX resource" so it might work with a plain DIALOG. If not, then I suppose MFC's way is the best way.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
hi,
I want use TAPI3 to transfer & conference a call. How to do it?
anybody has a sample?
hi
|
|
|
|
|
|
Well i wan to learn more about programing so i am going to need help like tutorials and things like that. Well i am new so email me or post here to help me. I have experiance in some programing so i now the basic but need more to do.
There is no emotion; there is peace.
There is no ignorance; there is knowledge.
There is no passion; there is serenity.
There is no death; there is the Force.
- The Jedi Code
|
|
|
|
|
Well, there's plenty of info on the site - why not try working through some of it and post questions when you get stuck ? Have you had experience in C++ ? If not, you should get some before trying any Windows specific stuff.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I am a beginner programmer and I don't know much about debugging but I get KERNAL32 errors when I hit the close button now and have no idea what to do. When I hit close I get this error box:
%Name% has caused an error in
KERNAL32.DLL
%Name% will now close
When I hit debug I get another one that says:
Unhandled exception in %Name%.exe (KERNAL32.DLL): 0xC0000005: Access Violation.
Then a yellow arrow is pointing at the following code:
BFF64346 xadd dword ptr [ecx],eax
Where should I be looking and what should I look for? I tried commenting out all functions etc except:
CDialog::OnOK();
Please help
-Matt Newman
|
|
|
|
|
One place to start is to display the call stack (alt+7 if memory serves). You may (or may not) be able to dclick back to some area in your apps exit code that gives you a clue.
|
|
|
|
|
Hi,
I'm trying to set the lparam of a TV_INSERTSTRUCT to an integer value and everytime I call GetTreeCtrl()->GetItemData(hItem) I always get back 0. Following is my code:
TV_INSERTSTRUCT tvInsert;
tvInsert.hInsertAfter = TVI_LAST;
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvInsert.item.hItem = NULL;
tvInsert.item.stateMask = 0;
tvInsert.item.state = 0;
tvInsert.item.iImage = 4;
tvInsert.item.iSelectedImage = 0;
int inputId = 17;
tvInsert.item.lParam = (LPARAM)inputId;
CString szName("Hello World");
tvInsert.item.pszText = (LPTSTR) (LPCTSTR) szName;
HTREEITEM hParent = GetTreeCtrl().InsertItem(&tvInsert);
CString szText(GetTreeCtrl().GetItemText(hParent));
int iId = GetTreeCtrl().GetItemData(hParent);
Does anyone know why I always get back a 0 in iId? This is very frustrating.
Thanks for any help you can provide,
Craig
|
|
|
|
|
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
Add TVIF_PARAM to that.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Thanks Michael,
Something so easy that I totally overlooked, works great...
Thanks again,
Craig
|
|
|
|