|
I know what you will say: There are some sources on this site....
all I find was in MFC,
Here is my probleme:
if I do this:
case WM_INITDIALOG:
{
DragAcceptFiles(hwnd,TRUE);
........
...
}
no problemo, I catch the WM_DROPFILES
but I want it for my list view control (IDC_LIST1)
so I did that
case WM_INITDIALOG:
{
DragAcceptFiles(GetDlgItem(hwnd,IDC_LIST1),TRUE);
........
...
}
and impossible to catch the msg...
I try to catch everywhere, whitout result..
if someone can help me!!!
|
|
|
|
|
youpiyoyo wrote:
I try to catch everywhere
Did you try subclassing the list control?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
How do I subclass the list control????
|
|
|
|
|
Type CListCtrl in the Search window and click the Go button
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
As I had said before in the title, it was coded in api win32, and not in MFC,
so for the CListCtrl it won't work.....
I try something with windowlong...
|
|
|
|
|
MFC does not change the way a control works. All the same styles, messages and structures apply equally.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
ok thank you for your help, I finally found it, you tell me the truth, with subclassing...
for people who are interesting there is my solution:
<br />
WNDPROC wpOrigEditProc;<br />
<br />
LRESULT APIENTRY EditSubclassProc(<br />
HWND hwnd, <br />
UINT uMsg, <br />
WPARAM wParam, <br />
LPARAM lParam) <br />
{ <br />
if (uMsg == WM_GETDLGCODE) <br />
return DLGC_WANTALLKEYS; <br />
if(uMsg == WM_DROPFILES) MessageBox(0,"drop",0,0);<br />
<br />
return CallWindowProc(wpOrigEditProc, hwnd, uMsg, <br />
wParam, lParam); <br />
} <br />
<br />
LRESULT CALLBACK DlgMainProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch(msg)<br />
{<br />
case WM_INITDIALOG:<br />
{<br />
DragAcceptFiles(GetDlgItem(hwnd,IDC_LIST1),TRUE);<br />
wpOrigEditProc = (WNDPROC)SetWindowLong(GetDlgItem(hwnd,IDC_LIST1),GWL_WNDPROC,(LONG) EditSubclassProc);<br />
<br />
........<br />
.......<br />
}<br />
...<br />
for people who have questions e-mail me!!!
|
|
|
|
|
I have a dialog with a picture box control on it. Within the picturebox I dynamically draw a CListCtrl object at a random position when the user clicks a button. Now I'm using a CRectTracker object to allow the user to resize and/or move the control. The problem is that when it gets the rect of the control, it gets it relative to the control itself, but when I call the control's MoveWindow function using those coordinates, it moves it relative to the parent window's coordinates, so that if I only move it over to the right one pixel, it moves it to the left coordinate of 1 for the parent window. I've tried using ScreenToClient, ClientToScreen, and I can't seem to get this to work right. Any help would be greatly appreciated.
Here's what I have so far in my control's OnLbuttonDown MessageHandler:
if (m_tracker)
{
m_tracker->Track(this, point, FALSE,(CWnd*)&m_pDlg->m_picWindow );
Invalidate(FALSE);
CDC* pDC = GetDC();
m_tracker->Draw(pDC);
LPRECT rect = new RECT;
CWnd* wnd = (CWnd*)this;
rect = LPRECT(m_tracker->m_rect);
LPRECT rect2 = new RECT;
LPRECT rect3 = new RECT;
m_pDlg->m_picWindow.GetWindowRect(rect3);
this->GetWindowRect(rect2);
wnd->MoveWindow(rect,TRUE) ;
delete rect;
rect = NULL;
}
CListCtrl::OnLButtonDown(nFlags, point);
If it's broken, I probably did it
bdiamond
|
|
|
|
|
bdiamond wrote:
rect = LPRECT(m_tracker->m_rect);
Where is m_rect being defined/assigned?
______________________________
dNimrod#X
________________________
|
|
|
|
|
the rect is set for CRectTracker in this code (that I got from an example on codeproject):
CListCtrl::OnSetFocus(pOldWnd);
CDC* pDC = GetDC();
if (m_tracker)
{
delete m_tracker;
m_tracker = NULL;
}
LPRECT rect = new RECT;
CWnd* wnd = (CWnd*)this;
wnd->GetWindowRect(rect);
ScreenToClient(rect);
m_tracker = new CRectTracker(rect,CRectTracker::dottedLine | CRectTracker::resizeOutside | CRectTracker::hatchedBorder );
m_tracker->Draw(pDC);
If it's broken, I probably did it
bdiamond
|
|
|
|
|
That's somewhat messy including memory leaks. MoveWindow takes coordinates in relation to the client area of the parent window.
bdiamond wrote:
Within the picturebox I dynamically draw a CListCtrl object at a random position
What is the parent window of the CListCtrl?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
yes, I know it's somewhat messy, and I actually deleted some of the mess just to make it easier to read here, but I will clean that up after I can come up with a solution. The parent of the CListCtrl is the CStatic-derived picture window; I've also tried it with the dialog being the parent, and I know that you're right about it moving it according to the parent window's coordinates, but I can't seem to get it to move accordingly even using ClientToScreen or ScreenToClient ( I got confused, so I tried both).
If it's broken, I probably did it
bdiamond
|
|
|
|
|
bdiamond wrote:
at a random position
If the random postion is supposed to be within the Picturebox then there is no reason to use GetWindowRect() and ScreenToClient() into this. You only need to find a x,y coordinate that is zero based within the picturebox... so the limit is the width and height of the picturebox minus the width and height of the list control. Keep it simple.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
the code to place the control is fine and that is done in my class's constructor. The problem is that using the CRectTracker, the m_rect member is based upon the control's coordinates. If I move the control over to the left one unit, the m_rect will have -1 as it's Left member. so when I use MoveWindow, the control is placed at -1 in its parent instead of just moving over to the left one unit. m_rect is using the control's coordinates, and Movewindow is using the parent's coordinates.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
bdiamond wrote:
If I move the control over to the left one unit,
Sorry but now you have lost me. That does not match what your original post said
bdiamond wrote:
I dynamically draw a CListCtrl object at a random position when the user clicks a button.
So if you are trying to move the window based on it's current position you need this:
1) GetWindowRect of the list control
2) Transform the screen coordinates to client coordinates of the picture control
3) Adjust the rect as per positioning requirements.
4) Move the list control using the resulting coordinates
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
got it now, thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hello,
I have downloaded and installed the latest service pack (6) for developer studio, and it seems to me that files I had saved with my programs using CObject serialization (I know, I know, bad choice), now can't be opened with the new compiled code and crash the program.
Has anybody else experienced this?
Have no fear of perfection - You will never reach it
|
|
|
|
|
It seems odd that Microsoft would break something as ubiquitous as serialization with a service back, but you never know. Have you tried debugging and stepping through your routines? Can you tie the crash to a particular line in your code (e.g., a certain piece of data being deserialized)?
Also, what happens if you serialize with the latest service pack (6) and then deserialize?
I guess it's possilbe you were doing something that may have been working by accident, or some undocumented feature, and SP6 ended up changing that for whatever reason and broke your code. I'm merely suggesting some possible ways of figuring out what's wrong.
I think VC++ comes with something called a document viewer that can actually view serialized data files - but I am not sure as I have never used or experimented with it.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
If you're interested, this[^] article describes how to do serialize objects without any reliance on CObject .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi
How can i use the function IHTMLTxtRange::moveToBookmark?
I have a bookmark in my xml file(like #32346).I've got the IHTMLTxtRange for the document.But couldn't move to the bookmark(return VARIANT_FALSE).
Or i have to use IHTMLTxtRange::getBookmark for that?
Please help me
Thanks
|
|
|
|
|
has anyone got the active x component to work correctly
in unmanaged c++ (mfc 7.1) in visual studio.net 2003 ?
|
|
|
|
|
It seems that you have posted this here before! I can't speak for 10 as I have only used upto 8.5.
BusinessObjects ought to have examples of their API. Have you tried there?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Irish_GUI wrote:
has anyone got the active x component to work correctly
in unmanaged c++ (mfc 7.1) in visual studio.net 2003 ?
Not tried it yet as I haven't the funds to upgrade. What kind of problems are you running into?
Have you tried any of the samples that come with Crystal.
Michael
CP Blog [^]
|
|
|
|
|
I have been trying to implement the MRU option for a MFC Dialog program. I have a Menu for New, Open, Save etc, but would like to add a Menu option for MRU files.
All the examples are based on SDI or MDI MFC applications.
The Menu is defined in the AppDlg.cpp file but LoadStdProfileSettings(); is not a member of this dialog class, only the App.cpp class.
Are they any dialog based samples, even the Microsoft site uses a SDI example.
|
|
|
|
|
I have been trying to implement the MRU option for a MFC Dialog program. I have a Menu for New, Open, Save etc, but would like to add a Menu option for MRU files.
All the examples are based on SDI or MDI MFC applications.
The Menu is defined in the AppDlg.cpp file but LoadStdProfileSettings(); is not a member of this dialog class, only the App.cpp class.
Are they any dialog based samples, even the Microsoft site uses a SDI example.
|
|
|
|