|
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.)
|
|
|
|
|
Have you tried _kbhit() in the loop?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi
I am trying to convert my networked application (C, using a custom text based protocol) to support UTF-8. I have search the Internet for a while now in order to find the best way to read UTF-8 from the socket, however, I have not been successful.
Can anyone point me in the right direction to get started? I have little experience with unicode programming in C, but know there exists a wchar_t type somewhere.
|
|
|
|
|
You don't want to use wchar_t for utf-8 encoded strings. Utf-8 was introduced to be able to use char .
I'd start from this link: UTF-8 and Unicode FAQ for Unix/Linux[^]. Never mind about the Unix part, it is useful even if you are working on Windows.
|
|
|
|
|
Sockets are used to transmit bytes of data. The socket API doesn't assume or impose any encoding, it's entirely up to the application level. If the application at the other end of the socket connection sends UTF-8 encoded data, then your recv() returns UTF-8 encoded data. There isn't any special "way to read UTF-8 from the socket".
|
|
|
|