|
But I thing I know why is it so. According to spy ++ this is a ATL:SysTreeView control. Maybe as a lparam they are sending some other struct than LV_ITEM
Pain is a weakness living the body
|
|
|
|
|
Where is it crashing?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Im hooking into OE and it crashes when OE adds new items to address list. when i use olny iImage eg iImage = 2 it works properly but i want test pszText vaule and according to this set proper valus of iImage
Pain is a weakness living the body
|
|
|
|
|
I would do:
<br />
if(pitem)<br />
{<br />
if(pitem->pszText)<br />
{<br />
}<br />
} <br />
Bikram Singh
|
|
|
|
|
not working too i think this not valid pointer beacuse its not the same address space I had the similar problem some time ago when i wannted to send some char * as wparam or lparam using SendMessage. I had to use WM_COPYDATA then char * goes thru kernel memory and pointer is valid
Pain is a weakness living the body
|
|
|
|
|
Iam catching shift key in pretranslate function and i want to disable the shift key( make the shift key up). i..e i want to disable shift key functionality. How to do it?
Thanx in advance.
Lokesh
|
|
|
|
|
<br />
SetFocus(hwnd);<br />
<br />
keybd_event( VK_SHIFT,0x45,KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);<br />
check if SetFocus is nesserly in your problem
Pain is a weakness living the body
|
|
|
|
|
I want to create a pipe. However, I don't want my app to just sit forever waiting for a client to connect. Do I use the overlap setting and the NO_WAIT (non-blocking) flag when I create the pipe? I was thinking of doing a loop with the connectnamedpipe and getoverlap func and flag check to see if the user wanted to quit out of the server app before a connection to a client was made. Is this a good idea?
|
|
|
|
|
In a "class CMyCtrl : public CWnd" controller I create another controller dynamically.
Can I catch the WM_LBUTTONDOWN message that is intended for the dynamic controller in CMyCtrl instead?
/Mathias
|
|
|
|
|
<br />
<br />
(WNDPROC) gfnMyProc;<br />
gfnMyProc = (WNDPROC)SetWindowLong(listview, GWL_WNDPROC,(LONG)MyProc);<br />
<br />
LRESULT CALLBACK MyProc(HWND hwnd, UINT uiMsg,WPARAM wParam, LPARAM lParam)<br />
{<br />
switch (uiMsg)<br />
{<br />
case WM_LBUTTONDOWN:<br />
{<br />
<br />
break;<br />
}<br />
}<br />
return CallWindowProc(gfnMyProc, hwnd, uiMsg, wParam, lParam);<br />
}}<br />
Pain is a weakness living the body
|
|
|
|
|
This should work
<br />
<br />
(WNDPROC) gfnMyProc;<br />
gfnMyProc = (WNDPROC)SetWindowLong(listview, GWL_WNDPROC,(LONG)MyProc);<br />
<br />
LRESULT CALLBACK MyProc(HWND hwnd, UINT uiMsg,WPARAM wParam, LPARAM lParam)<br />
{<br />
switch (uiMsg)<br />
{<br />
case WM_LBUTTONDOWN:<br />
{<br />
<br />
break;<br />
}<br />
}<br />
return CallWindowProc(gfnMyProc, hwnd, uiMsg, wParam, lParam);<br />
}<br />
Pain is a weakness living the body
|
|
|
|
|
I would like to do a particular operation every 1 minute.How can I set the program so that this is done automatically?Please Help!!!
|
|
|
|
|
SetTimer() is the simplest way. You can create a timer which will send a WM_TIMER message every 60000 milliseconds.
|
|
|
|
|
You could also have it notify a static function, rather than send the message through the message loop, if desired.
|
|
|
|
|
Hi,
I´m working with a CListCtrl control using a CImageList. The size of my list is limited to 200 items by using DeleteItem(0) when GetItemCount>200. Everything seems to work fine but the memory my app is taken from the system. It seems that the system does not free the memory allocated for each item when it is deleted.
Can anybody help me about this?
Thanks a lot.
|
|
|
|
|
munguia wrote:
It seems that the system does not free the memory allocated for each item when it is deleted.
If you have a delete for every new , your application is behaving properly. It's highly unlikely you'd see the memory footprint of your application decrease until the application is closed. That does not mean, however, that less memory is available. For a more detailed spin on this, read here, especially the last section.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
It should work!
if u use CListCtrl object as a data member of a view or dialog class, it is destroyed when its owner is destroyed. If you use aCListView, the framework destroys the control when it destroys the view.
lokesh
|
|
|
|
|
Hi,
Are you using SetItemData to store pointer to objects? If so, have you remembered to delete them before removing the item from the list?
Also, have you included:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
to your .cpp files so that you can track the new's and trace the leaks?
Cheers,
Andy
|
|
|
|
|
I need to put three different forms in SDI application's CView window so that user can choose which view he wants to see. If I make 3 different CFormView classes how do I select one to be shown in a CView window?
|
|
|
|
|
http://www.codeproject.com/useritems/MultiViewsMFC_MDI.asp
Hope this article will help you .
|
|
|
|
|
thanx. hopefully, it will help.
|
|
|
|
|
Hi there,
Create your first view as normal:
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CForm1));
AddDocTemplate(pDocTemplate);
Then, still in InitInstance, store an array (or obarray) to hold the other views...
CView* pActiveView = ((CFrameWnd*) m_pMainWnd)->GetActiveView();
m_pViews[0] = pActiveView;
m_pViews[1] = (CView*) new CForm2;
m_pViews[2] = (CView*) new CForm3;
CDocument* pCurrentDoc = ((CFrameWnd*) m_pMainWnd)->GetActiveDocument();
CCreateContext newContext;
newContext.m_pNewViewClass = NULL;
newContext.m_pNewDocTemplate = NULL;
newContext.m_pLastView = NULL;
newContext.m_pCurrentFrame = NULL;
newContext.m_pCurrentDoc = pCurrentDoc;
UINT viewID[3];
viewID[1] = AFX_IDW_PANE_FIRST + 1;
viewID[2] = AFX_IDW_PANE_FIRST + 2;
CRect rect(0, 0, 0, 0);
for ( int nView=1; nView<NUMVIEWS; nView++ )
{
m_pViews[nView]->Create(NULL, NULL,
(AFX_WS_DEFAULT_VIEW & ~WS_VISIBLE),
rect, m_pMainWnd,
viewID[nView], &newContext);
}
((CForm2*)m_pViews[1])->OnInitialUpdate();
((CForm3*)m_pViews[2])->OnInitialUpdate();
Here's a function to help you switch dynamically between the views...
CView* CMyApp::SwitchView( UINT nIndex, BOOL bSaveData )
{
ASSERT( nIndex >=0 && nIndex < NUMVIEWS );
CView* pNewView = m_pViews[nIndex];
CView* pActiveView = ((CFrameWnd*) m_pMainWnd)->GetActiveView();
if ( !pActiveView )
return NULL;
if ( pNewView == pActiveView )
return pActiveView;
if(bSaveData)
{
if (!SaveActiveViewsData() )
{
return pActiveView;
}
}
UINT temp = ::GetWindowLong(pActiveView->m_hWnd, GWL_ID);
::SetWindowLong(pActiveView->m_hWnd, GWL_ID,::GetWindowLong(pNewView->m_hWnd, GWL_ID));
::SetWindowLong(pNewView->m_hWnd, GWL_ID, temp);
pActiveView->ShowWindow(SW_HIDE);
((CFormView*)pNewView)->ResizeParentToFit(FALSE);
((CFrameWnd*) m_pMainWnd)->SetActiveView(pNewView);
pNewView->ShowWindow(SW_SHOW);
return pActiveView;
}
Any questions, I'll be happy to help.
Hope this helps,
Andy
|
|
|
|
|
Thanx for your help.
I'll try to implement this today and let you know how it works.
|
|
|
|
|
I just wanted to thank you again for your help. I applied the code you gave me in the application and it works. I had some problems with the SwitchView(), particulary this line
<br />
((CFormView*)pNewView)->ResizeParentToFit(FALSE);<br />
because it would produce strange windows sizes for the first 7-8 calls of SwitchView(), and then it would work fine.
So I put
<br />
((CFrameWnd*) m_pMainWnd)->RecalcLayout();<br />
instead. It works fine now.
And I'd like to ask you one more question. I have a button "quit" on one of CFormView's forms. What should I put in OnButtonQuit() message handler, so that the application exits after the button is pressed?
|
|
|
|
|
I gave the link for MDI
Think same thing will work for this also
|
|
|
|