|
Tomasz,
Thx, first part of the bug eliminated (when clicking and not moving). But, the bug is still there when clicking AND moving the bar. The bar here jumps off 2 pixels to the right (or down).
Now this can't be THAT easy?!
/Tommy
|
|
|
|
|
So you'll have to dig deep into RecalcLayout.
BTW: Are you a perfectionist yourself or just have a perfectionist boss? Is it really that important?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
It has to be perfect since we're dealing with high res models and 2 pixels do account for a loss of image quality if it gets in the way of the image...
That's why I don't want the bar to jump by itself, mostly because the above and secondly because it's really annoying! If you release the bar tracker then it's supposed to splitt at that exact location, not 2 pixels off... don't you agree...?
|
|
|
|
|
If you release the bar tracker then it's supposed to splitt at that exact location, not 2 pixels off... don't you agree...?
Hmmmm... I would say that most users can't move mouse with pixel or even 2-pixel accuracy. However, I can see that this issue is really important for you
Assuming that you have three-way splitter without scrollbar sharing, you could simply implement resizing 'manually' - create the views inside a frame window, leave some space between them, set the frame class cursor to <-|-> (rotated 90 degrees) and handle mouse messages in the frame window. Enter tracking mode at WM_LBUTTONDOWN, capture the mouse, move your views in WM_MOUSEMOVE, end the sequence with WM_LBUTTONUP. This gives you on-the-fly resizing.
You may find this technique may be easier to implement than fixing CSplitterWnd.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I need help with a CTreeCtrl !!! What am I doing wrong ???
// CMyClass is derived from CTreeView !!!!!
// m_stupidTree is declared in MyClass.h as
// CTreeCtrl *m_stupidTree;
CMyClass::CMyClass()
{
m_stupidTree = new CTreeCtrl;
}
CMyClass::~CMyClass()
{
delete m_stupidTree;
}
CMyClass::OnInitialUpdate()
{
// Some code
m_stupidTree->Create(0, CRect(0,0,0,0), this, 0)
}
void thisfunctiondoesntwork (HTREEITEM hAItem)
{
TVITEM tvItem;
tvItem.hItem = hAItem;
this->GetTreeCtrl().GetItem(&tvitem);
// Do some code
m_stupidTree->InsertItem(&tvinsertplease);
// tvinsertplease is a TV_INSERTSTRUCT inicializated before
}
But I get an assertion failure and I don't know what am I doing wrong !!!! The problem is that when it runs this->GetTreeCtrl().GetItem(&tvitem) the m_stupidTree is lost, and I can no longer see it's value so obviously when I do InsertItem it doesn't exists and crashes !!!!
Can you help me ?????
|
|
|
|
|
Assertion message box tells you where (in which file and line) the problem is. Run your program again and post this information.
BTW, your 'thisfunctiondoesntwork' looks funny. Seems that it's a method of CTreeView-derived class. Why do you need another tree, the 'stupid' one? Are you trying to copy items between two trees?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
When it crashes I see a message box and says it's in file MFC42.dll and then goes to this line:
_AFXCMN_INLINE HTREEITEM CTreeCtrl::InsertItem(LPTVINSERTSTRUCT lpInsertStruct)
{ ASSERT(::IsWindow(m_hWnd)); return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); }
And yes, you guessed correctly why I am using two trees
|
|
|
|
|
Assertions fires because your m_stupidTree is not a valid Win32 window. In other words, you haven't called CTreeCtrl::Create yet, --or-- the call has failed (invalid parameters passed are most likely the problem).
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
nononono I think it's not that because when I create m_stupidTree, if I try to insert an item there (on CMyClass::OnInitialUpdate) everything goes right, also if I try it in thisfunctiondoesntwork just before this->GetTreeCtrl().GetItem(&tvitem) it also works.
I'm learning MFCs so I'm not very good at it but when it enters the function thisfunctiondoesntwork, in the debugger I can see a value for m_stupidTree->m_pWnd and after executing GetItem it says m_pWnd ={????} or something like that.
|
|
|
|
|
So probably you've screwed something with 'this' pointer. When assertion fires, have a look at call stack. Who calls 'thisfunctiondoesntwork'? What's the 'this' pointer in this function?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I don't know how to look what you said. I've tried call stack and got
CMyClass::thisfunctiondoesntwork(_TREEITEM * 0x00147158, _TREEITEM * 0x00000000) line 1011 + 15 bytes
I don't understand what it means... By the way I'm leaving work and going to have lunch so thanks for everything and I hope you can help me next week!
I'll be back!
|
|
|
|
|
So, could anybody tell me what should I do with the call stack to see what's going on ????
|
|
|
|
|
I have a question about the function "thisfunctiondoesntwork()"
line:
this->GetTreeCtrl().GetItem(&tvitem);
What is the tvitem? Moreover, what do you mean "this"
I think windows get confused when you refer to "this"
Vu
vucsuf
|
|
|
|
|
Hi all
I need to start a program from a cluster resource dll in such a way that it behaves as if it was started by a logged in user.
Does anyone know what flags, settings, etc I need to use in CreateProcess/CreateProcessAsUser to do this?
I am sure this must be possible, as the Generic Cluster Resource Type seems to do something similar?
Thanks
Martin
|
|
|
|
|
In my application, i have a member variable double *m_pTab.
firstly, i have created a function which take 1 parameter(parameter1) which be used to allocate memory as follow: m_pDate=new double[parameter1], and after, in the same function, i modify the value of the pointer. For example, *(m_pTab+i)=value_i;
Now, i would like to use this member pointer in another function with the affectation done above, it's my pb, because i don't know how looks like the syntax of this kind of operation.
So, is anybody could explain me how to solve my problem?
thanks in advance
gerald
|
|
|
|
|
I'm not sure to understand, but I suppose m_pTab is the same as m_pDate.
So the line *(m_pTab+i)=value_i; is equivalent to m_pDate[i]=value_i; .
Then, what you want to do in the other function?
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi,
Q1:
I have a flat owner draw button that seems to work ok with an icon attached to it. Now the thing is that I want to change the background color of the window which the button is attached to, and I want the color to shine through the button, sort of having a transparent button. How can I do this?
Q2:
If I make an Icon in the VC++ editor, can't I use some sort of transparency background color? (To solve the question aforementioned)
|
|
|
|
|
If I make an Icon in the VC++ editor, can't I use some sort of transparency background color?
Yes, Windows icons can have 'transparent' pixels. In VC++ Icon Editor, use one of the silly-looking tools in the color palette. It's rather hard to describe, looks more or less like little green monitor located in the upper row of icons, on the left side of black rectangle.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Yes, I've tried using that "color". But my window background, to which my button is attached to, does not "shine" through the button. I get a greyish look of the button even if I have a blue background window.
Maybe the CButton class defaults to a color...?
/T
|
|
|
|
|
On Win2000 you can use UpdateLayeredWindow to create translucent windows. With earlier versions your only solution is to copy background bits to DIB section and compose the foreground bits using some blending function, then copy DIB section to screen as button image.
If all you need is completely blue button with icon, handle WM_CTLCOLORBTN.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello,
I want to resize the Window Standard Dialog (File open Dialog) on the button click as i want to add some extra control on the hidden area and then on button click i want to show all these controls. I
I have done this and it is running on Win NT but this application is not running on Win2K. When i tried to resize the list control moves and all the controls move downward but not giving room to other hidden controls.........
Can any one suggest what to do......
|
|
|
|
|
Hi,
On Win2K and WinME the common file dialogs are resizable, so I guess you want to disable this feature.
Search for OFN_ENABLESIZING on MSDN for further details.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi there,In WinCE Programming ,I cant use CFindFile class,So,how I can enumerate all the .txt files in some directory?
Thanks a lot.
|
|
|
|
|
FindFirstFile(...) --requires CE 1.0 or higher
_findfirst(...)
|
|
|
|
|
Dear all,
I am writing a programme using VC++ to display html or other kind of web page as help files. To make it more advance, I need to check the existency of the given URL before display it out so that it will browse to an user-default "unavailable page" instead of the usual 404-error page.
I am now facing a problem to verify the URL. I have tried several ways and none seems to work.
1. using InternetOpen follow by InternetOpenURL to check if it return a valid handle.
2. trying to use OnDownloadComplete through DISP_FUNCTION_MAP in CView ( as my IWebBrowser2 is not in CHtmlView, I cannot use DWebBrowserEvent )
for case (1),
InternetOpenURL other return NULL with error code 997 for all kind ( exist or non-exist ) of URL if InternetOpen using INTERNET_FLAG_ASYNC for the dwFlag.. think there is a bug in MFC as told in Microsoft KB(Q176176)
or, InternetOpenURL other return a valid handle for all kind ( again exist or non-exist ) of URL if InternetOpen using 0 for the dwFlag.. obviously this is wrong as I would like to receive NULL for non-exist URL.
for case (2),
I got problem when I try to call AfxConnectionAdvise(), it fail when it step into pCPC->FindConnectionPoint(iid, &pCP) in CTLCONN.cpp line 166 and return handle 0x80004002 ( which I found out as CdoE_INTERFACE_NOT_SUPPORTED, but I am not 100% sure )..
have anyone faced this kind of problem before. hope you could help
Thanks in advance.
Regards,
Kathy
|
|
|
|