|
Hi All,
This should be the last question on Context Menus...
IContextMenu2 handles the WM_DRAWITEM, which I am trying to use to place an icon (16x116 or 3x13 bitmap) on the Menu. I can't seem to get it to work (fully patched Windows 2000, VC++ 6.0 EE).
Any ideas?
Jeff
|
|
|
|
|
Hi All,
I've used Michael Dunn's article[^] to create two Context Menu handlers. They are housed in separate DLLs. They are basically carbon copies of one another (and the sample which Michael provides) except names. Each uses the same insertion code:
InsertMenu( hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, _T("Menu Item Name") );
However, the items are not placed one after the other ('stacked') as I would expect. As a matter of fact, Windows (at times) places a separator bar between them:
Open with WinZip
Print
----------------
Menu Item 1
----------------
Scan for Viruses
Open With...
Menu Item 2
Winzip
----------------
...
Any ideas to get these fellows to stick together?
Jeff
----------------
|
|
|
|
|
You have no control over what other extensions will do with the menu, nor in what order Explorer will call them. You might be able to influence the order by making your two extensions' ContextMenuHandlers keys have similar names (FooExtension1 and FooExtension2 , for example) but no guarantees.
|
|
|
|
|
Hi Mike,
> nor in what order Explorer will call them
That is more or less my (ignorant) feeling.
> influence the order by making your two extensions'
> ContextMenuHandlers keys have similar names
I tried adding an space (' ') to the names - they get indented on the menu, but not grouped together.
Jeff
|
|
|
|
|
> ContextMenuHandlers keys have similar names...
That was it: in the *.rgs files:
VerifyHash -> CtxVerifyHash
CreateHash -> CtxCreateHash
They are grouped together, partioned by separator bars. Below is for the benefit of others following your articles
Jeff
HKCR
{
NoRemove CLSID
{
ForceRemove {7E745006-XXXX-XXXX-XXXX-E24D4133439C} = s 'CtxVerifyHash Class'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
}
}
NoRemove *
{
NoRemove ShellEx
{
NoRemove ContextMenuHandlers
{
ForceRemove CtxVerifyHash = s '{7E745006-XXXX-XXXX-XXXX-E24D4133439C}'
}
}
}
}
|
|
|
|
|
Hi All,
Can anyone tell me how to return a VARIANT array value from the Activex to the host program , waiting...
Thanks and Regards
Alic
|
|
|
|
|
You need to use SAFEARRAY . I found this article [^] having its usage.
|
|
|
|
|
:-DThanks for your article!
|
|
|
|
|
As said use SAFEARRAY.
In ATL you can use CComSafeArray class. This class provides a wrapper for the SAFEARRAY.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
ok, I will use CComSafeArray, Thanks!;P
|
|
|
|
|
Thanks everybody .
I hope you have a nice day!
Alic
2006-12-15
|
|
|
|
|
Hi there,
Is there a simple way to implement Ctrl-A as select all for all edit controls in a WTL dialog. I guess one way is to use a accelerator table and implement ID_EDIT_SELECT_ALL, but is there a nice way to reroute all edit accelerators to the focused edit control in a dialog window. Is there a better way?
Best regards,
E
|
|
|
|
|
You could write your own edit class that handles the Ctrl-A, and subclass each edit control on your dialog:
Partial class:
class CSelectEdit : public CWindowImpl< CSelectEdit, CEdit >
{
public:
....
BEGIN_MSG_MAP(CSelectEdit)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
....
END_MSG_MAP()
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if ( GetKeyState(VK_CONTROL) < 0 && wParam == VK_A )
{
SendMessage( EM_SETSEL, 0, -1 );
return 0;
}
bHandled = FALSE;
return 1;
}
};
Then in your dialog class, create a member variable for each edit control:
CSelectEdit m_edit1;
The in your OnInitDialog, subclass each edit control:
m_edit1.SubclassWindow( GetDlgItem( IDC_EDIT1 ) );
Well, that's one way to do it anyway.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
In List view control "report view", horizontal scroll bar should not be seen and only vertical scroll should be visible when needed.
I tried using "NO SCROLL" property option but it removes both the scroll bars but i want only horizontal scroll to be removed.
Kindly help me in solving this problem.
Guru
|
|
|
|
|
Hi All,
I'm awaiting for information on this...
Please can any one help me...
Guru
|
|
|
|
|
Hi All,
Can anyone tell me how to read the contents (words) of a text file into a vector/ list? I may be asking a very basic question but I am just a beginner. Hope you all understand.
Thanks and Regards,
Anil
|
|
|
|
|
Try something like this:
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <iterator>
#include <algorithm>
int main()
{
using namespace std;
fstream fs("C:\\Words.txt");
if (!fs)
{
cerr << "Failed to open file!" << endl;
return 1;
}
vector<string> WordList;
typedef istream_iterator<string> StringsIT;
copy(StringsIT(fs), StringsIT(), back_inserter(WordList));
copy(WordList.begin(), WordList.end(), ostream_iterator<string>(cout, "\n"));
return 0;
}
Steve
|
|
|
|
|
Thanx Steve!!![ ]
|
|
|
|
|
why would you do someone's class assignment for them?
led mike
|
|
|
|
|
If it's really an assignment the teacher will know straight away: some who can't program in C++ properly using back inserters, stream iterators and algorithms is a dead giveaway. If your assumption is incorrect then I've helped someone out.
Steve
|
|
|
|
|
:-DI have a method of event interface,for examples declaration is Fire_MyEvent(VARIANT v), I make the variable v like this:
CComSafeArray<VARIANT> arr;
arr.Add(CComVariant(buffer));
arr.Add(CComVariant(m_sScreenName.c_str()));
arr.Add(CComVariant("AIM"));
arr.Add(CComVariant(list.c_str()));
CComVariant v(arr);
Fire_MyEvent(v);
It works well in my VC program, but when I used it in a Dephi program, there is a problem.
In dephi function like this:
OnMyEvent(OleVariant v), when run , the v is null, why?
ALIC
2006-12-13
|
|
|
|
|
Has anyone see the IE "Favorites" menu, it has the amazing abillity to accept files dragged inside the menu, you can also move items arround by dragging items up and down.
I've been told that i shuld manipulate the WM_MENUDRAG message, but MSDN has documented this very poorly, it seems that the documentation / source to archieve drag & drop on menus is very hard to find if not impossible.
Any tips ideas from u guys, are welcome !
|
|
|
|
|
I'm writing a ActiveX plugin to display video, I have problem on OnDraw method, I can't refresh received images on the display zone:
//Draw method:
HRESULT OnDraw(ATL_DRAWINFO& di)
{
RECT& rc = *(RECT*)di.prcBounds;
if( ImgBuff )
{
HBITMAP HBmp = CreateBitmap(ImgBuff->width,
ImgBuff->height,
1, 32, ImgBuff->data);
DrawState(di.hdcDraw, NULL, NULL,
(long)HBmp, NULL,
0, 0,
ImgBuff->width,
ImgBuff->height,
DST_BITMAP);
DeleteObject(HBmp);
}
else
{
.......
}
return S_OK;
}
//Buffering method
//this fonction bufferise recived image in ImgBuff
FrameReady(phVideoFrameReceivedEvent_t *ev)
{
ImgBuff = ev->frame_remote;
FireViewChange();
}
Thank you to say me how to redraw a new image the display zone??
Rachid
|
|
|
|
|
Hello
my pb is:
when I create a std::map in an exe and pass it to a object's method in a DLL, I can't access to the elements of the map (it crashs after the first access).
You can try this minimal code illustrating that.
(I work under visual C++ 6, but I think it's not the reason).
the code: a main.cpp file: the "application".
dll.h and dll.cpp : the dll with the object's method:
main.cpp___________________________
#pragma warning( disable: 4786 )<br />
<br />
#include <map><br />
#include <iostream><br />
#include <string><br />
#include "dll.h"<br />
<br />
int main ()<br />
{<br />
std::map<const std::string, std::string> l_map;<br />
std::map<const std::string, std::string>::iterator it;<br />
int i;<br />
<br />
l_map["1"] = "2";<br />
l_map["3"] = "4";<br />
l_map["5"] = "6";<br />
<br />
for (it = l_map.begin(); it != l_map.end(); it++)<br />
{<br />
std::cout << (*it).first << ": " << (*it).second << "\n";<br />
}<br />
<br />
CDll obj;<br />
obj.f(l_map);<br />
<br />
std::cin >> i;<br />
return 0;<br />
}
dll.h________________________________________
#pragma warning( disable: 4786 )<br />
<br />
#include <map><br />
#include <iostream><br />
#include <string><br />
<br />
#ifdef DLL_EXPORTS<br />
#define DLL_API __declspec(dllexport)<br />
#else<br />
#define DLL_API __declspec(dllimport)<br />
#endif<br />
<br />
class DLL_API CDll<br />
{<br />
public:<br />
void f(std::map<const std::string, std::string>& p_map);<br />
};<br />
dll.cpp________________________
#include "dll.h"
<br />
void CDll::f(std::map<const std::string, std::string>& p_map)<br />
{<br />
std::map<const std::string, std::string>::iterator it;<br />
<br />
for (it = p_map.begin(); it != p_map.end(); it++)<br />
{<br />
std::cout << "DLL: " <<(*it).first << ": " << (*it).second << "\n";<br />
}<br />
}<br />
Thank you in advance for your help.
Nico
|
|
|
|
|
ledzzep wrote: You can try this minimal code illustrating that.
Its not crashing with given code. I'd tested it.
|
|
|
|