|
Yes, class fstream is of C++ Standard Library, you have to include <fstream>.
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
Hi,
How can i get the Used System Memory and
System Memory Free..
Thanx
Sameer
|
|
|
|
|
If using PSAPI (Win NT/2k/XP) try GetProcessMemoryInfo
On the NT archetecture memory information is mapped to a memory object in the registry. Check "Performance Objects and Counters" in MSDN and WINPERF.H.
/moliate
|
|
|
|
|
Hi,
I want to get the size of a specified folder like this :
HANDLE hDir = CreateFile ("C:\\MyFolder",
GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL
);
Then i pass a directory handle to the GetFileSize function
DWORD isize = GetFileSize(hDir, NULL /*lpfilesize*/ );
This code don't work. I try this second function :
PLARGE_INTEGER lpFileSize;
GetFileSizeEx( hDir, lpFileSize );
It don't work
Can anybody help me.
Thanks in advance
|
|
|
|
|
ummm a folder doesn't have a size as such ... its the sum of the sizes of all the files / folders in the folder
do a recursive filesize thing and add them all together
"... and so i said to him ... if it can't dance and you can't eat it either f**k it or throw it away" 8028finder.com
|
|
|
|
|
No, you need to get the size of each file in the folder...;)
Best Reagards...
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
please help me, I need to create one class have (button, static text, edit box..). How to write code???
|
|
|
|
|
Do you want create derived class from button, static etc...?
Eugene Pustovoyt
|
|
|
|
|
This is maybe a silly question. I thought it would as easy as adding an IDR_MAINFRAME menu to my dialog resource, but the miracle didn't occur
Should I create a CMenu and associate it to my dialog or is there a clever MFC mean ?
Thanks
Yarp
|
|
|
|
|
right click on the dialog and open properties. look there, u will find a combo box for choosing the menu
|
|
|
|
|
Hi Ganesh, this was obviously a silly question. I feel stupid but it doesn't matter I got it now. I spent 2 hours this morning trying to append my menu to the dialog. I thought many things but I could never figure it would be as simple.
Thanks a lot.
Yarp
|
|
|
|
|
Yarp
I have sent you a direct email with a sample project containing a dialog with a menu. Haven't looked at it in a while so won't make any comments here on how to do from my feeble memory.
Michael Martin
Australia
mjm68@tpg.com.au
"He orginally got the Tweezers of Destruction through the scanners but then popped back outside for a smoke."
- Chris Maunder 26/03/2002
|
|
|
|
|
Hi Michael, another way to create a menu. The way I was looking for and as there's also a status bar this is twice interesting for me. I compiled the project with VC6, it is still workable.
I'm doing an MFC dialog embedded in a dll with no MFC in the root program, so I emulate a CView behaving dialog from a CDialog class.
Thank a lot for the .zip file, CodeProject is really a cool C++ forum.
Yarp
|
|
|
|
|
Hi,
Can i pass a string in PostMessage parameters..
WPARAM or LPARAM..
Sameer
|
|
|
|
|
Sameer Maggon wrote:
Can i pass a string in PostMessage parameters..
WPARAM or LPARAM..
Yes you can, but remember, PostMessage just places the message in the message queue of the window in question, so you have to make sure that the string does not go out of scope or get deleted before the message is handled.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
If a man is standing in the middle of the forest speaking and there is no woman around to hear him...is he still wrong?
|
|
|
|
|
Have you tried (WPARAM)szString?
I think you should try it only for windows from the same process.
rechi
|
|
|
|
|
Yes. Not a CString or std::string though. LPTSTR are fine as long as you guarantee that it remains allocated until the message has been processed.
|
|
|
|
|
Niklas Lindquist wrote:
Yes. Not a CString or std::string though. LPTSTR are fine as long as you guarantee that it remains allocated until the message has been processed.
One of many ideas is to use a ptr on a static buffer - or using PostMessage() (so the data can get evaluated before returning and releasing a dynamic memory).
|
|
|
|
|
Yes, I do this in a lot of my applications. Especially in multi-threaded apps where you should only post messages between threads. Here is an example posting a CString.
Note you should allocate whatever you wish to post. It can be any kind of object.
...
CString *pStr = new CString();
*pStr = "Set String Here!";
pMyView->PostMessage(WM_MY_MSG, 0, (LPARAM)pStr);
... Note that the receiver of this message MUST free the allocated memory.
LRESULT CMyView::OnHandleMyMsg(WPARAM wParam, LPARAM lParam)
{
CString *pStr = (CString *)lParam;
if(pStr)
{
delete pStr;
}
return 0;
} This last step is important. Before the window is destroyed, check for any unhandled messages and delete their memory.
void CMyView::OnDestroy()
{
MSG msg;
while(::PeekMessage(&msg, (HWND)NULL, WM_MY_MSG, WM_MY_MSG, PM_REMOVE))
{
CString *pStr = (CString *)msg.lParam;
if(pStr)
delete pStr;
}
CView::OnDestroy();
} Hope this helps.
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
Hi,
what is a good way to combine a listbox with an edit control?
I run a small chat application (heavy alpha yet). I have the problem that the interface is not very user friendly yet. For example, when setting focus on listbox the keyboard input is not shown in edit control - or - when being in edit control the mouse wheel is not routed to the listbox. Both controls should be merged more together.
Thx for some design guide lines or pointing me into the right direction!
Thx, Moak
|
|
|
|
|
ComboBox?
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
If a man is standing in the middle of the forest speaking and there is no woman around to hear him...is he still wrong?
|
|
|
|
|
Redirect keystrokes from your list to your dialog. Mouswheel events from your edit to your dialog. Keystrokes from your dialog to your edit. Mousewheel events from your dialog to your list.
|
|
|
|
|
Niklas Lindquist wrote:
Redirect keystrokes from your list to your dialog. Mouswheel events from your edit to your dialog. Keystrokes from your dialog to your edit. Mousewheel events from your dialog to your list.
thx, will try that!
I know the window handle of each other. Which is the MFC place to scan the correspoding messages, is it PreTranslateMessage() handler from CListBox/CEdit?
|
|
|
|
|
That is probably the easiest place.
|
|
|
|
|
okie... will hook me up there.
If there are any alternatives, let me know.
But I wont add a unique handler for every message type, hmm maybe a combined handler for 'relaying'.... hmmm.
|
|
|
|