|
Hi,
I am getting active view (say AV1) attached with main window (MainFrame) using GetActiveView, some other views are member of Av1 view.
If I use GetActiveView() just after initialzation of winow I am getting correct view.
But If I click of some another view then I am not getting Av1 view.
How to get same view at both instance?
|
|
|
|
|
john5632 wrote: But If I click of some another view then I am not getting Av1 view
That is correct, GetActiveView() returns "A pointer to the current CView . If there is no current view, returns NULL .", as described here[^].
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I have drived a class from CStatic control. I am using my own method to set text CMyStatic::SetText().
I am drawing text using
dc.DrawText(strText,&rectWnd,DT_VCENTER| DT_RIGHT | DT_WORDBREAK);
in paint method but If I want to set another string It is getting overlapped. So I am not able to see the extact string.
How to solve this refreshing problem?
|
|
|
|
|
From where do you get the strText? The problem might be because the underlying CStatic controls window text is set (and drawn). In your SetText(), you might have to clear this by calling SetWindowText(_T("")).
Depending on what you mean by overlapping, another reason could be that your rectangle isn't large enough to fit the text, in which case you can use the flag DT_CALCRECT to get the size needed.
|
|
|
|
|
I am passing text from outside using SetText function.
This static control is drawn over a custome dialog which is having some color, If I use SetWindowText(_T()) I am getting window native color.
Overlapping means , One test is drawn on anothet text.
I am giving enough size to draw.
|
|
|
|
|
|
Are you erasing the background properly when your control is refreshed?
|
|
|
|
|
|
I am trying to decalare a CArray in side a CMap
CMap<CString,LPCSTR,CArray,&CArray> m_abc
But I get error C2955: 'CArray' : use of class template requires template argument list
Can you please help me!
Thanks
|
|
|
|
|
Try something like this:
CMap<CString,LPCTSTR,CArray<int,int>,&CArray<int,int>> m_abc
Please note:
the collections (nested - especially) can be faster and lower priced,
when they use the pointers inside, not the instances...
virtual void BeHappy() = 0;
|
|
|
|
|
I tried
CMap<CString,LPCTSTR,*CArray<CString,LPCTSTR>,&CArray<CString,LPCTSTR>> m_abc;
I get error C2275: 'CArray<TYPE,ARG_TYPE>' : illegal use of this type as an expression
|
|
|
|
|
And now ? :
CMap<CString,LPCTSTR,CArray<CString,LPCTSTR>*,CArray<CString,LPCTSTR>*> m_abc;
CMap<CString,LPCTSTR,CStringArray*,CStringArray*> m_abcd;
virtual void BeHappy() = 0;
|
|
|
|
|
why don't you simple put the CArray inside another class ? Me think it will make thing easier in the long run.
Watched code never compiles.
|
|
|
|
|
You can't write:
CArray myArray;
and expect it to compile without without telling it what you want to put in your array. You have to write something like:
CArray<int> myIntArray;
So the question is what type of data are you trying to store in your nested CArrays? Once you know that you can explicitly specify the type of your data in CMap. When you've done that you'll probably run into trouble because CArray hasn't got a copy constructor and I think the types supplied as arguments to CMap need to be copy constructable.
As a complete aside, how about binning this last century MFC collection class rubbish and use the standard library classes std::map and std::vector? They can do what you want with much less farting around than MFC.
Cheers,
Ash
PS: Thanks for Paul below pointing out the faux pas in the original post!
modified on Saturday, September 25, 2010 7:05 AM
|
|
|
|
|
Ash, I'm sure you meant:
CArray<int> myIntArray ...Though this syntax might be an interesting proposal for the 'central comitee' Otherwise I completely agree with the preferable usage of the std elements. My experience shows that an investment into refactoring code which uses custom (own or other non-standard) containers pays off really quickly...
|
|
|
|
|
Thanks for spotting the error, I should never write code without pairing these days!
Cheers,
Ash
|
|
|
|
|
Hi guys, I am writing project for bank operation in MFC, before running my application i have to check the username and password. But i have some problem in my code, my main frame window is closed after enter username and password.Any one tell me the reason.....
class CLoginDialog : public CDialog
{
};
CBankFrameWnd : public CFrameWnd
{
};
class CBankApp : public CWinApp
{
public:
CBankApp();
~CBankApp();
BOOL InitInstance();
};
CBankApp::CBankApp
{
}
CBankApp::~CBankApp()
{
}
BOOL CBankApp::InitInstance()
{
CLoginDialog *pDlg = new CLoginDialog();
m_pMainWnd = pDlg;
if(pDlg->DoModal() == IDOK)
{
if Valid User then assign frame window in m_pMainwnd and return TRUE ...
CBankFrameWnd *pWnd = new CBankFrameWnd();
m_pMainWnd = pWnd;
pWnd -> ShowWindow(m_nCmdShow);
pWnd -> UpdateWindow();
return TRUE;
}
else
return FALSE;
}
Thanks in Advance
|
|
|
|
|
Maybe the constructor of the window does not create it ?
virtual void BeHappy() = 0;
modified on Friday, September 24, 2010 2:19 AM
|
|
|
|
|
Hi all,
i m increase the row height of ListCtrl with using of this code.
1.Change the style of list control to "owner draw fixed" style!
2. m_RowList.ModifyStyle( LVS_OWNERDRAWFIXED, 0, 0 );
3.
void CDialogGuineaPig::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
if( nIDCtl == IDC_ROWLIST )
{
lpMeasureItemStruct->itemHeight += 10;
}
}
this is working fine but when i use CheckBox style in List ctrl its not working please tell me how can i increase List Row height with Checkbox.
please tell me how can i do this.
thanks in advance.
|
|
|
|
|
Hi All,
I want to know an API which can convert time in certain time zone to GMT/UTC.
Not the API which will use local system time zone to convert to GMT.
My input time may be in EST, CST, etc...
And I know the time zone of the time object I have, so I need an API which can convert this time to GMT.
I came across below API but I'm not sure about how to use it, mainly the first paramater.
SystemTimeToTzSpecificLocalTime
Thanks
Do your Duty and Don't expect the Result
|
|
|
|
|
You probably want this[^] and this[^]. If you need more, choose from the list here[^].
And read the documentation page on the functions you decide to use!
|
|
|
|
|
Hi,
I have a manifest with "asInvoker" privileges, the application will then run under a non-privileged token and no UAC dialog pops up at start. But there is one functionality where the application needs higher privileges later, right now this API call fails with ERROR_ACCESS_DENIED . I would like to change the application so that only for this functionality the UAC dialog pops up.... elevate process privileges for a short time.
Apparently you have to create a new process, then perform administrative tasks and return to your first process (MSDN, Stackoverflow). I am new to UAC, there isn't any simpler way?
Cheers
|
|
|
|
|
Moak wrote: I am new to UAC, there isn't any simpler way?
AFAIK, no; not unless you want to run the entire app with admin privileges.
L u n a t i c F r i n g e
|
|
|
|
|
Thanks everyone for their feedback!
|
|
|
|
|
The execution privilege is associated with a process token.
This is the reason why the manifest property is ignored if given to a DLL.
So you will either need to run the first process entirely with admin privileges or use a second program like you said.
|
|
|
|