|
I have a MDI project, how can I disable button close of view ?
Thanks in advance
|
|
|
|
|
Try this: GetSystemMenu(FALSE)->EnableMenuItem(SC_CLOSE, FALSE)
|
|
|
|
|
Could you tell me why I receive these errors ?
MyAppView.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CMyAppView::OnInitialUpdate(void)" (?OnInitialUpdate@CMyAppView@@UAEXXZ)
Debug/MyApp.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
MyApp.exe - 2 error(s), 0 warning(s)
Thanks in advance
|
|
|
|
|
|
Yes, I have deleted the body but I haven't deleted the header
Thanks in advance
|
|
|
|
|
Looks like you deleted your OnInitialUpdate function in the view class (CMyAppView), but didn't delete the declaration from the header file.
|
|
|
|
|
You're right
Thanks in advance
|
|
|
|
|
hi
can i get the DPI values in the code directly like 72 DPI or 96,120,144,192
DPI.
I need these values urgently in the project i am working on.
plz i f any one knows plz reply.
regards
Chethan
|
|
|
|
|
Are you using GDI+ ? You're trying to get the DPI settings for an image, or from a printer ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi
actually in the project the control panel we designed will be ruined if the DPI settings are changed in XP .the controls will be displaced .so i need the those value to set it back to the correct position
|
|
|
|
|
OK, in that case, I have no idea
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
any one who know plz reply
|
|
|
|
|
|
How about GetDeviceCaps with LOGPIXELSX and LOGPIXELSY ?
|
|
|
|
|
hi
can u give the code on how to do it
Chethan
|
|
|
|
|
How can I add more two projects to my current project, and make default project to run ?
Thanks in advance
|
|
|
|
|
Right click and choose add project. Right click on the project you want to run and choose 'make this the default project'.
Something like that. More specific instructions would require knowledge of the version of the IDE you are using.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hcmuns wrote:
two projects to my current project
I don't think you can do that, you can however add more projects to your solution / workspace the way Christian explained.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I encountered the problem when I was use the CToolBar Class.
Code as followed:
//add three static ,three EDIT,a button
CRect rectSlogo,rectSaddr,rectEaddr,rectSname,rectEname,rectSpass,rectEpass,rectBlogin;
//set index
//m_wndToolBar.SetButtonInfo(0,IDC_STATIC_LOGO,TBBS_SEPARATOR,32);
m_wndToolBar.SetButtonInfo(1,IDC_STATIC_ADDR,TBBS_SEPARATOR,60);
m_wndToolBar.SetButtonInfo(2,IDC_EDIT_ADDR,TBBS_SEPARATOR,200);
m_wndToolBar.SetButtonInfo(4,IDC_STATIC_NAME,TBBS_SEPARATOR,60);
m_wndToolBar.SetButtonInfo(5,IDC_EDIT_NAME,TBBS_SEPARATOR,70);
m_wndToolBar.SetButtonInfo(7,IDC_STATIC_PASS,TBBS_SEPARATOR,60);
m_wndToolBar.SetButtonInfo(8,IDC_EDIT_PASS,TBBS_SEPARATOR,70);
m_wndToolBar.SetButtonInfo(10,ID_BUTTON_LOGIN,TBBS_SEPARATOR,40);
//m_wndToolBar.GetItemRect(0,&rectSlogo);
m_wndToolBar.GetItemRect(1,&rectSaddr);
m_wndToolBar.GetItemRect(2,&rectEaddr);
m_wndToolBar.GetItemRect(4,&rectSname);
m_wndToolBar.GetItemRect(5,&rectEname);
m_wndToolBar.GetItemRect(7,&rectSpass);
m_wndToolBar.GetItemRect(8,&rectEpass);
m_wndToolBar.GetItemRect(10,&rectBlogin);
//set the rect
//rectSlogo.top+=2;
//rectSlogo.bottom+=6;
rectSaddr.top+=2;
rectSaddr.bottom+=6;
rectSname.top+=2;
rectSname.bottom+=6;
rectSpass.top+=2;
rectSpass.bottom+=6;
/*CString str;
char buf[MAX_PATH];
GetCurrentDirectory(260,buf);
str = (CString)buf;
if(!m_staticlogo.Create("logo",WS_CHILD | WS_VISIBLE | SS_BITMAP|SS_CENTERIMAGE,rectSlogo,&m_wndToolBar,IDC_STATIC_LOGO))
{
TRACE0("Create STATIC_LOGO fail!\n");
return false;
}
m_staticlogo.SetBitmap(::LoadBitmap(NULL,str+"\\res\\firefox2.bmp"));
m_staticlogo.ShowWindow(SW_SHOW);*/
if(!m_staticaddr.Create("地址:",WS_CHILD | WS_VISIBLE,rectSaddr,&m_wndToolBar,IDC_STATIC_ADDR))
{
TRACE0("Create STATIC_ADDR fail!\n");
return false;
}
m_staticaddr.ShowWindow(SW_SHOW);
if(!m_editaddr.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL ,rectEaddr,&m_wndToolBar,IDC_EDIT_ADDR))
{
TRACE0("Create EDIT_ADDR fail!\n");
return false;
}
m_editaddr.ShowWindow(SW_SHOW);
if(!m_staticname.Create("用户名:",WS_CHILD | WS_VISIBLE,rectSname,&m_wndToolBar,IDC_STATIC_NAME))
{
TRACE0("Create STATIC_NAME fail!\n");
return false;
}
m_staticname.ShowWindow(SW_SHOW);
if(!m_editname.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL ,rectEname,&m_wndToolBar,IDC_EDIT_NAME))
{
TRACE0("Create EDIT_NAME fail!\n");
return false;
}
m_editname.ShowWindow(SW_SHOW);
if(!m_staticpass.Create("密 码:",WS_CHILD | WS_VISIBLE,rectSpass,&m_wndToolBar,IDC_STATIC_PASS))
{
TRACE0("Create STATIC_PASS fail!\n");
return false;
}
m_staticpass.ShowWindow(SW_SHOW);
if(!m_editpass.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL ,rectEpass,&m_wndToolBar,IDC_EDIT_PASS))
{
TRACE0("Create EDIT_PASS fail!\n");
return false;
}
m_editpass.ShowWindow(SW_SHOW);
if(!m_buttonlogin.Create("登录",WS_CHILD | WS_VISIBLE | BS_CENTER | BS_USERBUTTON ,rectBlogin,&m_wndToolBar,ID_BUTTON_LOGIN))
{
TRACE0("Create BUTTON_LOGIN fail!\n");
return false;
}
m_buttonlogin.ShowWindow(SW_SHOW);
paste the code in OnCreate Function of MainFrm.cpp of a MFC SDI programme.then discard the // in the code above,the ToolBar disappear,
I wonder Why this happened,Please help me!
|
|
|
|
|
I have to be doing something wrong as this is too simple. I have a doc/view project with a LOT of menu items. EnableMenu() isn't working as I want it to. However, I can call the CheckMenuItem member and it works fine in the same SPOT!
This code takes a emumerated list of ALL menu items and checks each menu item. It works perfectly:
<br />
CMenu* pMenu = GetMenu();<br />
<br />
for(int i = 0; mymenuids[i] != ID_SEPARATOR; i++)<br />
pMenu->CheckMenuItem(mymenuids[i], MF_CHECKED);<br />
Now, if I change this to gray all the entries, NONE of them gray\disable:
<br />
CMenu* pMenu = GetMenu();<br />
<br />
for(int i = 0; mymenuids[i] != ID_SEPARATOR; i++)<br />
pMenu->EnableMenuItem(mymenuids[i], MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);<br />
What could possibly be wrong? Possible that a resource file has corrupted? I'm baffled!
Thanks in advance,
Philip
|
|
|
|
|
Each menu item has two events - one when you click it, and the other is called just before a menu item is displayed. This is where you need to set properties like enabled and checked.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ah, good stuff. That worked! Although, I'm not sure why you can't call the enableitems properly outside of the message handler. Oh well.
Thanks for your help
|
|
|
|
|
PhilipGa wrote:
I'm not sure why you can't call the enableitems properly outside of the message handler.
Because the handler resets them, I guess.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello. Looking for some help on using CPropTree from:
http://www.codeproject.com/treectrl/proptree.asp
I'm trying to use CPropTree in my project, as shown in the dlgsample, but I'm not actually sure how to set up the project to use it. Specifically, I'm trying to use do it like the example program that has :
#include <proptree.h> in stdafx.h, but it says it cannot find it. What changes to the project settings do I need to get this to work?
Any thoughts or help would be appreciated.
Thanks.
|
|
|
|
|
Hi,
This question is related to win32 user interface programming.
I need to use Single threaded runtime library and cannot use MFC. Thus I am using win32.
I have designed a dialog that should take three float values as input. How do write the code to do data exchange so that values entered by the user are available to me in some local variable after the user has clicked "OK" on the dialog after entering some values. I can do this in MFC and but do not know how to do this using win32. I could create file open dialog using GetOpenFileName but did not find any similar function for writing data exchange code.
Any help would be great as I am stuck and want to get this done asap.
Thanks in advance for your help.
Regards,
Abhijit
|
|
|
|
|