|
Thank's!
I have one last question... How to initialyse a variable which type is CPlaylist ?
CPlaylist <t> MyVariable;
??
|
|
|
|
|
|
Well, that really depends on your implementation of CPlayList...
Jens
|
|
|
|
|
Here is how I declare my template in my .h:
template<class t=""> class CPlaylist
{
public:
CPlaylist(T m_vPlaylist);
virtual ~CPlaylist();
void DeleteMedia(int iPosition);
protected:
vector <t> m_vPlaylist;
CString m_csName;
};
In my .cpp, I define my function:
template<class t=""> void CPlaylist<t>:eleteMedia(int iPosition)
{
m_vPlaylist.Erase(iPosition);
}
That compiles but I have no access to all of the Vector function when I write a "." . I can't see them...
Some ideas about that?
|
|
|
|
|
If i set one time in my application, I hope that it can act like a clock to notify me to do something at that time.
How can i achieve this?? Is there any Win32 API which can do this or some sample code that i can reference??
Thank in advance
|
|
|
|
|
Look up CreateWaitableTimer()/SetWaitableTimer()
(I last used this about three years ago at a different company so I have no source; sorry.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
If i create a thread to check if the time is up, is this the same with CreateWaitableTimer??
Thank you
|
|
|
|
|
Yes and no. You could do a timeout on a wait, but since the system clock can slip, the longer the timeout, the worse the precision. You're also limited to a relatively short period of time.
An alternative, which I have also used, is to have the thread wake up every hour, or some time period, check the time, then go back into the wait with a timeout (the wait was monitoring a shutdown event for graceful exit.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
If the thread wake up every hour, i set the clock between one hour scale.
Will i lose the chance to get the correct time??
I don't know why should go back into the wait with a timeout??
Thank for your help
|
|
|
|
|
Givens:
1) hEvent is a handle to an event
2) the following is in a thread
3) proper initialization has been done
for (;;)<br />
{<br />
if (WaitForSingleObject(hEvent, 60 * 60 * 1000) != WAIT_TIMEOUT)<br />
break;<br />
<br />
SYSTEMTIME time;<br />
GetSystemTime(&time);<br />
}
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
what's the difference when opening the file between in the way of text and
in the way of binary system?
|
|
|
|
|
One difference is how some characters are interpreted,
\r and \n for example.
Jens
|
|
|
|
|
Hello, Sir!
I am writing a MFC based program to extract files in a Zip archive, just like WinZip or WinRAR. I want to extract special files when I drop them from my CListView to the explorer or desktop. I think I must use delayed rendering to implement it.
I don't know how to do it. Could you give me some advice or example?
Thank you for your attention.
Best regards,
andy xia
andyxia@radinf.com
2004-05-04
|
|
|
|
|
What exactly is your problem?
Please give some more details.
Dow you just want to know how to
get the files that the user dropped
to the window of your application?
Jens
|
|
|
|
|
Hi,Jens,
Thanks for your reply.
In my program, I will do:
1. Drag some items from my ListView control to Windows Explorer.
2. I should get the target path where I finished the dragging.
3. If it is a valid path, I will extract the selected files to there.
My program is a Compress/Decompress tool just like WinZip and WinRAR.
In my ListView class, I responsed LVN_BEGINDRAG message to begin a dropping action like follow codes:
// Begin dropping...
CMyZipBoxDataSource datasrc;
FORMATETC etc = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
datasrc.DelayRenderFileData(CF_HDROP, &etc);
DROPEFFECT dwEffect = datasrc.DoDragDrop ( DROPEFFECT_COPY );
... ...
// End dropping
the Class CMyZipBoxDataSource is inherited from COleDataSource, and I overrided the function:
BOOL CMyZipBoxDataSource::OnRenderFileData(LPFORMATETC lpFormatEtc,CFile* pFile)
I don't know:
1. what should I write down in this function to handle this process?
2. how to get the target path the file will be extracted?
3. WinRAR extract selected files to a temp path after mouse up when draged. when it finished, move the extracted files to target path. Can I extract them to the target path directly?
That's my question, Thanks for your attention again.
Could you help me?
|
|
|
|
|
Sorry, I have not worked this way, till now I always accepted files to be dropped to my application, but yours is the other way round
But anyhow, your problem is much clearer now, maybe someone else can help you.
Sorry,
Jens
|
|
|
|
|
plz can any one help me in creating a dialog box with browse button to display path of the files in mfc i,e vc++
|
|
|
|
|
shiva shankar wrote:
plz can any one help me in creating a dialog box with browse button to display path of the files in mfc i,e vc++
LPMALLOC pMalloc;
/* Gets the Shell's default allocator */
if (::SHGetMalloc(&pMalloc) == NOERROR)
{
BROWSEINFO bi;
char pszBuffer[MAX_PATH];
LPITEMIDLIST pidl;
// Get help on BROWSEINFO struct - it's got all the bit settings.
bi.hwndOwner = GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T("Select a Starting Directory");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
// This next call issues the dialog box.
if ((pidl = ::SHBrowseForFolder(&bi)) != NULL)
{
if (::SHGetPathFromIDList(pidl, pszBuffer))
{
// At this point pszBuffer contains the selected path */.
DoingSomethingUseful(pszBuffer);
}
// Free the PIDL allocated by SHBrowseForFolder.
pMalloc->Free(pidl);
}
// Release the shell's allocator.
pMalloc->Release();
}
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
when debugging a program,A messagebox pop up--"out of memory";and then the programe faile to do what it is expected to.what's the meaning of the message?
|
|
|
|
|
the meaning ??? -> you write out of the memory. clearly, you write in a memory address which is already allocated for another program an is not "for you".
track the lines where you write into an array for example...
TOXCCT >>> GEII power
|
|
|
|
|
I need an easy way to copy a file from my www-server to my CPU in my MFC-App
For e.g. from:
www.ceco.se/ExistingTxt.txt
To:
C:\ExistingTxt.txt
...and justice for all
APe
|
|
|
|
|
URLDownloadToFile(NULL, "www.ceco.se/ExistingTxt.txt", "C:\\ExistingTxt.txt", NULL, NULL);
or
use
CInternetSession,CHttpConnection ...
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
see internet api in SDK
Don't try it, just do it!
|
|
|
|
|
Can a nt service running under administrator account interact with desktop.
thanks in advance
|
|
|
|
|
Since services run before the user logs in, you will have to be carefull with what you do. The desktop may not be present when you expect it to be.
It is better to write an application that interfaces with the service and have a GUI less service IMO.
Ant.
|
|
|
|