|
Thanks for the info. Not much of this type of information around
for grabs.
Best Regards.
|
|
|
|
|
I am looking for a good free mp3 playing dll or library,
thank you
|
|
|
|
|
There's the WMP control, or DirectX.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Not wmp control of directX again,didn't I describled clearly ?
I wann dll or library,anyway thank you very much.
|
|
|
|
|
suchuhui wrote: I wann dll or library,anyway thank you very much.
try http://www.un4seen.com/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
Hi!
I have a code downloaded (TreeListCtrl inherit from CListCtrl which supports treelist control in first column). It works fine except I need to put the (+/-) in subitems not in the first column (except the parent located in first column).
For further reference, please see my downloaded TreeListCtrl below (TreeListCtrl.cpp and TreeListCtrl.h):
*****************
/*
* Implementation of the TreeListCtrl
*
* Copyright (c)1999 David Carballo, All Right Reserved
*
* Created June 1999
* Revised: August 1999
* Written by David Carballo
* Internet: fibeto@redestb.es
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
* PARTICULAR PURPOSE.
*
*/
#include "stdafx.h"
#include "TreeListCtrl.h"
#include "resource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BEGIN_MESSAGE_MAP(CTreeListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CTreeListCtrl)
ON_NOTIFY_REFLECT(NM_CLICK, OnClick)
ON_WM_KEYDOWN()
ON_WM_CHAR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTreeListCtrl
CTreeListCtrl::CTreeListCtrl()
{
}
CTreeListCtrl::~CTreeListCtrl()
{
}
/////////////////////////////////////////////////////////////////////////////
// CTreeListCtrl overrides
void CTreeListCtrl::PreSubclassWindow()
{
// LVS_EX_GRIDLINES // 5.0: LVS_EX_LABELTIP
SetExtendedStyle(LVS_EX_FULLROWSELECT);
if (NULL == m_ilState.GetSafeHandle())
{
m_ilState.Create(IDB_STATE, 16, 1, RGB(255, 0, 0));
}
SetImageList(&m_ilState, LVSIL_STATE);
CListCtrl::PreSubclassWindow();
}
/////////////////////////////////////////////////////////////////////////////
// CTreeListCtrl operations
BOOL CTreeListCtrl::Create
(
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
UINT nID
)
{
if (!CListCtrl::Create(dwStyle, rect, pParentWnd, nID))
return FALSE;
// LVS_EX_GRIDLINES // 5.0: LVS_EX_LABELTIP
SetExtendedStyle(LVS_EX_FULLROWSELECT);
if (NULL == m_ilState.GetSafeHandle())
{
m_ilState.Create(IDB_STATE, 16, 1, RGB(255, 0, 0));
}
SetImageList(&m_ilState, LVSIL_STATE);
return TRUE;
}
int CTreeListCtrl::AddItem
(
LPCTSTR lpszItem,
int nImage,
int nLevel
)
{
LVITEM item;
tree_list_info info;
int nItem;
nItem = m_tree.size();
info.m_nLevel = nLevel;
info.m_nImage = nImage;
info.m_lstCols.resize(GetHeaderCtrl()->GetItemCount());
info.m_lstCols[0] = lpszItem;
info.m_bCollapsed = true;
m_tree.push_back(info);
item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_INDENT | LVIF_STATE | LVIF_PARAM;
item.iItem = nItem;
item.iSubItem = 0;
item.pszText = (LPTSTR)(LPCTSTR)info.m_lstCols[0];
item.iImage = info.m_nImage;
item.iIndent = info.m_nLevel;
item.state = INDEXTOSTATEIMAGEMASK(info.m_bCollapsed ? 1 : 2);
item.stateMask = LVIS_STATEIMAGEMASK;
item.lParam = nItem;
if (info.m_nLevel == 0)
{
CListCtrl::InsertItem(&item);
}
return nItem;
}
BOOL CTreeListCtrl::SetItemText
(
int nItem,
int nSubItem,
LPCTSTR lpszText
)
{
m_tree.at(nItem).m_lstCols[nSubItem] = lpszText;
return CListCtrl::SetItemText(nItem, nSubItem, lpszText);
}
/////////////////////////////////////////////////////////////////////////////
// CTreeListCtrl protected functions
int CTreeListCtrl::InsertItem
(
int nItem,
int nPosArray,
tree_list_info& info
)
{
LVITEM item;
item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_INDENT | LVIF_STATE | LVIF_PARAM;
item.iItem = nItem;
item.iSubItem = 0;
item.pszText = (LPTSTR)(LPCTSTR)info.m_lstCols[0];
item.iImage = info.m_nImage;
item.iIndent = info.m_nLevel;
item.state = INDEXTOSTATEIMAGEMASK(info.m_bCollapsed ? 1 : 2);
item.stateMask = LVIS_STATEIMAGEMASK;
item.lParam = nPosArray;
int nItemRes = CListCtrl::InsertItem(&item);
for (int i = 1; i < info.m_lstCols.size(); i++)
{
CListCtrl::SetItemText(nItemRes, i, info.m_lstCols[i]);
}
return nItemRes;
}
BOOL CTreeListCtrl::DeleteAllItems()
{
m_tree.clear();
return CListCtrl::DeleteAllItems();
}
void CTreeListCtrl::Collapse
(
int nPos,
int nItem
)
{
int nLevel;
int nLast;
LVITEM item;
tree_list_info& info = m_tree[nPos];
info.m_bCollapsed = true;
SetRedraw(0);
nLevel = info.m_nLevel;
nLast = GetItemCount();
item.mask = LVIF_PARAM;
item.iSubItem = 0;
int nCounter = nItem + 1;
if (nCounter < nLast)
{
do
{
item.iItem = nCounter;
GetItem(&item);
if (m_tree[item.lParam].m_nLevel > nLevel)
DeleteItem(nItem + 1);
}
while (m_tree[item.lParam].m_nLevel > nLevel && GetItemCount() > nCounter);
}
SetRedraw(1);
}
int CTreeListCtrl::Expand
(
int nItem,
bool bRecursive,
int& nCounterInsert
)
{
tree_list_info& info = m_tree[nItem];
info.m_bCollapsed = false;
int nCounter;
int nLevel;
nCounter = nItem + 1;
nCounterInsert = nCounterInsert + 1;
nLevel = info.m_nLevel;
while (nCounter < m_tree.size() && m_tree[nCounter].m_nLevel > nLevel)
{
if (m_tree[nCounter].m_nLevel > nLevel)
{
if (bRecursive)
{
m_tree[nCounter].m_bCollapsed = false;
}
InsertItem(nCounterInsert, nCounter, m_tree[nCounter]);
}
if (bRecursive || !m_tree[nCounter].m_bCollapsed)
{
nCounter = Expand(nCounter, bRecursive, nCounterInsert);
}
else
{
int nSonLevel;
nSonLevel = m_tree[nCounter].m_nLevel;
while (++nCounter < m_tree.size() && m_tree[nCounter].m_nLevel > nSonLevel)
{
}
nCounterInsert++;
}
}
return nCounter;
}
/////////////////////////////////////////////////////////////////////////////
// CTreeListCtrl message handlers
void CTreeListCtrl::OnClick
(
NMHDR* pNMHDR,
LRESULT* pResult
)
{
LPNMITEMACTIVATE pItemActivate = (LPNMITEMACTIVATE)pNMHDR;
CRect rect;
GetItemRect(pItemActivate->iItem, rect, LVIR_ICON);
if (pItemActivate->ptAction.x < rect.left)
{
LVITEM item;
item.mask = LVIF_INDENT | LVIF_PARAM;
item.iItem = pItemActivate->iItem;
item.iSubItem = 0;
GetItem(&item);
if (pItemActivate->ptAction.x > item.iIndent * 16)
{
if (m_tree[item.lParam].m_bCollapsed)
{
int nInsert = pItemActivate->iItem;
SetRedraw(0);
Expand(item.lParam, false, nInsert);
SetRedraw(1);
SetItemState(pItemActivate->iItem, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK);
}
else
{
SetRedraw(0);
Collapse(item.lParam, pItemActivate->iItem);
SetRedraw(1);
SetItemState(pItemActivate->iItem, INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK);
}
}
}
*pResult = 0;
}
void CTreeListCtrl::OnKeyDown
(
UINT nChar,
UINT nRepCnt,
UINT nFlags
)
{
int nItem = GetNextItem(-1, LVNI_SELECTED);
if (nItem == -1)
{
CListCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
return;
}
LVITEM item;
item.mask = LVIF_INDENT | LVIF_PARAM;
item.iItem = nItem;
item.iSubItem = 0;
GetItem(&item);
switch (nChar)
{
case VK_ADD:
if (m_tree[item.lParam].m_bCollapsed)
{
int nInsert = nItem;
SetRedraw(0);
Expand(item.lParam, false, nInsert);
SetRedraw(1);
SetItemState(nItem, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK);
}
break;
case VK_SUBTRACT:
if (!m_tree[item.lParam].m_bCollapsed)
{
SetRedraw(0);
Collapse(item.lParam, nItem);
SetRedraw(1);
SetItemState(nItem, INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK);
}
break;
case VK_RIGHT:
if (m_tree[item.lParam].m_bCollapsed)
{
int nInsert = nItem;
SetRedraw(0);
Expand(item.lParam, false, nInsert);
SetRedraw(1);
SetItemState(nItem, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK);
}
else
{
// If any child, move to the first one
int nNextItem = item.lParam + 1;
if (nNextItem < m_tree.size() && m_tree[nNextItem].m_nLevel > m_tree[item.lParam].m_nLevel)
{
SetItemState(nItem + 1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
}
break;
case VK_LEFT:
if (!m_tree[item.lParam].m_bCollapsed)
{
SetRedraw(0);
Collapse(item.lParam, nItem);
SetRedraw(1);
SetItemState(nItem, INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK);
}
else
{
// Move to our parent
int nPrevItem = item.lParam - 1;
int nLevel = m_tree[item.lParam].m_nLevel;
while (nPrevItem >= 0 && nLevel <= m_tree[nPrevItem].m_nLevel)
{
--nPrevItem;
}
if (nPrevItem >= 0)
{
LVFINDINFO info;
info.flags = LVFI_PARAM;
info.lParam = nPrevItem;
SetItemState(FindItem(&info), LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
}
break;
default:
CListCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
break;
}
}
void CTreeListCtrl::OnChar
(
UINT nChar,
UINT nRepCnt,
UINT nFlags
)
{
int nItem = GetNextItem(-1, LVNI_SELECTED);
if (nItem != -1)
{
LVITEM item;
item.mask = LVIF_INDENT | LVIF_PARAM;
item.iItem = nItem;
item.iSubItem = 0;
GetItem(&item);
if (nChar == '*')
{
// TODO: Recursively expands items
if (m_tree[item.lParam].m_bCollapsed)
{
int nInsert = nItem;
SetRedraw(0);
Expand(item.lParam, true, nInsert);
SetRedraw(1);
SetItemState(nItem, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK);
}
}
}
CListCtrl::OnChar(nChar, nRepCnt, nFlags);
}
|
|
|
|
|
I want to write a player that can play .vob file. Since the file has multiple language track, 0x80 and 0x81, etc. How do I render it to play 0x81 track? When the file is render in graphedit, it does not how different pins for different tracks. Is there some other method I have to do?
Thanks.
|
|
|
|
|
Source code:
CDOcument* pDoc=GetDocument();
CView *pCurrView=GetActiveView();
CView * pNewView;
if(m_nCurrentView == 0)
{
pNewView=(CView*)new CUNL_SignleView;
m_nCurrentView = 1;
}
else
{
pNewView=(CView*)new CUNL_EdView;
m_nCurrentView = 0;
}
pNewView->Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,rectDefault, this,AFX_IDW_PANE_FIRST,NULL);
pNewView->OnInitialUpdate();
pNewView->ShowWindow(SW_SHOW);
pView->ShowWindow(SW_HIDE);
pDoc->AddView(pNewView);
pDoc->RemoveView(pCurrView);
SetActiveView(pNewView);
RecalcLayout();
============================================================================]CMainFrame *pMain=(CMainFrame*)AfxGetApp()->m_pMainWnd;
CView *pView=(CHtmlViewEx*)pMain->GetActiveView();
CView * pDemoListView;
pDemoListView=(CView*)new CUNL_SignleView;
pDemoListView->Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,rectDefault, this,AFX_IDW_PANE_FIRST,NULL);
pDemoListView->OnInitialUpdate();
pDemoListView->ShowWindow(SW_SHOW);
pView->ShowWindow(SW_HIDE);
CMainFrame->AddView(pDemoListView);
CMainFrame->RemoveView(pView);
SetActiveView(pDemoListView);
RecalcLayout();
I change:
CDOcument* pDoc=GetDocument();
CView *pCurrView=GetActiveView();
To:
CMainFrame *pMain=(CMainFrame*)AfxGetApp()->m_pMainWnd;
CView *pView=(CHtmlViewEx*)pMain->GetActiveView();
I change:
pDoc->AddView(pNewView);
pDoc->RemoveView(pCurrView);
To:
CMainFrame->AddView(pDemoListView);
CMainFrame->RemoveView(pView);
I want to put the above code to the OnTreeDblClk() to implement when doulbe click the sub-item of the left tree,the CDemoListView will be showed on the right column.
But the initializtion of the left column and right column are:
CDemoTreeView and CHtmlViewEx.
There is not CDemoDoc in my program,There are only CMaiFrame and CSplitter(splitted window)
Is the above code possible to chage to adapt the implememtation I need?
I don't know what the CUNL_SignleView is and it's undefined.
when I compile the code,it said that the rectDefault,SetActiveView,RecalcLayout are undefiend.
Thanks for all senior programmer to read my post.
chuntse
|
|
|
|
|
Hi,
Thanks in advance for your help. In summary, what I'm trying to do is allow my application to be invoked from a browser with one of my registered filetypes without having to prompt the user to open the application.
I have an application that is intended to be called from a browser instance most of the time. Currently, my app makes registry entries that log the filetype and mimetype, and IE brings up a requster suggesting my application for the file, along with a checkbox allowing the user to automatically open my application when such a file is called.
I want to bypass this box as users find it confusing. Since it says open/save, sometimes they think they have to say "save" because the application will end up downloading a file to their computer. They'd just like that bypassed.
I tried thinking that perhaps I could just use javascript on the website to send the information to my application via COM, but I believe that the problem with that is SP2 security warnings will bring up user warnings using this, which defeats the purpose.
So, my first question is, does anyone know a way to override that requester and just train IE to call my application directly?
I know in firefox there is a file called downloads.rdf in which this information is ultimately stored -- so in the case of firefox I could theortically just write the entry to downloads.rdf myself. Is there a place where IE stores this information, for example, in the registry perhaps? That way, I could just write to that place in the registry during install and avoid this problem?
Or, perhaps there's another way to do it?
|
|
|
|
|
|
timothymfox wrote: Currently, my app makes registry entries that log the filetype and mimetype...
What registry keys/values have you changed?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
RIght now, the only registry keys are both done through the setup project in Visual Studio -- adding an association for my app's file extension in HKEY_CLASSES_ROOT, and the other one being the MimeType in the Content Types keys (HKEY_LOCAL_MACHINE/CLASSES/MIME/DATABASE/CONTENT TYPE/)
However, none of these registry entries are sufficient to automatically send the file type from Internet Explorer to my app -- currently that has to be done by the user, which is what I'm trying to change.
|
|
|
|
|
At a minimum, here are the registry keys/values you'll need. This example, timfox.exe, uses files with a .fox extension.
HKEY_CLASSES_ROOT\.fox = TimFox.Document
HKEY_CLASSES_ROOT\TimFox.Document\shell\open\command = TimFox.EXE %1
HKEY_CLASSES_ROOT\TimFox.Document\shell\open\ddeexec = [open("%1")]
HKEY_CLASSES_ROOT\TimFox.Document\shell\open\ddeexec\application = TIMFOX
; note: the application is optional
; (it defaults to the app name in "command")
HKEY_CLASSES_ROOT\TimFox.Document = TimFox Document
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi,
I have a simple dialog box that has an edit control. I want the dialog box to come up with the cursor in the edit box ready for input. I can do this using myDialog::UpdateDialogControls(pWndCtrl, TRUE) but then the focus is locked on the edit control and I can't use the OK or CANCEL buttons and I have to use the task manager to end the application. I have also tried the GotoCtrl(pWndCtrl) with UpdateData() and UpdateWindow() and some other variations that seemed like they might work but they have no effect at all. This is probably very simple, I just can't seem to figure out the right command sequence.
Buck
|
|
|
|
|
There should be a SetFocus() function you can use.
Danny
The stupidity of others amazes me!
|
|
|
|
|
BuckBrown wrote: I want the dialog box to come up with the cursor in the edit box ready for input.
The first control on the dialog that has an id other than IDC_STATIC will automatically get the initial focus. Otherwise, you'll need to call SetFocus() . If you opt for this, be sure and return FALSE from OnInitDialog() .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Sorry, or SET SEL.
Danny
The stupidity of others amazes me!
|
|
|
|
|
Set the edit control to be the first item in the tab order (Crtl-D in VC6)
|
|
|
|
|
Thanks,
Although it would seem that GotodlgCtrl(pEditCtrl) followed by SetFocus() should do the trick it doesn't. It needs to be in the syntax of GotoDlgCtrl(pEditCtrl->SetFocus());
|
|
|
|
|
How to create icon in the tab controls tab?
Can anyone help me how to create the icon in the tab controls tab.
I mean I would like to add icon for the Tab controls tab beside the label. Is that possiable?
Nice talking to you.
|
|
|
|
|
Hi,
Check this[^]
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
I've read a lot that to make your window non-resizable that you need to remove the WS_THICKFRAME style, but I can't find here on Code Project, or MSDN, really how to do that. Can someone help me out?
Danny
The stupidity of others amazes me!
|
|
|
|
|
CAll GetWindowStyle() to retreive the style for the window.
Then mask out the WS_THICKFRAME ( style = style & ~WS_THICKFRAME );
Then set the windows style with the new style mask using SetWindowStyle().
THen call SetWindowPos(hwnd_, NULL,0,0,0,0, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE);
This will cause the window to be updated properly so that the style change is reflected visually.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
bugDanny wrote: Can someone help me out?
Try:
BOOL CMainFrame::PreCreateWindow( CREATESTRUCT &cs )
{
if (! CFrameWnd::PreCreateWindow(cs))
return FALSE;
cs.style &= ~WS_THICKFRAME;
return TRUE;
}
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|