|
Depending on the scope of pContextMenu , you might have to detach the underlying HMENU from SubMenu to avoid having it destroyed by the destructor of CMenu .
pContextMenu->AppendMenu(MF_POPUP, SubMenu.Detach(), "Export");
|
|
|
|
|
So , can I write code on IDM_EXPORT_PDF handler , if I want ?
|
|
|
|
|
I think I know ... I map IDM_EXPORT_PDF in message map ... I will try .
|
|
|
|
|
But if I want to append 2 menus , one of that have an popup menu ?
I try in this way , without succes :
CMenu menu,menuInEx;
menu.LoadMenu(IDR_MENU_RCLICK1);
menuInEx.LoadMenu(IDR_MENU_RCLICK_INEX);
CMenu* pContextMenu = menu.GetSubMenu(0);
POINT point;
point.x = pt.x;
point.y = pt.y;
::ClientToScreen(pNMHDR->hwndFrom,&point);
pContextMenu->AppendMenu(MF_SEPARATOR,NULL,_T("-"));
pContextMenu->AppendMenu(MF_POPUP,reinterpret_cast<UINT_PTR>(menuInEx.m_hMenu),_T("--"));
|
|
|
|
|
Flaviu 2 wrote: I try in this way , without succes :
Does any pop menu displayed.If then Where is the problem.Does IDR_MENU_RCLICK1, IDR_MENU_RCLICK_INEX are valid resources?
|
|
|
|
|
The fact is , if I have an valid IDR_MENU_RCLICK1 and IDR_MENU_RCLICK_INEX resources , how can I append both ?
|
|
|
|
|
I think that what I want it's a stupid thing !?
|
|
|
|
|
To Merge two menus use the following code,
Merging Two Menus[^]
And You can do merging Like this,
CMenu menu,menuInEx;
menu.LoadMenu(IDR_MENU_RCLICK1);
menuInEx.LoadMenu(IDR_MENU_RCLICK2);
ClientToScreen(&point);
CMenu* pContextMenu = menu.GetSubMenu(0);
MergeMenu(pContextMenu, &menuInEx, false);
pContextMenu->TrackPopupMenu(TPM_RIGHTALIGN, point.x, point.y, this);
CWnd::OnRButtonUp(nFlags, point);
|
|
|
|
|
May be it's easier for us to answer your question if you show us the wanted menu structure ...
|
|
|
|
|
Here is the structure of what I want :
Existing item
Existing item
Existing item
Existing item
New popup item
--------------New item
--------------New item
New item
New item
in part I insert new menu , but with all ( with initial number of new menu , you know ... )
|
|
|
|
|
Then create the submenu (new popup menu) first, and insert it as menu item in the parent popup menu with style MF_POPUP
|
|
|
|
|
I want to get some gdi elements color infomation.
when I used TextOut function to draw the strings in the device context.but I doesn't want to output the strings in a really device context in the program's window. so I found this way :
#include <windows.h>
#pragma comment(lib,"user32.lib")
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pszCmdLine, int cmdShow)
{
HDC hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
HDC hdcCompatible = CreateCompatibleDC(hdcScreen);
CString m_strText = _T("Hello");
SIZE m_sz;
if(hdcCompatible == NULL)
{
MessageBox(NULL,_T("CreateCompatibleDC Failed !"),NULL,NULL);
return -1;
}
SetBkColor(hdcCompatible,RGB(255,255,255));
SetTextColor(hdcCompatible,RGB(0,0,0));
TextOut(hdcCompatible,0,0,m_strText,m_strText.GetLength());
GetTextExtentPoint32(hdcCompatible,m_strText,m_strText.GetLength(),&m_sz);
for(int i=0; i<m_sz.cx; i++)
{
for(int j=0; j<m_sz.cy; j++)
{
COLORREF color = GetPixel(hdcCompatible,i,j);
if(color == RGB(255,255,255)
{
}
else
{
}
}
}
}
the m_sz value is normal ( 8 * 16),but the color variables is invalied, because is usually is the backcolor.
( I doesn't want to draw it in the program windows and then call GetPixel function from screen,that's not so good ! )
why is it ,or is there any other way ?
Thans for your reply !
Best regards !
|
|
|
|
|
Not sure (been a while since I used GDI), but maybe you should create a compatible bitmap and select it into the device context before drawing to it?
|
|
|
|
|
I have a simple (I hope) question.
I have a disk full of jpg images and just want to pull the jpeg attributes from the file, resolution, etc.
The current program, in C++/MFC, looks for duplicate files, and I want to add a pop-up with jpeg info.
I looked at the ImageFormat class and also jpegLib, but they seem more concerned with manipulating the image data itself, rather than the attributes.
If anyone can suggest a starting point that would be great.
Also, if anyone knows of anything to pull the EXIF properties from the file, that would be just excellent.
Thanks in advance,
Bryan.
|
|
|
|
|
i think GDI+ will let you get all that stuff.
our libs will do it, too...
|
|
|
|
|
this[^] is what gets used to obtain a specific image property (e.g. JPEG EXIF field) when using .NET; and I expect it is based directly on similar capabilities inside GDI+. The mapping between items and item numbers I once found using Google...
HTH
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hey, thanks for that Guys,
that really gave me the start that I needed, got it half coded already....
Thanks Again,
Bryan
|
|
|
|
|
Hi,
I've a bitmap file binary data in variable (File contents read from a .bmp file). How can i convert it to an HBITMAP?
I know One way is to save the contents in to a file and use LoadImage() method. Is there any other way to do the same in memory ?
Thanks & Regards
|
|
|
|
|
|
Hey,
Check out this MSDN arcticle on creating a bitmap in memory (inside a device context).
Capturing an Image[^]
Hope that gets you started.
Best Regards,
MicroVirus
|
|
|
|
|
Hi
I have created an interface in interface.h file as below
class Manager ;
class IManager
{
public :
virtual void __stdcall fun(Manager* ptr)=0 ;
};
Manager class is declared in another sourceFile.h
#include "interface.h"
class Manager
{
public :
Manager () ;
~Manager () ;
IManager* GetMyManager () ;
IManager* _VarManager ;
};
I have provided forward declaration of class Manager in interface.h .When I try to compile my project it fails with an error "Ambigious Class Manager"
|
|
|
|
|
For starters, verify you have include guards in your header files.
#ifndef _MANAGER_H_INCLUDED
#define _MANAGER_H_INCLUDED
#endif
or
#pragma once
Also check that you don't include another header, that in turn includes a file defining a Manager class.
|
|
|
|
|
Posted should compile. You should post also the relevant source(s) file.
As already suggested you should also guard your header aggainst multiple inclusion.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
pandit84 wrote: "Ambigious Class Manager"
Could you quote the precise text of that message please? The error number might help, too.
My first guess is that the error is not related to your definition of Manager and IManager at all. More likely, either you have a clash of namespaces (e. g. you might have multiple classes called Manager in different namespaces; maybe even a forward declaration outside the correct namespace could cause it), or you derived classes from Manager using multiple inheritance. The latter can be a problem if you inherit Manager via multiple paths, causing inheritance ambiguity.
See here (under "Pointer conversions") for an example of the inheritance ambiguity.
|
|
|
|
|
Thanks a lot for your reply. Solved , it was a namespace clash. Thanks stefen
|
|
|
|
|