|
Hi,
I'm implementing drag & drop through OLE. I actually have that part working, but I also want (or actually need) to show a drag image during the actual drag. My idea was to use CImageList's functionality, so when the drag begins, I call BeginDrag and DragEnter, during GiveFeedback I keep calling DragMove, with the current cursor position, and when the drag ends, I call DragLeave and EndDrag.
These functions all work, that is, they don't return error codes or anything. But still the image doesn't show. I don't really know what I would be doing wrong, or what I'm missing. Is there perhaps another way to show a drag image during an OLE drag.
Hope someone can help me out here, thanks.
|
|
|
|
|
The article "Implementing Reusable Drag & Drop Classes" By Leon Finker
in section MFC / C++ >> Shell Programming >> General, should provide you with enough information.
Good Luck!
INTP
|
|
|
|
|
At first glance, it looks wonderful. Thank you
|
|
|
|
|
Ok, here's my problem:
I am trying to complie an application using Visual Studion.net(2002) Today all of a sudden when I try to compile code I have compiled before, I'm getting "error spawning cl.exe". This started when I tried to use some old code, I had done previously. My problem is that now, none of my previous ok code is compiling. I have removed visual studio and re-installed it, and this seems to have sorted the problem, but now I have gone back to code I was working on before and the error has showed again, it won't let me compile anything!
|
|
|
|
|
its a know bug checkout microsoft site. there they have some procedure to fix that problem...
|
|
|
|
|
Well, MSDN certainly does list the problem but it refers to Visual Studio version 2003, I'm running 2002, in any event, the information that they list on MSDN does not really give a clue as to why this problem just happens out of the blue. I seem to be able to avoid this problem by removing Visual studio, and than reinstalling it, but I would like to know why the problem came up in the first place.
thanks for your feedback!
|
|
|
|
|
When you use the appwiz to create a MDI or SDI app, info about each menu item is shown in the statusbar when you hover over the menu item.
I have a dialog with a menu and a statusbar. Is there any good way to do this for me?
Øivind
|
|
|
|
|
you have an event WN_MENUITEM (if i remember).
then, you catch with the event-associated function the item ID and you'll be able to get the string table entry for this ID.
TOXCCT >>> GEII power
|
|
|
|
|
Hi!.
I'm writing an application that serialize some object.
So, I have a class called CObjectX, (this would be the object to serialize).
And I have 3 more classes CObjectA, CObjectB y CObjectC.
The class CObjectX have an array of CObjectA wich have also an array of CObjectB and CObjectC.
My questions are:
Should I derived from CObject too every class that it's referenced in COBjectX?.
For every header and implementation file of these objects should I write DECLARE_SERIAL(...) and IMPLEMENT_SERIAL(...)?.
And, finally, should I overwrite only the virtual function Serialize() of CObjectX?.
Thank you.
Demian.
|
|
|
|
|
|
Hi Ravi.
I'm still having troubles to serialize my object.
I have a class called: CDecDatabase that have a member of type CPtrArray of CSistema object, (an array of CSistema objects).
CSistema object have 3 arrays CPtrArray, (arrays of objects CP1, CP2 y CP3).
All the object have a Serialize function.
When
First I invoke CDecDatabase::Serialize(), then, this function call for every CSistema object in the array call CSistema::Serialize() and this function call the method Serialize() for every CP1, CP2 and CP3 object in the arrays.
Something I have saved but I can't load it.
I don't know if I'm serialize the objects in the right order.
Thank you.
Demian.
|
|
|
|
|
OK, you're almost there!
CDecDatabase::serialize() should first save the number (int) of CSistema objects in its CPtrArray, and then save each CPtrArray. Same for CSistema::Serialize() , which should first save the size of each CP array before saving the array itself.
When you want to read stuff in, first read the size of the array you're about to deserialize, then loop that many times and serialize each object and add it to the CPtrArray.
I must add more detail to the 3rd serialization article. That's where all the really interesting stuff is!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Folks,
Is it legal to sell software developed with VS C++ 6.0 Standard Edition? I'm talking about garage shareware here, in case it makes any difference.
Be well people
|
|
|
|
|
|
I have an app that I want to run (dtsrun.exe) I can run it from the command line, but how do I do that in code with the specified switches? I know in vb I could use the ShellExecute() function, but how do I do that in C++ if I want to run this: 'dtsrun /S localhost /p jt'? thanks in advance for any help!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
|
THANKS!! That worked perfectly
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Don't remember where I picked this up but most likely somewhere here...Best site around!!
BOOL LaunchChild(LPCSTR lpszCmdLine, BOOL bShowChildWindow)
{
HANDLE hProcess = ::GetCurrentProcess();
PROCESS_INFORMATION pi;
STARTUPINFO si;
::ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = bShowChildWindow ? SW_SHOW: SW_HIDE;
LPVOID lpSD = NULL;
LPSECURITY_ATTRIBUTES lpSA = NULL;
lpSD = ::GlobalAlloc(GPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
::InitializeSecurityDescriptor(lpSD, SECURITY_DESCRIPTOR_REVISION);
::SetSecurityDescriptorDacl(lpSD, -1, 0, 0);
lpSA = (LPSECURITY_ATTRIBUTES)::GlobalAlloc(GPTR, sizeof(SECURITY_ATTRIBUTES));
lpSA->nLength = sizeof(SECURITY_ATTRIBUTES);
lpSA->lpSecurityDescriptor = lpSD;
lpSA->bInheritHandle = TRUE;
BOOL bResult = ::CreateProcess(NULL, (LPTSTR)(LPCTSTR)lpszCmdLine, lpSA, NULL, TRUE,
CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi);
if (lpSA != NULL)
::GlobalFree(lpSA);
if (lpSD != NULL)
::GlobalFree(lpSD);
if (!bResult) return FALSE;
::CloseHandle(pi.hThread);
::CloseHandle(pi.hProcess);
return bResult;
}
Just pass in the command line and whether or not you want the console window displayed.
Thanks to whomever submitted this!
ed
The absence of evidence is not evidence of absence.
|
|
|
|
|
thanks ed, but the answer I got before yours worked perfectly and it only uses one line:
ShellExecute(NULL,"open","dtsrun.exe","/S localhost /U admin /P admin /N ImportDistTextToTable",NULL,SW_HIDE);
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Actually his way defines the whole function... good way to learn... and his function takes in less parameters and too could be in one line of code
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
But it also requires an NT kernel operating system.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I am writing an application that performs custom titlebar painting. I have been using Paul DiLascia's CCaptionPainter class to accomplish this. Things have been working fairly well until I have come across a problem with modeless dialogs(a debug ASSERT_VALID). My main application is where the title bar painting occurs. I have various submenus that launches various other dialogs. I have noticed that when I launch a modeless dialog and move it, the OnNcPaint routine in my CCaptionPainter class ASSERT_VALID(m_pWndHooked) /*class member CWnd object reference*/ produces the following assertion in WinCore.cpp. I have googled the below snippet from WinCore.cpp, but have not come up with anything that makes sense. I am not passing my CWnd object from thread to thread and am wondering if anyone has seen other variations of this assertion. Thanks!
CObject* p;
ASSERT((p = pMap->LookupPermanent(m_hWnd)) != NULL ||
(p = pMap->LookupTemporary(m_hWnd)) != NULL);
ASSERT((CWnd*)p == this); // must be us
// Note: if either of the above asserts fire and you are
// writing a multithreaded application, it is likely that
// you have passed a C++ object from one thread to another
// and have used that object in a way that was not intended.
// (only simple inline wrapper functions should be used)
//
// In general, CWnd objects should be passed by HWND from
// one thread to another. The receiving thread can wrap
// the HWND with a CWnd object by using CWnd::FromHandle.
//
// It is dangerous to pass C++ objects from one thread to
// another, unless the objects are designed to be used in
// such a manner.
|
|
|
|
|
You should ASSERT(IsWindow(p->GetSafeHwnd()) which check the validity of your Hwnd
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
hi everyone,
i've started doing my first 'really multithreaded' app. i've inherited the CWinThread, thus creating an interface thread. the problem is, that i sometimes run into some trouble. but first, the code (without project )
<br />
BOOL CFilesystemThread::InitInstance()<br />
{<br />
TRACE("Filesystem thread init....");<br />
m_pFilesystemDlg = new CFilesystemDlg();<br />
m_pFilesystemDlg->Create( IDD_FILESYSTEM_DIALOG,<br />
CWnd::GetDesktopWindow() );<br />
m_pFilesystemDlg->ShowWindow( SW_SHOW );<br />
<br />
TRACE("..done!\n");<br />
return TRUE;<br />
}<br />
<br />
thread exit:<br />
<br />
int CFilesystemThread::ExitInstance()<br />
{<br />
TRACE("Filesystem thread stop....");<br />
if ( m_pFilesystemDlg )<br />
{<br />
m_pFilesystemDlg->DestroyWindow();<br />
delete m_pFilesystemDlg;<br />
m_pFilesystemDlg = NULL;<br />
}<br />
<br />
TRACE("..done!\n");<br />
return CWinThread::ExitInstance();<br />
}<br />
<br />
void CCNWServerDlg::OnBnFilesystem() <br />
{<br />
if ( g_dataEx.filesystem.pFilesystemInterface.IsLoaded() )<br />
{<br />
if ( g_dataEx.pFilesystemThread == NULL )<br />
{<br />
g_dataEx.pFilesystemThread = (CFilesystemThread*)<br />
AfxBeginThread( RUNTIME_CLASS( CFilesystemThread ) );<br />
}<br />
else<br />
{<br />
g_dataEx.pFilesystemThread->m_pFilesystemDlg->ShowWindow( SW_RESTORE );<br />
g_dataEx.pFilesystemThread->m_pFilesystemDlg->SetForegroundWindow();<br />
}<br />
}<br />
else<br />
{
MessageBox(<br />
"Error loading filesystem module!",<br />
"Fatality", MB_OK|MB_ICONSTOP );<br />
}<br />
}<br />
<br />
---<br />
if ( g_dataEx.pFilesystemThread != NULL )<br />
{<br />
g_dataEx.pFilesystemThread->ExitInstance();<br />
delete g_dataEx.pFilesystemThread;<br />
}<br />
the final result is that if i run ONLY the filesystem thread, it goes down gracefuly. if i run for example accounts thread AND the filesystem i get this:
debug window:
Accounts thread init.
Accounts thread stop.
Filesystem thread stop......done!
Second Chance Assertion Failed: File wincore.cpp, Line 304
message box:
User breakpoint called from code at 0x77f7f570. (disassembly opens, which i don't know nothing about..)
em...SO. if you have any clue what happens, and where i'm doing things wrong, PLEASE help. anyone..?
---
kick ash.
http://sprdsoft.bigmoron.com
http://t1tan.cjb.net
|
|
|
|
|
I have been using multithreading with MFC for over 5 years and in my experience you will run into problems if you do any GUI code in a thread that is not the main window thread. You must never call any MFC gui code across thread boundries and never create any CViews in a thread that is not the main thread. This is because MFC uses thread local data to store a lot of its info about Doc and view. With that said your problem may be auto delete as CWinThread classes will automatically delete them selves on termination. You should disable this by setting m_bAutoDelete to FALSE and free the object yourself.
John
|
|
|
|