|
Yeah, that's what I'm thinking... the tree view isn't sending any notification to it's parent... But I'm able to create a hook directly to the tree view window, so do you think that I could get the TVN_SELCHANGED notification in WM_PARENTNOTIFY?
What I need to do is to know that the selection has changed in the tree view. If there's a way to do this with WM_xxx messages directly in the tree view, I'd like to know it!
Thanks!
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
I don't seem to be getting any notification from the tree view So, is there some way (read: hack or trick) that I can know that an item has been selected? I'm able to create a hook directly to the tree view window so I guess I could play around with the WM_xxx messages
Thanks!
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
What if you established a hook to the treeview's parent instead?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
|
Hello all! I'm an intermediate programmer, and need help on this particular issue: I have a program that runs with plugins that are loaded at run-time. Plug-ins can be installed and deleted and the program runs without a hitch. But I've been having a problem trying to come with some method of allowing the addition of menu items to a tray icon's menu at run-time and handling when the user clicks on these menu items. I've seen something similar done, where a basic menu is created then the program adds items at run-time and handles them as well, but the ID Routing is something that I'm having trouble with. Does anybody have any suggestions, or even source code with this type of feature? Thanks for all your help!
Sean Payne (Zero_Divide_1)
|
|
|
|
|
If you use TrackPopupMenu to display it, use the TPM_RETURNCMD flag so that the selected option code is returned locally to the procedure that calls TrackPopupMenu() (i.e. not a WM_COMMAND message sent to you). If its one you recognise, you porcess it locally, else you have to check each of your plug-ins to see if they are the one to handle it.
Similary, your plug-ins will have a procedure to setup the dynamic menu, something like this:
CMenu menu;
menu.CreatePopupMenu(); // or use LoadMenu and GetSubMenu(0)
menu.AppendMenu(...) ; // add local commands
for each plug-in
{
plugin.AddMenuItems(menu);
}
int sel = TrackPopupMenu(menu, TPM_RETURNCMD, ...)
switch (sel)
{
case 0:
// aborted
break;
case MY_COMMAND1:
...
case MY_COMMANDX:
break;
default:
// command added by plug-in, check the plugins to see who needs to handle it
}
A quick pseudo code hack above, but should give you the idea.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hey, thanks a lot! That idea is so much better than the one I came up with. In fact, 2 hours ago I finished a class to handle the requests using ON_COMMAND_RANGE and having the class lookup the correct callback function in the plug-in to call, but your idea is so much better. Maybe I should write an article and post it on CodeProject to help all those other coders out there who need help with this type of problem as well (don't worry, I'll mention that you told me about this possibility - I don't like taking credit for things that I didn't come up with). Thanks so much!
Sean Payne (Zero_Divide_1)
|
|
|
|
|
im trying to do some excel automation but im getting that _com_dispatch_method is undefined, im using MFC, any idea why?
|
|
|
|
|
Did you call AfxOleInit or CoInitialize before any automation code?
Bunburry
|
|
|
|
|
yes, but i doesn´t even compile i get that linker error
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
[^]
|
|
|
|
|
#include <atlcom.h>
#include <comdef.h>
does this help compiling?
Bunburry
|
|
|
|
|
¿?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
[^]
|
|
|
|
|
sorry if forgot the <> tags
So again:
#include <atlcom.h>
#include <comdef.h>
Bunburry
|
|
|
|
|
Nope Still the Same
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
[^]
|
|
|
|
|
my last idea:
#include <comutil.h>
Bunburry
|
|
|
|
|
nope still the same
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
[^]
|
|
|
|
|
Try uncommenting COM related code snippets, try figure out which part causes this
Bunburry
|
|
|
|
|
i will thanks a lot
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
[^]
|
|
|
|
|
hi, i found the solution this weekend , i just needed to add comsuppw.lib ,
thanks for all your help
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
[^]
|
|
|
|
|
OK so this is kind annoying:
I have a an environment varialbe that I want added to the Users env vars, and tehn appended to the Users Path.
So I modify the HKEY_CURRENT_USER\Environment and add a value called FOO, that equals "c:\tmp\crap".
I then modify the path value and add "%FOO%" to the beginning of the string.
I close regedit.
Now I run a small program that does the following:
DWORD res = 0;
DWORD res2 = SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment", SMTO_ABORTIFHUNG, 5000, &res );
if ( !res2 ) {
char tmp[256];
sprintf( tmp, "SendMessageTimeout error: %d", GetLastError() );
MessageBox( NULL, tmp, "Error", MB_OK );
}
else {
char tmp[256];
sprintf( tmp, "SendMessageTimeout res: %d", res );
MessageBox( NULL, tmp, "SendMessageTimeout lpdwResult", MB_OK );
}
I open the System properties adn sure enough a new env var has been added (FOO=C:\tmp\crap), and path now has the %FOO% value, expanded to "c:\tmp\crap".
I open a command prompt and type path:
Alas it does NOT see the expanded FOO value, and instead only prints out %FOO% (plus the rest of the path).
I had thought the problem might be with the installer, which performs these same steps. So I tried the above manually with regedit and running the little refresher program manually.
Obviously I am doing something stupid but I cannot find out what, nor has googling for this proved enlightening, other than to provide countless examples of the above code that *should* work.
The ultimate point of course, is to have some executable (a command line program) that would be located in the directory pointed to by FOO, and then be able to run it from the command line. This, so far, has not worked without rebooting.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
My first guess would be that you have too many environment variables, or those that you do have are too large. To test this theory, remove one of the longer ones and see if FOO and PATH show up properly.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Nope, no dice.
Still doesn't work.
I even tried clearingthe whole path. And made sure both were REG_EXPAND_SZ types.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Not that it matters, but I don't think that FOO needs to be REG_EXPAND_SZ type as there is nothing to expand.
I am able to reproduce the problem. Sometimes it works and sometimes it doesn't. The amount of time I wait after changing the variable but before opening a command prompt does not seem to matter. When I removed a few of my environment variables earlier, it was showing up correctly. Now it seems to be intermittent.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
The one thing I found stated that programs don't have to process te WM_SETTINGSCHANGE message. If they do they return 0. Even if they do process there is no guarantee they will handle it correctly ( I love this, it just keeps getting better).
The solution proposed was to insert some kind of crazy system hook to "fix" this, but in the case of env variables I really don't understand what you'd do.
I would desparately love to solve this. Obviously programs like the DevStudio installer handle this (though you do end up rebooting, so maybe they don't handle it correctly after all)?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
I want to make an MFC? app containing an edit box similar to the command line that can:
1. add a prompt on every line
2. notify parent on 'enter'
3. inhibit edit on all but the current line
Is there anyone who knows of anything existing or have an idea of how to achieve the above?
|
|
|
|