Getting Doc handles

2013-10-25  Source: Original Site  Category:Visual C++  Views:0 

Advertisement

I have an application that loads and displays images within a main window. I am trying to write out image information about each loaded image to a file (color data, image size...). At the moment, I am able to write out information on only the active image window. This is probably because I am using GetDocument() to get the handle of the current window. How do I get Doc handles on each loaded image regardless of which is active?

CDemoDoc* CDemoView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDemoDoc)));
return (CDemoDoc*)m_pDocument;
}
.
.
.
.
.
.
CDemoDoc *pDoc = GetDocument();

if (pDoc->GetImage())
{
int width = pDoc->GetImage()->GetWidth();
int height = pDoc->GetImage()->GetHeight();
fprintf( stream, "Width is:%d Height is:%d\n" , width, height);
}

if (pDoc->GetImage()->GetRGB((int)x, (int)y, &r, &g, &b))
{
fprintf( stream, "red:%d green:%d blue:%d radio:%d\n" , r, g, b, radio);
fclose( stream );
}

Related articles
  • Getting Doc handles 2013-10-25

    I have an application that loads and displays images within a main window. I am trying to write out image information about each loaded image to a file (color data, image size...). At the moment, I am able to write out information on only the active

  • How can I get Doc or View member from a window handle?? 2013-07-14

    I have to do some job in the global function, and I also need Doc and View member in the function. the global function is called by view like follow: void CMyView::DoSomething() { HWND hWnd = GetSafeHwnd(); AfxBeginThread(ThreadProc, hWnd, THREAD_PRI

  • CHtmlView: Getting a handle to each frame in an HTML doc 2014-02-17

    Greetings: I have a CHtmlView class that reads in an HTML file based on user input. The HTML file has a left frame which acts as a menu and the right frame shows the data for the selection on the left. I want it so that when the user hits print, it d

  • How to get the handle to the second splitter pane 2013-05-16

    I have two views (A and B)one doc. Now I want to use Invalidate() in View A to control the OnDraw() function in View B. How to get the handle of View B? I know there is a function GetActiveView(), but now view B is inactive. Could someone tell me how

  • Get CabinetWClass handle from SysListView32 handle. 2012-01-21

    Get CabinetWClass handle from SysListView32 handle. or how to get the path from a SysListView32 window. I am trying to get the directory path from any Explorer window under the mouse pointer. I have worked out how to get it when the mouse is over the

  • Getting a handle to the min/max button of a window 2012-01-23

    Does anyone knows how can i get a handle to the min/max buttons of a window, or at least get their positions? Thanks best

  • To get Process handle 2012-02-09

    Hi I have an exe name xxx.exe, I want to get a handle to this guy from another ddd.exe(Vc++). How to to this. Only information I have is the exe name i,e xxx. Advance

  • how to get the handle of the current window 2012-02-11

    hi how to get the handle of the current window i.e mine is a dialog based app and i wanna get its hangle CMyDialog

  • How can I get the handle of the statusbar in the dialog 2012-02-15

    I want to make the statusbar adjust it lenghth to the size of the dialog when changing the dialog size automatically .But firstly,I must get the handle of the statusbar ,then I can call the MoveWindiw() funtion to achieve that . But How can I get the

  • how to get the handle of child control(EDIT BOX) at run time in MFC 2012-02-16

    how to get the handle of child control(EDIT BOX) of other MFC EXE to my MFC code? This edit box is not having caption,so that i cant use FindWindowEX. Is there any other way ? -ABhi

  • Getting the handle of a Window 2012-02-26

    I have the following problem: 1) I start an application two times Now I have two windows with the same name and I want to get a handle for each window. FindWindow does not work, because the names are the same

  • How to Get the handle of the child dialog ? in VC++ 2012-03-07

    How to Get the handle of the child dialog ? i got 2 child dialog and a parent dialog. i need to access a function that is there in the child dialog from my parent dialog. so i need to get the handle of the child dialog. how to do get it?

  • How can i get the handle of a shape control? 2012-03-07

    Does anybody know how to get the handle of a shape control since no such .hwnd property is defined with the shape control?

  • Get Window Handle with the help of Title 2012-04-01

    I am trying to get the handle of a particular window but the problem is that the only information I have about that window is its "Title". I was able to do it in VB using FindWindowLike API function but as I am new to VC++ I am having hard time to he

  • how can i get the handle of window...? 2012-04-09

    how can i get the handle of window located in another computer in my local network? is that possible?

  • How to get the handle of another dialog porg.'s control? 2012-04-12

    I want to run another dialog proram and I need send message to one of edit controls. I could get the dialog's handle and the ID of the edit control. I tried several ways, but I could'n get the handle of the edit control. My code is like this: HWND g_

  • How to get the handle to the view 2012-05-04

    how to get the handle to the view from a dialog box

  • How to get the handle of the activewindow? 2012-05-09

    Hi, Seems it is sample, but how can I do? I want to get the handle of currect activewindow.

  • How can I get the handle of a Ctrl which is having the focus? 2012-06-14

    Hi I am having the handle of a Dialog, How can I get the handle of a control which is having the keyboard focus in it? Siva Prakash. R

  • Get a handle? 2012-06-16

    If I launch a app with ShellexecuteEx(...), how to get the handle of launched window?