|
Can someone give me some guide on how to drag and drop file and folder on a TreeView.
I don't use MFC.
|
|
|
|
|
Hi,
How to change to text color and the background color of a combo box
|
|
|
|
|
You must set the color for the combobox, if the control send a Color-message.
HBRUSH CxxxView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
if ( pWnd->GetDlgCtrlID()==IDC_Status)
{
pDC->SetBkColor(SetColorRef(background)); //SetColorRef returns a RGB-value
hbr=m_hBrush[background]; //global defined brush-table
}
return hbr;
}
SFr
|
|
|
|
|
Is there any fast way to convert an MFC application into an ActiveX control or Com object?
|
|
|
|
|
Hi :
Not sure about what specifically you are asking for. Because it depends upon your app architecture.
Let me assume you are talking about a simple Dlg based Exe than Just Insert a new ATL object in it with all the default settings and here you go. Note that your app main thread can now be an owner of a COM object . Simply call CoCreateInstanceEx() from your client code and your COM object will be instantiated..
Anyway for your information.
Any object inherited from IUnknown is called a COM object and a COM object which is self registering is called an ActiveX control (simple is that)
|
|
|
|
|
thanks!
what I am trying to do is to move an existing document/view architecture MFC app into a form whereby it could be placed on an IE browser and do the same stuff...essentially, I have an existing MFC exe and I want to create an ActiveX out of it so it could be embedded into an html page and do the same stuff?
thanks
|
|
|
|
|
Hi, I am trying to display a bitmap in a SDI applicationg and for some reason it wont display the bitmap. Here is the code I am using. Any suggestions would be greatly appreciated.
CStatic myStatic;
myStatic.Create(_T("My Static"),
WS_CHILD|WS_VISIBLE|SS_BITMAP,
CRect(10,10,100+505,100+435),
this);
myStatic.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP1)) );
Thanks for the help.
|
|
|
|
|
hInstance parameter (first one) from LoadBitmap should
be the instance of the module that contains the bitmap . In your case your application. You can use it as NULL only for predefined bitmaps like OBM_CLOSE.
Regrads,
/REMUS
|
|
|
|
|
Hi!
When I have built my program and executes the exec file my program looks for a database file I have connected to my program. The problem here is that the path to the file is hard coded so it looks for it in a certain location on the HD. What I want to do is charnge where it looks for the database. But I don't know how to get a string of the executive file. Is there any function that can get the execution path of this file?
I have found in the database file where it returns this path. I want to change it so that it gets the location where the .exe file is run.
Thank you for reading, (or even more importantly responding!
|
|
|
|
|
Here's three functions I use for getting the program path.
JustPath() - extracts the path from a string containing a filename.
AddBackSlash() - adds a backslash to the end of a string if it's needed.
GetProgramPath() gets the path and module filename of the running program (calls JustPath and AddBackSlash).
//------------------------------------------------------------------------------
Returns just the path if present of the specified filename string.
//------------------------------------------------------------------------------
CString JustPath(LPCSTR f)
{
char drive[_MAX_DRIVE],
dir[_MAX_DIR],
file[_MAX_FNAME],
ext[_MAX_EXT];
CString st;
_splitpath((char *)f, drive, dir, file, ext);
st = drive;
st += dir;
return st;
}
//----------------------------------------------------------------------------/
// Add a back slash to the end of the path if it doesn't exist.
//----------------------------------------------------------------------------/
void AddBackSlash(CString& path)
{
int length = path.GetLength();
if (length > 1)
{
if (path.GetAt(length - 1) != '\\')
{
path += "\\";
}
}
else if (1 == length)
{
CString temp = path;
temp.MakeUpper();
TCHAR ch = temp.GetAt(0);
if (ch >= 'A' && ch <= 'Z')
{
path += ":\\";
}
else if (ch != '\\') // add a back slash anyway
{
path += "\\";
}
}
else
{
path += "\\";
}
}
//-----------------------------------------------------------------------------/
// Get the path were the program was run from
//-----------------------------------------------------------------------------/
CString GetProgramPath(BOOL bStripFileName/*=TRUE*/)
{
CString sPath;
TCHAR szFullPath[MAX_PATH];
::GetModuleFileName(NULL, szFullPath, MAX_PATH);
if (bStripFileName)
{
sPath = JustPath(szFullPath);
AddBackSlash(sPath);
}
return sPath;
}
|
|
|
|
|
|
I am a jackeroo in WinCE and need you help very imminently!
my develop environment:
vc6.0 + WinCE toolkit for VC6.0
the configuration in my project
"H/PC Ver.2.00"
my target device:
cpu: MIPS
os: WinCE 2.11
Is there some problem in compatibility and what should I do?
Thanks a lot!
|
|
|
|
|
Are there any methods to implement a drag source on an application if it is not previously implemented? e.g. If IE does not support dragging an image, is it possible to implement it?
|
|
|
|
|
Hello,
Im trying to map a message from a range of
combo boxes controls to a single Message handler.
But, this is a CBN_EDITCHANGE message, which is not
a notification message (WM_NOTIFY format), so I
dont think I can use the macro ON_NOTIFY_RANGE (its not
working anyway). So, my questions are:
1.Is it possible to map this range of messages with
ON_NOTIFY_RANGE ?
2.If not, how do u map a range of messages that are in
a WM_COMMAND format to a single handler ?
THANK YOU,
Ariel
|
|
|
|
|
Hi Ariel,
you can the ON_CONTROL_RANGE macro in your case.
HTH
Martin
|
|
|
|
|
Hi
I have one small problem. In my code
i am posting onemessage using
PostMessage( WM_APP+n, int)
Handling this messge in some other function.
Problem is: buttons does not always react to quick clicks.
Can anybody tell me the reason why it is happening??
-- Thanks,
Koteswara
|
|
|
|
|
My create the CImageList object use bitmap.
How to let my bitmap in the CImageList object to be transparentize?
|
|
|
|
|
I figured out how to get my program to use dao360.dll and it can now open my access2000 database.
Now I am getting CString memory leaks during data exchange. Do I need to be in Unicode? Anyone else have this problem?
Thanks
|
|
|
|
|
VC++ 6.0
Win98 (MSIE 4.01), or WinNT4/SP5 (MSIE 5.0)
I'm trying to use an imagelist (attached to a CListCtrl) containing
icons.
// defined as
CImageList m_imageList;
// in the constructor, I have this code
CMyDialog::CMyDialog()
{
...
m_imageList.Create(16, 16, ILC_COLOR16, 0, 11);
m_imageList.SetBkColor(::GetSysColor(COLOR_WINDOW));
...
}
// in OnInitDialog()
BOOL CMyDialog::OnInitDialog()
{
...
m_ctrlList.SetImageList(&m_imageList, LVSIL_SMALL);
m_ctrlList.InsertColumn(0, "Application", LVCFMT_CENTER, 200);
m_ctrlList.InsertColumn(1, "Started", LVCFMT_CENTER, 120);
m_ctrlList.InsertColumn(2, "Msgs", LVCFMT_CENTER, 60 );
m_ctrlList.InsertColumn(3, "Last Recieved", LVCFMT_CENTER, 120);
...
}
When I add a list item, this code is executed whan an item is added to
the list control:
void CMyDialog::AddItem(HICON hIcon)
{
int nIndex = m_imageList.Add(hIcon);
LVITEM lvi;
lvi.mask = LVIF_IMAGE | LVIF_TEXT;
lvi.iImage = nIndex;
lvi.iItem = nIndex;
lvi.iSubItem = 0;
lvi.pszText = "Name";
m_ctrlList.SetItem(&lvi);
m_ctrlList.InsertItem(&lvi);
lvi.iSubItem = 1;
lvi.pszText = "01/01/2000";
m_ctrlList.SetItem(&lvi);
lvi.iSubItem = 2;
lvi.pszText = "0";
m_ctrlList.SetItem(&lvi);
lvi.iSubItem = 3;
lvi.pszText = "01/01/2000";
m_ctrlList.SetItem(&lvi);
}
Up to this point, everything works fine in both release and debug mode.
When I delete an item in the list control, this code is executed:
void CMyDlg::DeleteListCtrlItem(int nIndex)
{
int nCount = m_ctrlList.GetItemCount();
if (nIndex < nCount)
{
// remove the list ctrl item
m_ctrlList.DeleteItem(nIndex);
// remove the image from the imagelist
m_imageList.Remove(nIndex);
// decrement the item count
nCount--;
// start at the first item and reset the images
for (int i = 0; i < nCount; i++)
{
LVITEM lvi;
lvi.mask = LVIF_IMAGE;
lvi.iItem = i;
lvi.iImage = i;
m_ctrlList.SetItem(&lvi);
m_ctrlList.Update(i);
}
}
}
In debug mode, this works fine. In release mode, I don't get an image in
the list control. If there's an unitialized variable somewhere, it's
just got to be in the either CListCtrl or CImageList. I've used message
boxes to verify that the nIndex and nCount variables are within the
expected range, and I've tried a number of things as workarounds,
including:
- shuffling the images in the imagelist down one spot and removing the
last item.
- shuffling the images in the imagelist down one spot and using
SetImageCount() to reset the number of images.
- creating a CArray of HICONs and extracting the remaining icons from
the imag list, setting the imagecount to 0 and then re-adding the icons
If anyone has any ideas or sees something blatantly wrong with my code,
I'd appreciate hearing about it.
Many thanks in advance.
|
|
|
|
|
John,
Since you had an uninitialized local in DeleteListCtrlItem() , I changed the declaration to:
LVITEM lvi = {0};
and that fixed things right up.
|
|
|
|
|
Does anibody know if there's a similar function like CListBox::SetCurSel, in class CListCtrl?
In a multiple column CListCtrl, is it possible to select the entire row instead of only the first column?
Thanks!!!
|
|
|
|
|
1) CListCtrl::SetItemState()
2) Yep, set the full row select extended style of the control.
|
|
|
|
|
Hi there,
How do you select the "set the full row select extended style of the control" ??
Thanks in advanced,
Ariel.
|
|
|
|
|
In MFC: yourListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT|yourListCtrl.GetExtendedStyle());
In straight API: ListView_SetExtendedListViewStyleEx(hwndYourList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
--Mike--
http://home.inreach.com/mdunn/
This must be Thursday. I never could get the hang of Thursdays...
|
|
|
|
|
Thanks alot for this its working perfectly !!!
Hope to be able to help you once,
Ariel.
|
|
|
|