|
I'm not sure of any single function that would do it, but perhaps AfxExtractSubString() could be used as a starting point.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hi!
I am trying to accept a dropped CF_TEXT type... I _must_ use the COleDropTarget class for this. Unfortunately all classes and articles I found derive the OnDrop function from a CView... But I have a CTreeCtrl... I cannot use the OnDropFiles member, the incoming data is of type CF_TEXT.
How can I make my CTreeCtrl accept a drag-n-drop operation using COleDropTarget?
Thanks and best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
|
First thanks for your reply. I've read your article (excellent btw!), but somehow I cannot get this work...
I created a new, from COleDropTarget derived, class:
#include "StdAfx.h"
#include "EntryToGroupDrop.h"
CEntryToGroupDrop::CEntryToGroupDrop()
{
}
CEntryToGroupDrop::~CEntryToGroupDrop()
{
}
DROPEFFECT CEntryToGroupDrop::OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
{
MessageBox(GetDesktopWindow(), "Test", "Test", MB_OK);
return DROPEFFECT_MOVE | DROPEFFECT_COPY;
}
DROPEFFECT CEntryToGroupDrop::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
{
return DROPEFFECT_MOVE | DROPEFFECT_COPY;
}
DROPEFFECT CEntryToGroupDrop::OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point)
{
return DROPEFFECT_SCROLL;
}
void CEntryToGroupDrop::OnDragLeave(CWnd* pWnd)
{
}
BOOL CEntryToGroupDrop::OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
{
return TRUE;
}
Header file:
class CEntryToGroupDrop : public COleDropTarget
{
public:
CEntryToGroupDrop();
virtual ~CEntryToGroupDrop();
DROPEFFECT OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
DROPEFFECT OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point);
void OnDragLeave(CWnd* pWnd);
BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
};
I want to make the treectrl a drop-target when the user starts dragging something from a clistctrl, which is right of the treectrl (an application like explorer):
void CTestDlg::OnBeginDragPwlist(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
*pResult = 0;
COleDropSource *pDropSource = new COleDropSource;
COleDataSource *pDataSource = new COleDataSource;
m_bDraggingEntry = m_dropEntryToGroup.Register(&m_cGroups);
TRY
{
CSharedFile fileShared;
TRY
{
CArchive ar(&fileShared, CArchive::store);
TRY
{
CString strData;
strData = "Test";
ar.Write((LPCTSTR)strData, strData.GetLength() + sizeof(TCHAR));
ar.Close();
}
CATCH_ALL(eInner)
{
ASSERT(FALSE);
}
END_CATCH_ALL;
}
CATCH_ALL(eMiddle)
{
ASSERT(FALSE);
}
END_CATCH_ALL;
pDataSource->CacheGlobalData(CF_TEXT, fileShared.Detach());
pDataSource->DoDragDrop(DROPEFFECT_MOVE | DROPEFFECT_COPY, NULL, pDropSource);
}
CATCH_ALL(eOuter)
{
ASSERT(FALSE);
}
END_CATCH_ALL;
SAFE_DELETE(pDataSource);
SAFE_DELETE(pDropSource);
if(m_bDraggingEntry != FALSE) m_dropEntryToGroup.Revoke();
}
The dragging works fine (I can drag the text into other windows), but the treectrl doesn't act as a drop target... The MessageBox in the OnDragEnter function isn't displayed...
Any idea what's wrong??
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I'm looking for software to do an "automated plane ticket search". ALL sites force you to give start/stop dates and do not allow ranges. I want to find the cheapest flight in a certain period and it looks like I'll need some code to do this. Unfortunately I have no idea on how to iterate on a web search page.
|
|
|
|
|
What do you good people do ? I need to run several different post build apps and a batch file seems a bit clunky. Any good ideas that fit with the VS.NET macros etc ?
|
|
|
|
|
I want to send a string to a process (exe) for some changes and return back to the calling process.
I cannot use WM_COPYDATA because it is only one way.
Any suggestion
Kiru
|
|
|
|
|
kirucodeproject wrote:
I cannot use WM_COPYDATA because it is only one way.
If window A can send the message to window B, then why can window B not send the same message to window A?
Have you looked into the other forms of IPC such as DDE, clipboard, mailslots, pipes, sockets.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks.
DLL which is plugged by some ODBC client can call the exe for string changes and wait for the changes and continue. Therefore, it cannot send message back. Can i use call back. dll -> launch an exe (createProcess)for the string change. Can the DLL call a callback function in exe?
|
|
|
|
|
Hi all.
I write a smale Win-App with VS.net 2003 (using MFC).
During testing I encounter a problem which should not exist (as M$ wrote @ MSDN)
After i open the Database (MS Access / SQL Server) and call the
SetLockingMode(CRecordset::pessimistic) to protect the Record.
As M$ wrote before ..calling the Edit() function.
But I allways get the Error message "Lockmode is not supported".
I had installed latest MS-SQL ODBC Drivers and using MS-Access 2003 as well MS-SQL Server 2000 SP4 but with both I encounter the same message.
Anybody have a idea what to do ??
Do I have to write my own Ttransactionserver which handle this ??
I think it's all M$-Product so interoperability should be no problem..
or I'm completly wrong in this case ???
Big THX: for any help regarding this problem (I'm sure I'm not the only one out there)
C'ya
Mantra
|
|
|
|
|
Nobody ??? Tought here are the real code-gurrus...
So I'm the only one with this problem or what ?
Cheerz
|
|
|
|
|
Dear Friends,
I am new to VC and would like to know how can I see the .lib file in my workspace window.
Please write to me and help me ASAP.
Thanking You
With Regards
Bilar
|
|
|
|
|
On the fileview rightclick and add the .lib file that you want to add.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
hi all
with an mfc multi document interface windows application running on xp with many (several
hundred) mostly modeless form views i have encountered unexpected behavior with the
controls on the forms. for example when clicking a button to open a file open dialog, the
dialog gets instantly closed etc. adding more form views can crash the application.
is there a limit to the number of views or controls per application. each view in the application can have 20 controls so the total number of controls can exceed 250 * 20 => 5000
another behavior which may give some clues is that when adding above 5000 controls i.e. typically over 250 views, adding subsequent views becomes increasingly slow (the time taken for the view to be drawn on the screen)
any ideas how i can correct the unexpected behaviour?
thanks for any help
mike
|
|
|
|
|
You are probably hitting an upper resource limit on your PC. What you describe has happened to me in the past when I had very large number of views open. Also once when I had a resource leak (ICON) which was causing problems.
Why do you need so many views open at a time?
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
thanks for your comment. could you suggest how i could investigate a resource leak?
most of the views are hidden as they only very rarely need to be shown in order to change settings and most of the settings are set in advance and not presented to the user. many views belong to similar "building block" modules and are multiple instances of a few modules implemented as dll s.
|
|
|
|
|
mike.dibley wrote:
for example when clicking a button to open a file open dialog, the
dialog gets instantly closed etc. adding more form views can crash the application.
huh ... maybe there's a resource leak or memory leak somewhere that prevent the dialog being created; or ID conflict somewhere.
mike.dibley wrote:
is there a limit to the number of views or controls per application. each view in the application can have 20 controls so the total number of controls can exceed 250 * 20 => 5000
maybe there's a limitt for for controls visible at the same time ( or created at the same time, even if they are not visible )
(off-topic) I always find it strange that people create UI with tons of controls/forms at the same time, it must really be confusing for the users.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
thanks for your comments
most of the view are "hidden" ie visible set as false.
have you come across any tools for detecting memory leaks?
please see previous reply for the comment about the number of views presented to the user
|
|
|
|
|
How can the Thumbnail view be set for the Common dialog control either before or when the Common Dialog File view is loaded ? I would like users to see their image files as thumbnails instead of names only.
|
|
|
|
|
One direction seems to be to use the
Ifolderview::SetCurrentViewMode()
Has anyone used this and could they post some code ?
Regards
|
|
|
|
|
I have a peice of code here:
CFont* pFont = NULL;<br />
LOGFONT lfNav;<br />
<br />
pFont = m_cNextPg.GetFont();<br />
pFont->GetLogFont(&lfNav);<br />
lfNav.lfHeight = 30;<br />
_tcscpy(lfNav.lfFaceName, _T("Webdings"));
m_cBtn.SetFont(CFont::FromHandle(CreateFontIndirect(&lfNav)),TRUE);
You can try it out on this piece of code by paste this code in OnInitDialog(), and be sure you have a button..
My question is: Can I change the font type to "webdings"... How to do that?
THank YOu @!
|
|
|
|
|
hi guys, i hv a application which written in VC++. and it need to use a .sys file and 2 dll file.
is there any article related to how to make a setup which can automatically place these files in the system directory. ie: WINDOWS\SYSTEM32\Drivers
thank you in advance!!
|
|
|
|
|
To do it properally you need something like InstallShield/NSIS/MSI etc etc etc.
Personally, Id go for NSIS - free, poweful, and open source.
http://nsis.sourceforge.net/home/
If its just a simple app you could write one - but why bother when someone has done it for you.
|
|
|
|
|
Hi,
I am using multithreading.
Three threads call the same function say xxx(),these three threads will be doing some processing on the items in the listcontrol,all these three threads are running.
I need to delete a particular row from the list control,when specific requirement is met.
The listcotrol is feeded by the main thread.
Can u please suggest me the way to delete the items,as the deletion is not happening the expected way.i.e,some other row is getting deleted.
|
|
|
|