|
Two things:
1. Is that even possible? Most windows (including most type of edit boxes or other input controls) don't even accept nonprintable characters, and printable ones should always be 7 bit, unless you're using some exotic alphabet like chinese - in which case you most likely have wide characters (2 byte) anyway.
(Honest question - I do not know the answer)
2. Check the characters for high order bit like this:
bool is7bit(const std::string& input) {
bool result(true);
for (std::string::const_iterator it = input.begin(); it != input.end() && result; ++it)
if (0x80 & *it)
result = false;
return result;
}
Note: obviously won't work if translated for multibyte characters since then std::string will contain wide chars as well!
|
|
|
|
|
You are really an ignorant one - isn't it ???
Ever heard of languages like france, spanish, german ???
They all have umlauts (german are ÄäÖöÜüß) and all of them have Bit8 set ...
Grrrr..
|
|
|
|
|
I'm sorry, I didn't recall what localized characters are mapped to. Probably because I never care about ASCII encoding when I write a letter in german. And when I care about encoding, it's somehow always english text - if it is language related at all...
|
|
|
|
|
Hmm - I'm a litte confused. Because of your name I assumed you're from Germany, and if you are a programmer you should know your primary language encoding (sorting algorhitms and such stuff
|
|
|
|
|
1. So am I.
2. Yes I am
3. see 1
|
|
|
|
|
I have an menu : &Refresh , separator , &Modify and Suspen&d
In some cases , I want to append an menu dynamically :
and I try this :
pContextMenu->AppendMenu(MF_SEPARATOR,NULL,"-");
pContextMenu->AppendMenu(MF_POPUP,NULL,"&Export");
and does function , but not in the way that I want , I mean , at 'Export' item , I want to append other popup items , etc.
Ok, further , I don't know how to map handlers on this dynamically menu items ?
Thank you .
|
|
|
|
|
Here is image of what I want to do :
Existing item
Existing item
Existing item
create separtor
Create popup item
-----------------Create new item
-----------------Create new item
Create new item
Create new item
and , after that , where I should put code on the new create menu items ?
|
|
|
|
|
Means you want to add pop up menu to "Export" menu.
Then create a sub menu like,
CMenu SubMenu;
SubMenu.CreatePopupMenu();
SubMenu.AppendMenu(MF_STRING, IDM_EXPORT_PDF, _T("To Pdf");
SubMenu.AppendMenu(MF_STRING, IDM_EXPORT_WORD, _T("To Word");
Then Create Export Menu as,
pContextMenu->AppendMenu(MF_POPUP, SubMenu.m_hMenu,"Export");
|
|
|
|
|
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
|
|
|
|
|