|
For the working of vptr, allow me to redirect you to one of my articles Polymorphism in C[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
How to capture the currently playing song using visual c++?
|
|
|
|
|
just can't understand how to make it.especially how to get the pathname of the document using begindrag message.
|
|
|
|
|
Have a look at this article[^]. The list control needs to be a drop target. Look at the OnDragOver and OnDrop handlers - they mention a data object (of type COleDatObject). That object will contain data of a number of formats. I'd suggest you implement the drop target thing and then experiment with dropping explorer files onto the list control and see what data formats the data object contains, to see which is the format you want to access. CFSTR_SHELLIDLIST is probably a good one - it returns an array of PIDLISTs, one for each explorer item. You can get paths from that using SHGetPathFromIDList[^]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
WOW!!sound so difficult!!~~
i didn't find it in mfc class wizard messages
that's too professional to me,thanks anyway
|
|
|
|
|
It's very easy in .NET if you get the chance to use that. The .NET controls have drag/drop related methods that wrap the ones I was talking about and provide simpler access to the underlying data object. I was able to create a list-control that could accept Explorer style data in about 20 minutes.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I really must apologise - I completely missed the easy way of doing file drag-drop when I answered you. All you need to do is this:
- Call the
CWnd::DragAcceptFiles method for your top-level window (e.g. I called it for a dialog window in the dialog's OnInitDialog) - Override and implement the window's
CWnd::OnDropFiles method - here's some code I've knocked together that demonstrates how it works:
void CMyDlg::OnDropFiles(HDROP hDropInfo)
{
const UINT nFiles = DragQueryFile(hDropInfo, (UINT)-1, 0, 0);
std::vector<CString> files;
for(UINT i=0;i<nFiles;++i)
{
CString thisFile;
const UINT nChars = DragQueryFile(hDropInfo, i, thisFile.GetBufferSetLength(MAX_PATH), MAX_PATH);
files.push_back(thisFile);
}
CDialog::OnDropFiles(hDropInfo);
}
Again - sorry for giving you misleading advise earlier!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
i know that name of the parent of exe files in windows, is explorer.exe.
explorer.exe there is in list of windows running processes in Windows task manager.
can it is this exe (explorer) there is whit other name in Windows task manager list?
Zo.Naderi-Iran
|
|
|
|
|
zon_cpp wrote: i know that name of the parent of exe files in windows, is explorer.exe.
I'm presuming you're saying that the parent process of processes you (the user) run in explorer.exe. Mostly true. but explorer.exe may be parent of the parent, or parent of the parent of the parent.
Unfortunately, I'm not quite sure what the rest of your question is answering. But I'll suggest you download and run Process Explorer[^] - it can show the hierarchy of processes
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
in any windows, can this exe (explorer.exe) be with other name, in Windows task manager list?
Zo.Naderi-Iran
|
|
|
|
|
Do you mean 'can you change the shell to something other than explorer' (the answer's yes[^]) or 'does explorer change its name' (I think the answer's pretty much no)
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello!
i'm making a mini-game by MFC
i want to make a class to ctrl some bitmaps,
i've written some menber founctions like this:
.................
in the constructor:
{
bitmap.loadbitmap...
xxx=0...//a bool to make sure CreateCompatibleDC(pDC) will only run once time.
}
setDC(CDC pdc);
{
if(xxx==0)
{
mDC.CreateCompatibleDC(pdc);// mDC used to store the picture
xxx=1
}
mDC.SelectObject(&bitmap[i]);
PDC=pdc;// PDC to store the target CDC
}
draw()//draw the picture
{
PDC->BitBlt(0,0,600,450,&mDC,0,0,SRCCOPY);
}
...........
but there's a problem:
when i use this class as a menber of CView; everything's OK ;
but when i use this class as menber of class X,and make X a menber of CView;
while using the founction setDC ;the mistake appears! a messagebox of"A\Retry\Ignore" comes out!!!
why things can be like this??
how should i write this class?
i just call setDC in founction"OnDraw".
modified on Sunday, July 12, 2009 4:12 AM
|
|
|
|
|
Please post relevant code where you're calling setDC.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
i just call setDC in founction"OnDraw".
|
|
|
|
|
If your class is a member of class X and then X is in-turn a member of the view class, how are you directly calling the setDC function of the class from OnDraw of the view class?
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
all public menbers
just use it like: X.(this class).setDC;
|
|
|
|
|
I want write a program that will scan a drive after the user entered the letter of the drive for a file called autorun.inf and delete it.
it should also scan for sub-folders that have exe extension with the same name as it's parent folders and delete it.
I am a beginner in c++ and i appreciate any help you guys can offer
My OS is windows xp
i am using visual c++ 2008 express edition
|
|
|
|
|
You can use of FindFirstFile/FindNextFile on a loop it can searchs subfolders.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
To delete files recursively in sub folders, you can use the SHFileOperation[^] API.
To delete files having exe extension and name of it's parent folder you will need to use FindFirstFile[^] and FindNextFile[^] APIs as suggested by Hamid.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
OK i also want the user to enter the drive letter in the beginning of the program to scan it how to do this
|
|
|
|
|
You can get all the drives in your local system using the GetLogicalDrives[^] function.
Show all the available drives in a combo box and have the user select one from it.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Here is the class declaration.
There is no any interesting point.
class Sample
{
protected:
struct State
{
int q;
long a;
char z;
};
State m_state;
public:
Sample(){ Create();}
~Sample() { Destroy(); }
void Create()
{
m_state.q = 10;
}
void Destroy()
{
}
int getINT(){return m_state.q;}
};
But here is interesting. What is this???. Decleration. Definition. I Dont understand and i dont find any information about this part.
<code>
Sample& GetSample()
{
static Sample state;
return state;
}
</code>
The orginal parts of this code. in Directx SDK DXUT.cpp
Thank You!!!
|
|
|
|
|
- It declares and defines the function GetSample
- The function declares and defines a local static variable called state. As it's static, this variable retains it's value after the function exits even though it's local to the function
- The function returns a reference to state. It looks like it's trying to implement some sort of a singleton for the class Sample
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I plan on writing a command line program that will do some large, time consuming number crunching.
Now to keep it simple, lets say when I start my program all its going to do is count from 1 to infinity. Normally, when its running the loop it will "freeze" the program, per se, and not allow any additional user input until its done with the loop. However I would like the user to have the option to "pause" the loop without crashing to program. What is a simple way to interrupt a loop?
|
|
|
|
|
It sounds like you need to implement some sort of threading scenario, where your user interface operates on the main thread and the loop runs in a separate thread (which can be paused or restarted from the main thread.)
|
|
|
|