|
How can I get a reference to the Doc class instance
in the CMainFrame being part of a SDI project ?
Thanks a lot!
|
|
|
|
|
Check out GetActiveDocument [^] method.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Another possibility to what CPallini told you is to do the following.
Declare a CMyDoc variable in the StdAfx.h as extern. Then in the InitialUpdate of your view, use the GetDocument and assign it to that extern pointer/variable. Then you will be able to use it in every place on your programm.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi all,
Please tell me how can i create a report in VC++ 2005, i m using SDI type of application,and for Database i m using MS-Access.
Use table for ftch record and then the record is use for report generation.
Please tell me example an in detail.
After this how can i print this report.
Please help me for this.
I m waiting for your valuable suggestions.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi
I want to get mouse move or click event on Internet Explorer ,
Through that I can get selected text form Internet Explorer .
Thanks in advance.
dabara
|
|
|
|
|
You need a Browser Helper Object (BHO). There is a fine sample in the MSDN.
It is COM and Unicode, so it gets tricky at some point.
Greetings from Germany
|
|
|
|
|
Hi
I allready used BHO on my project but I am not getting any mouse click event on Internet Explorer .
I suppose on Invoke() function , I can get Mouse Event but not getting mouse event over there.
I used DISPID_MOUSEMOVE but fail to get Mouse Event.
dabara
|
|
|
|
|
Did you look for "There is a fine sample in the MSDN." ???
Greetings from Germany
|
|
|
|
|
I used This code for get the Text from Internet Explorer . Use IHTMLDocument::OnClick() and IHTMLDocument::MouseUp() Message for Mouse Event . I used Popupblocker code for Implementing my application . But On Some pages like http://search.webdunia.com and hindi.webdunia.com
On That pages I am not able to get Invoke function So I am not getting Text So pls help me out To resolve me problem. in OnDocEventHandler Function.
IHTMLDocument2 * pDoc;
m_pBrowser->get_Document((IDispatch**)&pDoc);
CComQIPtr<IHTMLSelectionObject> pSel;
CComQIPtr<IHTMLTxtRange> pRange;
HRESULT hr = pDoc->get_selection( & pSel );
if (hr || (!pSel) )
return E_FAIL;
hr = pSel->createRange((IDispatch **)&pRange);
if (hr || (!pRange))
return E_FAIL;
CComBSTR bstrText;
pRange->get_text(&bstrText);
dabara
|
|
|
|
|
I want to do the following:
1. use Image/Bitmap to load a image file
2. decorate it, for example, put another small image on it
3. when save, overwrite the original one using the decorated one
The problem is that, when save the file format should keep the same, how to solve the problem?
I find it is even hard to get the file type (eg. gif, jpeg , tiff...) via an Image/Bitmap object.
|
|
|
|
|
|
Hi all,
I am wondering if there is a way to use FaceID icon to a dialog box?
I tried to do the following in my dialog's OnInitDialog() :
HICON hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(540));
this->SetIcon(hIcon, FALSE);
"540" is FaceID number of a commandbar button icon. Apparently it did not work as the ID did not point to the wanted resource in the dialog project.
Any help would be really great. Thanks!
|
|
|
|
|
J.B. wrote: Apparently it did not work...
What does LoadIcon() return? Have you tried making hIcon a member variable instead?
What happens if you use:
hIcon = AfxGetApp()->LoadIcon(540);
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Dear DavidCrow,
Thanks for the reply. LoadIcon() returns NULL . I should give more details about my project. The dialog is ATL-based class which is to be brought up via DoModal() . A window-based parent may decide to bring up the dialog at any time. Since the dialog is ATL based (derived from CAxDialogImpl class). The way I use to call LoadIcon in the dialog's OnInitDialog() is in fact:
HICON hIcon = LoadIcon((HINSTANCE)GetModuleHandle(NULL), MAKEINRESOURCE(540));
if (NULL != hIcon)
this->SetIcon(hIcon);
I get hIcon is NULL in return. Am I doing something incorrectly here?
Thanks!
|
|
|
|
|
J.B. wrote: Am I doing something incorrectly here?
Are you calling GetLastError() to find out why?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes, the return code is 1813 (The specified resource type cannot be found in the image file ).
Perhaps the resource just isn't available for access without explicitly loading from the actual resource DLL?
Thanks for the help anyway
|
|
|
|
|
J.B. wrote: Perhaps the resource just isn't available for access without explicitly loading from the actual resource DLL?
Where else would it come from?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
That's exactly right. I naively thought it is as that's what I was able to do with Visual Studio Automation and Extensibility methods. I simply looked up the face ID and specified it in a method, say AddCommandBar2() (Commands ojbect, EnvDTE namespace). And the icon I picked would appear accordingly. I initially hoped the FaceID resource is somehow accessible globally.
This is embarassing Thanks for the help to clearing this out
Reference:
FaceID Browser[^]
|
|
|
|
|
Hi,
How can I appear the default context menu and property in my application?
|
|
|
|
|
create popup menu and associate with right click event, search CP for Popmenu, theer N number article present dealing with it.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
Hi alreay have a context menu in my application but I want the windows context menu as I click on my menu item.
|
|
|
|
|
This is hopefully a basic question but it's been a VERY long time since I used C++ and I just need to know how I can get a file extension from a path and compare to constant extension.
I have an input:
LPCWSTR pwszPath
and a constant:
WCHAR MY_EXT[4] = L".me";
I need to know if pwszPath ends with MY_EXT but I can't think how to do it..
Any help would be great!
|
|
|
|
|
__DanC__ wrote: I need to know if pwszPath ends with MY_EXT but I can't think how to do it..
Use PathFindExtension .
Matching extension will somewhat look like this...
bool MatchExtension( LPCTSTR lpctszMyPath, LPCTSTR lpctszChkExt )
{
ASSERT( lpctszMyPath && lpctszChkExt );
LPCTSTR lpctszExt = PathFindExtension( lpctszMyPath );
return ( lpctszExt && _tcscmpi( lpctszExt + 1, lpctszChkExt ) == 0 );
}
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
modified on Wednesday, July 2, 2008 5:06 AM
|
|
|
|
|
That was exactly what I was looking for! Thanks!
|
|
|
|
|
__DanC__ wrote: That was exactly what I was looking for! Thanks!
I've modified my reply a bit.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|