|
I am making a popup menu resource in my MFC project.
I can call it in OnRButtonDown event with code below :
CMenu menuPop;
menuPop.LoadMenu(IDR_MENU_MAIN);
POINT ptMouse;
GetCursorPos(&ptMouse);
menuPop.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, ptMouse.x,ptMouse.y,this);
All i want to do is to change check of items. Its first menu items is checked by default.
I tried code below to make first menu item unchecked but it didnt work :
CMenu menuPop;
menuPop.LoadMenu(IDR_MENU_MAIN);
menuPop.CheckMenuItem(0,MF_BYPOSITION | MF_UNCHECKED);
How can i set check states of menu items in my popup style -context menu ?
|
|
|
|
|
MF_CHECKED!!!
Didnt you find in the fine MSDN?
Greetings from Germany
|
|
|
|
|
I dont think that you understand , read it again , you will MF_UNCHECKED flag instead of it , however it doesnt matter i cannot set checks !
|
|
|
|
|
I didnt get that point.
Here we go again:
CMenu *pPopup = menuPop.GetSubMenu(0);//this one gets to show
pPopup->CheckMenuItem(0,MF_BYPOSITION | MF_UNCHECKED);//uncheck that one
//after that going to the user
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, ptMouse.x,ptMouse.y,this);
Greetings from Germany
|
|
|
|
|
Thank you very much for your reply but your solution sets its checked or unchecked for once , and it changes position of popup menu and re-show it.
|
|
|
|
|
Thats I hardly believe.
First change the menu THAN show it.
I also prefer to work with the MF_COMMAND flags because it is better readable.
Greetings from Germany
|
|
|
|
|
Unfortunately MSDN says that we cant use MF_BYCOMMAND with popup menus , otherwise it would be very good in the name good code with working defines of resource IDs. (So i am making my own defines)
I think i will handle it
Thank you very much for your help effort...
|
|
|
|
|
Hello,
I have used InitModalIndirect() for dialog box creation which is created successfully because the function returns 1 after debug but the dialog box is not visible even if I use CDialog::DOMOdal() functin after InitMOdalIndiect().
How do I make the dialog box visible?
Prithaa
|
|
|
|
|
|
Hello,
Thanks for your reply.You have been helpful always.
I have been to the above link before asking you the question and went through CDialogTemplate class but I don't think it will be of any use to me.
I do not have a dialog resource.
MyDialog is class derived from CDialog.
This is my code.
MyDialog dlg;
DLGTEMPLATE *d = new DLGTEMPLATE;
d->x = 10;//(short)m_Rect.left;
d->y = 10;//(short)m_Rect.top;
d->cx = 200;//(short)m_Rect.Width();
d->cy = 200;//(short)m_Rect.Height();
d->style = WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_SETFONT;
d->cdit = 0;
int iRet = dlg.InitModalIndirect(d);
dlg.DoModal();
In the above code iRet = 1 when debugged but the dialog box is not seen.
Thanks
Prithaa
|
|
|
|
|
I think if you look at the documentation for the DLGTEMPLATE Structure[^], you'll see
you're missing other items following the structure.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi...
i am doin file drag and drop opertion. while dropping a file i need to display the paticular file image also in richtext box.
For example: i am dropping a word document file means,then i need to display the word doc file icon in richtext box).
is any one know how to do...or any regerence links....
ple reply me...
thanks
|
|
|
|
|
You might want to lookup SHGetFileInfo . Here's a snippet that fetches the icon associated with a file and renders it onto a DC.
SHFILEINFO fileInfo = { 0 };
DWORD dwStatus = SHGetFileInfo( _T( "bing.pdf" ), 0,
&fileInfo, sizeof( SHFILEINFO ),
SHGFI_ICON | SHGFI_LARGEICON );
dc.DrawIcon( 10, 10, fileInfo.hIcon );
|
|
|
|
|
Dear all
what is difference between DLL and Static library. thanks. and how to make it and to use it?
thanks
Li Zhiyuan
29/06/2007
|
|
|
|
|
A DLL is a piece of code that resides in a separate file that your application typically loads (implicitly or explicitly) and executes at runtime. A static library is a piece of code that you link to when you build your application, which means that all the code that you are referring to in the static library gets copied into your executable.
How to create and use them? You really should get a book or something! A little googling might help as well.
|
|
|
|
|
See here[^] does helpful?
|
|
|
|
|
Dear all
when i built my simulation, output showed below:
atal error RC1015: cannot open include file 'res\DSplit.rc2'.
Error executing rc.exe.
when i went to ResourceView,clicked Resource file, but computer showed: load failed.
what happened?
thanks a lot
Li Zhiyuan
29/06/2007
|
|
|
|
|
Check if the resource file still exists in your projects working directory ...
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi all,
I m trying to make an activex control and i hav added some custom properties to it and made the Get/Set functions thru the wizard bar.
i made the control sucessfully.
But .....
The problem begins when i insert the control to another project
it makes 2 file one is "control.h" and other is "control.cpp"
which contains the declration and code of the activex component.
in place of custom property decralation in .h the IDE says that type of functions i.e get and set are in valid
It rather writes :-
"property 'ShowFrame' not emitted because of invalid type"
how can i resolve it pls help me out
thank you
Regards,
Pankaj Sachdeva
|
|
|
|
|
sending a string as keyboard keystrokes wrongly
as u can see from my following code, KeyBoadText() is a function that accepts a string and then type the string out as if it was typed using the keyboard. but now i am having problem when my typetext = "abc"
instead of typing "abc", it types "123". how can i solve this?
[CODE]
void CStocksmsDlg::KeyBoardText(CString typetext)<br />
{<br />
<br />
int text_len = typetext.GetLength();<br />
<br />
<br />
for(int i =0; i<text_len; i++)<br />
{<br />
INPUT Input[2];<br />
KEYBDINPUT ki;<br />
<br />
ki.dwFlags = KEYEVENTF_EXTENDEDKEY | 0;<br />
ki.time = 0;<br />
ki.wScan = 0;<br />
ki.wVk = typetext.GetAt(i);<br />
Input[0].type = INPUT_KEYBOARD;<br />
Input[0].ki = ki;<br />
ki.dwFlags = KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP;<br />
ki.dwFlags = KEYEVENTF_KEYUP;<br />
Input[1].type = INPUT_KEYBOARD;<br />
Input[1].ki = ki;<br />
SendInput( 2, Input, sizeof(INPUT) );<br />
}<br />
<br />
} [/CODE]
|
|
|
|
|
u r sending keys "abc" of ascii 97,98,99 which stands for VK_NUMPAD1,VK_NUMPAD2,..
If u want print 'abc' then turn off capslock and send "ABC"
see "winuser.h"
|
|
|
|
|
I have some requriement to convert the text form one language from to ohter.Say I have the some text in the .txt file(Englis), i need to convert the text into other language(Korean).Plz suggest me is there any way to do this.
With regards,
Kishore V
kishore
|
|
|
|
|
How is this a Visual C++ / MFC question?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
you cant simply change the system language and hope your file to be changed to tht language, ya but there are ways,
|
|
|
|
|
Google language tools here[^] can do a rough translation.
|
|
|
|