Shtock's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
Members
Active Posts:
29 (0.03 per day)
Joined:
14-November 11
Profile Views:
231
Last Active:
User is offline Apr 26 2013 07:50 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Shtock has not set their status

Posts I've Made

  1. In Topic: Can't send the text to the Edit control

    Posted 10 Oct 2012

    View PostShtock, on 10 October 2012 - 05:04 PM, said:

    View PostSkydiver, on 10 October 2012 - 03:47 PM, said:

    View PostShtock, on 10 October 2012 - 02:54 PM, said:

    GetDlgItem(ID_EDIT1) returns NULL.

    That means that the context you are calling from doesn't own that window handle. It's probably nested deep within the Ribbon control rather than in your current dialog/window. This also means that all your SetDlgItemText() calls will fail because it can't find the window.

    View PostShtock, on 10 October 2012 - 02:54 PM, said:

    Maybe I need to catch some event in the BEGIN_MESSAGE_MAP? I don't see where the problem is.

    No, it's not a matter of the message map. It's a matter of you knowing your window hierarchy and which window is the parent of that control. One way to discover the hierarchy is to use Spy++.

    Basically the problem is that the Get/SetDlgItem*() framework wrapper that you are using are calling the corresponding Win32 API of the same name. The Win32 API takes as the first parameter the window that is the parent of the window being addressed. The framework that you are using is providing the current dialog or window as that parent. As you've obviously discovered, that window you are trying to address it not a child of your window. It's probably a child of the Ribbon, or even deeper down.

    View PostShtock, on 10 October 2012 - 02:54 PM, said:

    I took Edit from toolbox and hung it on the form(like I'd do in FormConstructor in C#), then opened Properties and set a new ID.

    That's the problem with drag n' drop programming without understanding what is happening under the covers. You have to know what dropping that control into the Ribbon actually means in terms of window hierarchies.

    View PostShtock, on 10 October 2012 - 02:54 PM, said:

    It seems to me it's quite enough to operate with Edit control, right ?

    It is enough if you know what the parent window of the edit control is.


    Oh..man
    Your answer was so exhaustive. thanks (without any jokes)
    Now I'm trying to detect what is the class where the Edit control is.
    I've already tried in this way:
    GetParent()->SetDlgItemText(ID_CR_EDIT,L"Abcd"); =No way
    I almost got the hang of Spy++(it conflicts with VS debug mode so I run it in non-debug)
    But I don't see yet what class is handling the Edit control
    I try to catch parent(ribbon) window when I just set mouse over the button(without clicking) as I depicted on the picture

    Ive found that window class is Afx:RibbonBar:1370000:8:10003:10
    If I try do

    HWND hTray;

    hTray = ::FindWindow(L"Afx:RibbonBar:1360000:8:10003:10", NULL);
    if(hTray)
    {

    ::SetDlgItemText(hTray,ID_CR_EDIT,L"mn,m");
    }
    hTray returns NULL;
  2. In Topic: Can't send the text to the Edit control

    Posted 10 Oct 2012

    View PostSkydiver, on 10 October 2012 - 03:47 PM, said:

    View PostShtock, on 10 October 2012 - 02:54 PM, said:

    GetDlgItem(ID_EDIT1) returns NULL.

    That means that the context you are calling from doesn't own that window handle. It's probably nested deep within the Ribbon control rather than in your current dialog/window. This also means that all your SetDlgItemText() calls will fail because it can't find the window.

    View PostShtock, on 10 October 2012 - 02:54 PM, said:

    Maybe I need to catch some event in the BEGIN_MESSAGE_MAP? I don't see where the problem is.

    No, it's not a matter of the message map. It's a matter of you knowing your window hierarchy and which window is the parent of that control. One way to discover the hierarchy is to use Spy++.

    Basically the problem is that the Get/SetDlgItem*() framework wrapper that you are using are calling the corresponding Win32 API of the same name. The Win32 API takes as the first parameter the window that is the parent of the window being addressed. The framework that you are using is providing the current dialog or window as that parent. As you've obviously discovered, that window you are trying to address it not a child of your window. It's probably a child of the Ribbon, or even deeper down.

    View PostShtock, on 10 October 2012 - 02:54 PM, said:

    I took Edit from toolbox and hung it on the form(like I'd do in FormConstructor in C#), then opened Properties and set a new ID.

    That's the problem with drag n' drop programming without understanding what is happening under the covers. You have to know what dropping that control into the Ribbon actually means in terms of window hierarchies.

    View PostShtock, on 10 October 2012 - 02:54 PM, said:

    It seems to me it's quite enough to operate with Edit control, right ?

    It is enough if you know what the parent window of the edit control is.


    Oh..man
    Your answer was so exhaustive. thanks (without any jokes)
    Now I'm trying to detect what is the class where the Edit control is.
    I've already tried in this way:
    GetParent()->SetDlgItemText(ID_CR_EDIT,L"Abcd"); =No way
    I almost got the hang of Spy++(it conflicts with VS debug mode so I run it in non-debug)
    But I don't see yet what class is handling the Edit control
    I try to catch parent(ribbon) window when I just set mouse over the button(without clicking) as I depicted on the picture
  3. In Topic: Can't send the text to the Edit control

    Posted 10 Oct 2012

    View PostSkydiver, on 10 October 2012 - 03:36 AM, said:

    Quick questions:
    1) Do ID_EDIT1 and ID_CR_EDIT refer to the same control?
    2) Do both calls to GetDlgItem(ID_EDIT1) and GetDlgItem(ID_CR_EDIT) return valid window handles?
    3) If you run Spy++, and watch the Windows messages sent to the edit control, do you see the messages being received?

    GetDlgItem(ID_EDIT1) returns NULL. Maybe I need to catch some event in the BEGIN_MESSAGE_MAP? I don't see where the problem is.
    I took Edit from toolbox and hung it on the form(like I'd do in FormConstructor in C#), then opened Properties and set a new ID.
    It seems to me it's quite enough to operate with Edit control, right ?
    Now I'd like to set a new value from whatever function in MyView class
  4. In Topic: Can't send the text to the Edit control

    Posted 10 Oct 2012

    View PostSkydiver, on 10 October 2012 - 03:36 AM, said:

    Quick questions:
    1) Do ID_EDIT1 and ID_CR_EDIT refer to the same control?
    2) Do both calls to GetDlgItem(ID_EDIT1) and GetDlgItem(ID_CR_EDIT) return valid window handles?
    3) If you run Spy++, and watch the Windows messages sent to the edit control, do you see the messages being received?


    Yes, I just mistyped.ID_EDIT1 and ID_CR_EDIT - it is the same control.
    No, I confess to you I have never even try to work with Spy++. Okay, I'll try.
  5. In Topic: Trouble with image fixing using ValidateRect()

    Posted 9 Oct 2012

    View PostSkydiver, on 09 October 2012 - 09:45 AM, said:

    How is the size of tmpImg related to cImg? If tmpImg covers more area that cImg, your call to ValidateRect() passing in the dimension of tmpImg tells Windows that everything within that rectangle is good to go and needs no repainting. If that area happens to include the left over artifacts from the scrollbars, then those will remain on untouched, specially since you overrode the WM_ERASEBACKGROUND message to not repaint the background.

    The best approach to dealing with flickering is double buffering. You can double buffer either the entire client area if you don't know what areas are going to be changing, or you can just double buffer the small area that needs updating.


    1)I dont override OnEraseBkgnd(CDC* pDC), 'cause I don't see why I'd do it if I set ValidateRect().When the window need to be redrawn OnPaint() automatically calls CWnd::OnEraseBkgnd(CDC* pDC) and redraw all the rest of the window except only the picture. (Right??)

    2)tmpImg is my temp solution, 'cause I need to operate with image and I use OpenCV.My prog works as follows:
    a)Load image from file->than created IplImage from the image->than it's drawn on the Form->then(stupidly way and I'll rewrite it to work with bitmap) I load image with Cimage->than all operations makes with Cimage.

    3)Why you suggest use double buffering if I already use see:
    memDC.SelectObject(cImg);//memDC is a global var (It seems me it's better then create it every time,am I right?)
    	pDC->BitBlt(0, 0, cImg.GetWidth(), cImg.GetHeight(), &memDC, 0, 0, SRCCOPY);
    

    Or it is smth else and I'm wrong ??

    4)my question: Do I need use ValidateRect() every time I need to redraw the window? Maybe there is another way once fix it and than sometime unfix it ? (in may way unfix picture when I need to load a new image)

    thanks guy...and hope you'll scribble me something

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Shtock hasn't added any friends yet.

Comments

Shtock has no profile comments yet. Why not say hello?