|
|
thank you very much .
|
|
|
|
|
I want to use ms word as a doc viewer,and incapacitate it's most function,such as "save as","copy","paste".
I have not idea about this.Is that a comparative easy method can achieve my goal??
lost my way
|
|
|
|
|
Microsoft also distributes a word document "viewer" for people who do not have Word.
It may be able to be controlled via COM/OLE just like Word can.
|
|
|
|
|
Where can I get the doc viewer?
Is that a activex?
lost my way
|
|
|
|
|
|
Hi,
I'm attempting to add some Windows Explorer style functionality to my archiving program, which is dialog-based and uses the straight Windows API with _no_ MFC. So far I have created a tree view and a list view with a splitter between them. However, I am having problems in finding any decent information on how to implement full drag and drop functionality *without* using MFC. I found the following two excellent articles on tree views and list views using Win32:
http://www.codeproject.com/useritems/TreeView.asp
http://www.codeproject.com/useritems/ListView.asp
The Tree view article covers the rudiments of dragging and dropping, so that I am able to create a drag image and drag one directory onto another. The TVN_BEGINDRAG and WM_MOUSEMOVE sections of the code work great. However, what the article doesn't cover in the WM_LBUTTONUP section is the code required actually to move the dragged directory into the selected directory (my tree view items are directories). This is the code I have in the WM_LBUTTONUP function so far:
<br />
case WM_LBUTTONUP:<br />
{<br />
if (Dragging) <br />
{<br />
ImageList_DragLeave(hTree);<br />
ImageList_EndDrag();<br />
ReleaseCapture();<br />
ShowCursor(TRUE); <br />
Dragging = FALSE;<br />
<br />
<br />
}<br />
}<br />
I have found some MFC code at http://www.codeguru.com/treeview/drag_drop.shtml that seems to do what I want, but I don't know how to convert it into non-MFC, simple Win32 API code. The section that I need to convert from MFC and insert into the above code is this:
<br />
SelectDropTarget(NULL);<br />
if( m_hitemDrag == m_hitemDrop )<br />
return;<br />
<br />
HTREEITEM htiParent = m_hitemDrop;<br />
while( (htiParent = GetParentItem( htiParent )) != NULL )<br />
{<br />
if( htiParent == m_hitemDrag ) return;<br />
}<br />
<br />
Expand( m_hitemDrop, TVE_EXPAND ) ;<br />
<br />
HTREEITEM htiNew = CopyBranch( m_hitemDrag, m_hitemDrop, TVI_LAST );<br />
DeleteItem(m_hitemDrag);<br />
SelectItem( htiNew );<br />
In particular, I have no idea what the equivalents of GetParentItem() and CopyBranch() are in Win32... Can anybody please help me convert this so that I can get drag-and-drop functionality between treeview items in my app?
Also, if anyone knows where I can find a good tutorial/example on how to drag and drop between a list view and a tree view using _no_ MFC, I would be very grateful, as that will be my next problem after sorting this out...
Any help would be much appreciated,
Many thanks,
KB
|
|
|
|
|
It sounds like you want to make your job a lot harder by not using MFC. Hopefully you have a very good reason for this.
GetParentItem() is:
_AFXCMN_INLINE HTREEITEM CTreeCtrl::GetParentItem(HTREEITEM hItem) const
{ ASSERT(::IsWindow(m_hWnd)); return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); }
If you have the MFC Source it is very easy to find this out.
I can't find CopyBranch() - are you sure this isn't a function in the example program.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Kayembi wrote:
I have no idea what the equivalents of GetParentItem() and CopyBranch()
GetParentItem() --> TreeView_GetParent() macro or TVM_GETNEXTITEM with the TVGN_PARENT flag. The macro is the simpler way though.
CopyBranch() is not an MFC function. It's a function that was written for that code. You'll have to look at the source code for it to work out how to convert it.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thank you both for the replies, much appreciated.
The only reason I'm not using MFC is that as a relative coding novice, I haven't really touched it yet - I need to buy a book on it and dive in soon, I know.
Also, the rest of my program has been written without MFC, as it started off as a fairly straightforward dialog app a year or so ago. Now that I'm updating it, though, it's getting a lot more complicated, but I'm reluctant to rewrite the whole thing in MFC because of my inexperience and the amount of time this would take (re-learning how to do everything I've already coded + coding it).
Many thanks again for the help!
Cheers,
KB
|
|
|
|
|
no I'm not referring to linux here, but CTreeCtrl. I'm using it for parsing an XML document. A class is doing all the parsing (this makes it easier to maniage and more OO) and its returning a CTreeCtrl * (thats the only way i could return a CTreeCtrl) how do I get the resourcec that is mapped to m_ctrlXMLTree to use the contents that the function returns.
Heres the source:
CParseDocument m_clsParse;
m_ctrlXMLTree=m_clsParse.BeginParseDocument(m_strContents);
and it complains:
C:\Documents and Settings\Steven Hicks\My Documents\Visual Studio Projects\DueLastWeek\SlidingOpen.cpp(108) : error C2582: 'CTreeCtrl' : 'operator =' function is unavailable
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Are you trying to receive a CTreeCtrl object or a pointer or reference? If it's the former, I doubt that'll work as the error message seems to indicate that the CTreeCtrl doesn't have a copy constructor. The function you're referring to probably returns a reference.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
the function is the following:
CTreeCtrl& CParseDocument::BeginParseDocument(CString &m_strContents)
and its still throwing that error.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
As I was alluding to, it returns a reference and you're trying to have it return to you an object. For example, the following would work:
<br />
CTreeCtrl& Gimme()<br />
{<br />
CTreeCtrl* t = new CTreeCtrl();<br />
return (CTreeCtrl&)t;<br />
}<br />
<br />
void Test()<br />
{<br />
CTreeCtrl& t = Gimme();<br />
}<br />
However, the following results in the error you mentioned:
<br />
void Test()<br />
{<br />
CTreeCtrl t;<br />
t = Gimme();<br />
}<br />
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
In a nutshell, the function you're calling is allocating a CTreeCtrl object and wants to pass you back a reference to it. However, you have your own CTreeCtrl object and want to - in effect - have the returned object copied into yours. You can't do that because the CTreeCtrl class doesn't define a copy constructor.
You have three choices.
1) Derive your own CTreeCtrl class and implement a copy constructor
2) Change the BeginParseDocument function
3) Change your application to accept a returned reference
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
(Steven Hicks)n+1 wrote:
C:\Documents and Settings\Steven Hicks\My Documents\Visual Studio Projects\DueLastWeek\SlidingOpen.cpp(108) : error C2582: 'CTreeCtrl' : 'operator =' function is unavailable
Tom's right. Your function is returning a CTreeCtrl& - you need to return a CTreeCtrl*
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hi,
In my SDI application I want to use a splitter window and on the left side I want to use a Tree View and on the right side I want to have Form View and for different selection on the items of the Tree View, I want to show different Forms on the right view. How can I achieve this? Can anybody help me out with pointers on the above?
Thanks,
Binayak
|
|
|
|
|
I have the following code concerning loading GDI+ Bitmap (PNG actually) of length len from buffer buf :
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, len);<br />
void *buf = hGlobal ? GlobalLock(hGlobal) : NULL;<br />
if(buf) CopyMemory(buf, CBaseItem::BFFile->Buf, len);<br />
else if(hGlobal) GlobalFree(hGlobal);<br />
<br />
IStream* stream = NULL;<br />
if(buf && CreateStreamOnHGlobal(buf, TRUE, &stream) == S_OK)<br />
{<br />
image = Bitmap::FromStream(stream);<br />
stream->Release();<br />
}
It works perfectly on XP, but it fails under Windows Millenium: image->LastResult == InvalidParameter . The data in a buffer seems the same in both cases.
Why is it so?
Regards,
BB
|
|
|
|
|
How do you extract an image from a wmv file? Any samples or possible ideas, i have looked at the windows media format sdk, but its not too easy to understand
Any help would be a real life saver!
|
|
|
|
|
the function OleLoadPicture could do what you're searching for, coupled with a IPicture interface. Have a look to the sample 218972[^] from MSDN.
HTH,
K.
|
|
|
|
|
Is there any way that I using code can add and remove users on Windows 2000 Server.
|
|
|
|
|
Have a look at the Active Directory doc on MSDN, specifically the samples for creating a user [^].
Brad
|
|
|
|
|
NetUserAdd worked for me.
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
Hi, need help!!
Does anybody know how to grab the data stream that goes to
the graphics card from windows and then on to a projector for example, or even how this works????
I presume that the data stream is going to come from the
windows desktop through win32.
Any ideas or links greatly appreciated!!
Cheers,
/Shane.
|
|
|
|
|
This can not be done easily. Use a projector that has a vga input. If you are using a laptop it should have a vga connector and you should be able to use both on, or either on. Their should be a keyboard command for that.
John
|
|
|
|