|
Hi !
I'm working on a Visual Studio .NET addin written in C++. At the momment, the addin creates a new solution, adds a blank project to this solution, and adds folders to this project.
The problem is that when I try to add some files in one of the project folders, they are always added at the root of the project, and not in the specified folder.
Does anyone had the same problem ?
Is there a way to bypass it ?
Thanks a lot,
Jean-Paul
|
|
|
|
|
|
Thanks for your help, I can see that this forum is really useless...
|
|
|
|
|
I have :
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cy = ::GetSystemMetrics(SM_CYSCREEN) / 3; //600;//
cs.cx =::GetSystemMetrics(SM_CXSCREEN) / 3; // 800;//
This worked fine, till I changed the following (I wanted the CFormView to fit my dialog resource:
void CTrain1View::OnInitialUpdate()
{
//CFormView::OnInitialUpdate();
// ResizeParentToFit();
CFormView::OnInitialUpdate();
if( TRUE )
{
// 2 - Resize parent frame to fit our Form View
GetParentFrame()->RecalcLayout();
ResizeParentToFit( FALSE );
ResizeParentToFit( TRUE );
}
Now the app comes up full screen!!!
I need to have the form fitting behavior but also want to control the size of my app through PreCReate. Please help!
|
|
|
|
|
I have SwitchView routine presently written as a member of the CMAInFrame class. I need to access this function from a view class. I cannot figure out how to call this function from CMYView:
I tried AfxGetWnd()->SwitchView but thats not right.
If theres no way to get to the function (I dont believe that!), then I'd like to modify it so that it becomes a member of the view class. This step woud really be very instructive for me, since I'm new and just now getting a feel for all these classes in the doc/view architecture.
Here is the function:
BOOL CMainFrame::SwitchView(CMultiDocTemplate *pTemplate, CRuntimeClass *pViewClass)
{
CMDIChildWnd* pChild = (CMDIChildWnd*) MDIGetActive();
if ( pChild == NULL ) return FALSE;
CDocument* pDoc = pChild->GetActiveDocument();
if ( pDoc == NULL ) return FALSE;
CView* pView;
POSITION pos;
pos = pDoc->GetFirstViewPosition();
while( pos != NULL )
{
pView = pDoc->GetNextView( pos );
if( pView->IsKindOf( pViewClass ) )
{
pView->GetParentFrame()->ActivateFrame();
return TRUE;
}
}
pChild = (CMDIChildWnd*) pTemplate->CreateNewFrame(pDoc, NULL ); //error here ERROR: Dialog with IDD 0x0082 must have the child style.
if( pChild == NULL ) return FALSE;
pChild->MDIActivate();
pTemplate->InitialUpdateFrame( pChild, pDoc);
return TRUE;
}
|
|
|
|
|
((CMainFrame*)AfxGetMainWnd())->SwitchView(...);
|
|
|
|
|
Thanks very much. Works like a charm!
|
|
|
|
|
Is somebody can help me and tell me how to modify caption in a property page.
|
|
|
|
|
|
|
You are welcome, I hope you have seen my lovely article about property sheet with status bar, toolbar, menu and tool tips
|
|
|
|
|
Hi...
How to create a consol window like the output window of VC++ 6.0 ???
For the moment I use a view derived from CEditView :
class CMyView : public CEditView {...}
And for insert text (read-only), I use this method that I've created in the view:
void CMyView::DisplayText(CString text) const
{
CEdit& theEdit = GetEditCtrl();
theEdit.SetSel(-2, -1);
theEdit.ReplaceSel(text);
}
Moreover, this method is only call from CMyDocument like this:
void CMyDoc::OnMyProgram()
{
CMyView* pView = (CMyView*)m_viewList.GetHead();
pView->DisplayText("\r\nMy Programming\r\n");
}
My question: Is that clean ???
In fact, I want that the scrollbar move with text insert...
Thanks in advance...
Hello World!!!
from Raphaël
|
|
|
|
|
To scroll down listbox programmatically, I use such code:
m_list_box.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
Try this with CEditView or it's underlying Edit Control.
|
|
|
|
|
OK thanks...
But now, how to add text in the end of the CEdit control ???
Thus, NOT replace...
curently I set the carret on the ending position with this code:
theEdit.SetSel(-2, -1);
And then I replace the ending position with text, like this:
theEdit.ReplaceSel(text);
I find that not very clean...
An Add(CString str) method must exist !!!
thanks
Hello World!!!
from Raphaël
|
|
|
|
|
Hi i have mapped a timer to my Dialog.Can anyone tell me where i have to put my code in that timer function.I mean which of the following i have to follow?.
void CCleanUpDlg::OnTimer(UINT nIDEvent)
{
CDialog::OnTimer(nIDEvent);
///My code
//
//
}
or
void CCleanUpDlg::OnTimer(UINT nIDEvent)
{
///My code
//
//
//
CDialog::OnTimer(nIDEvent);
}
With regards
|
|
|
|
|
|
Hello...
You can destroy this line... I think...
Classicaly, I use this model:
void CCleanUpDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent) {
case 1:
...
break;
case 2:
...
break;
...
}
}
nIDEvent is the number of the timer which is activated...
Hello World!!!
from Raphaël
|
|
|
|
|
You don't really need to call base class for your timer if you don't want to:
void CCleanUpDlg::OnTimer(UINT nIDEvent)
{
if (nIDEvent == YOUR_TIMER_ID)
{
}
else
CDialog::OnTimer(nIDEvent);
}
Last Article:
Adding VBScript/JScript to C++ App
Jesus Christ is LOVE! Please tell somebody. P. Selormey and I think the same!
|
|
|
|
|
Hi, I have a Composite Control with a ListControl. I wrote my own CListCtrl derived list control which does automatic column sizing and sorting. Now I want to do some custom drawing but I cannot seem to catch the NM_CUSTOMDRAW message.
I tried catching the message by putting ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw) in the message map, but this does seem to do the trick. I also tried to catch the message in OnNotify but here I can only catch the NM_CUSTOMDRAW from the header.
In the Composite Control class I created a member object of my own list control class (m_list) and in OnInitDialog I attached the list control that I drew in my resource by using m_list.SubclassWindow(GetDlgItem(IDC_LIST1)).
What am I doing wrong here ?
|
|
|
|
|
hi all,
i want to any initialization need to do for CSocket?
in the a demo with SDI structure, i can do all the initial methods (create, connect). but, in my program with dialog structure, i can't do such methods.
i want to know any special stuffs need to do b4?
here is the code, i just direct copy from SDI(demo) to dialog(my code) but failed to work...
CSocket client;
if (!client.Create())
{AfxMessageBox("failed create");}
if (!client.Connect("localhost", 4444))
{AfxMessageBox("failed connect");}
it return "failed create" in my code, but work in the demo.
i want to know whether related to SDI structure?
thanks,
jim
|
|
|
|
|
|
hi,
i did not call this functon. what is it use for?
i can see there is this code in the demo.
thank you! i think it's the problem...
thank you very much!
jim
|
|
|
|
|
Hi,
Have you called AfxInitSockets() ?
-widi
|
|
|
|
|
ok, it's afxsocketinit().
-widi
|
|
|
|
|
Hi,
I need to create an installation process for my project (FTP server). It should be installed as a service. Does anybody have any idea ? Thanks in advance.
Celebrate Mr. Cesilko!
|
|
|
|