|
Hi,
you have either to work with the MFC CFile class or to work with the standad file stream of the C++
using CFile class
CFile myFile;
/* This will cause a file to be created and if there is a file with the same name to be truncated */
myFile.Open("FileName.txt",CFile::modeCreate|CFile::modeReadWrite);
/* This will cause a file to be created and if there is a file with the same name to be appended */
myFile.Open("FileName.txt",CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite);
char* buf;
CString strData;
strData = "My data";
buf = new char[strData.GetLength()];
strcpy(buf,strData);
myFile.Write(buf);
|
|
|
|
|
how do you record to a file a variable or string by mfc.?
|
|
|
|
|
|
hello
i have a very² simple question to ask
usually we declare member variables thru the class wizard right? what if we have more variables to declare? where should we declare them with the initialization values and how do we make all off them accesible thru every buttons we have? i mean like (in non-MFC) we declare variables in main() and they can be used by every operation in main().
at first i declared a new variable at one of the BN_CLICKED and tried to access it from another button (of course it didn't work) so i tried to add by right clicking in the class view and add member variable but i don't know where to give it a value. thanx for your help!
have a nice day!
~wilDcat~
|
|
|
|
|
In C++, a variable that needs to be accessed by an entire class (that is, having a scope global to the class in question) is generally declared in the class header, or definition file ( the .h file for the class ) as a member variable of that class.
If you wish to to be faithful to the object oriented spirit of C++, any such variable should be declard as private so that it cannot be accessed externally by other code within the application.
Typically, you will want to assign a default value to that variable in the class constructor. You can assign values as needed in any of the class's methods.
|
|
|
|
|
ok.. thank you
~wilDcat~
|
|
|
|
|
|
you mean what? char a[10]; ?
Bikram Singh
|
|
|
|
|
How can i change and copy string for using in Edit Control?
and how can i convert String to CString ?( _T() is that right?
best wishes.
|
|
|
|
|
mostafa_pasha wrote:
String
what is a "String" ?
Software | Cleek
|
|
|
|
|
Hi all,
Is there anyway to delete all the dialog except the current one.
This code
PostThreadMessage(AfxGetThread()->m_nThreadID, WM_QUIT, 0, 0);
delete all the dialog including the current one.
DARWIN PAUL RAJ
|
|
|
|
|
Hai all,
Is there anyway??????????????
DARWIN PAUL RAJ
|
|
|
|
|
S.DARWIN PAUL RAJ wrote:
Is there anyway to delete all the dialog except the current one.
Delete them from what? Your question is not very clear.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello,
I'm creating a new activex control using MFC ActiveX control wizard.
my activex control subclasses SysListView32.
Everything works except for drawing the control when i use WS_EX_CLIENTEDGE style.
If i don’t call this function
DoSuperclassPaint(pdc, rcBounds);
the items in the control are not painted, but the column header is visible.
If I do call this function, the items are painted, but there is an extra line below the column header and when you scroll there are lines going across the control where that it extra line was painted.
It seems line the control dc is shifted 2 pixel right and 2 pixels down.
When I dont use WS_EX_CLIENTEDGE style everything is fine. expect there is not 3d appearance.
If anyone knows how to solve this problem PLEASE HELP.
Thank you
Ilya
|
|
|
|
|
Hi!
How can I determine which application is using a given DLL. Let's say if I want to delete the dll file and then I get a message that DLL is locked by other application?
DavidR
|
|
|
|
|
|
While that utility does indeed show what DLLs are loaded, I do not see it showing what applications those DLLs are loaded by. Did I miss something?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidR_r wrote:
How can I determine which application is using a given DLL.
Does this help?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanx,It is interesting.
But I am looking also for api so I could redesign the application for my specific use.
DavidR
|
|
|
|
|
Hi,
I want to bypass firewalls. Actually I want to be able to send some reports from my program to a user email using the SMTP but I don't want any firewall to catch me. I implemnted the sending module, but now the problem is how to avoid tthe firewall. Any one can help me please?!!!
Thanks
Eng. Ayman Mahmoud
VC++ Team Leader
|
|
|
|
|
Unless you have physical access or admin rights to the firewall machine, you're out of luck. Honestly, a program that tries to bypass a firewall would be more suspicious to a network admin than an app just using regular SMTP. A firewall is there for a good reason.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
#include "witty-quote.h"
|
|
|
|
|
Michael Dunn wrote:
A firewall is there for a good reason.
Agreed! Can you imagine a virus writer asking himself, "Should my code respect the firewall settings, or should it just bypass the whole mess to guarantee the delivery of my payload? Hmmm."
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I'm currently on a project which needs to exam memory contents of an other process, basically, it searchs for certain pattern in the target process's page memorys, if pattern found then do some further examination, else keeps searching for same pattern.
I did it by this way:
First, I use ::VirtualQueryEx to obtain all pages of the target process and store those page information(base address and page size) in an array. This step completes in no time.
Second, I use ::ReadProcessMemory to read the memory from each page(bytes by bytes) and compare the bytes with my predefined pattern, which are an array of bytes, using memcmp .
I will finally find the memory address that I want for sure, but the problem is that it's slow, very slow. The target process has over 500 pages and total size of which are over 70MB, it takes like 50 seconds to finish the searching, and that makes my application completely useless.
Now since you guys are all gurus out here, I think there must be something to do to shorten the search time, please help and thanks in advance.
|
|
|
|
|
the only thing i can think of, is writing some own
memcmp function based on KnuthMorrisPrat or BoyreMoore algorithms... I actualy dont know how the standard memcmp behaves but I imagine it has a O(nm) runtime, so if your pattern is relativly long, you can speedup your app a lot. (I GUESS)
|
|
|
|
|
=[ Abin ]= wrote:
it takes like 50 seconds to finish the searching, and that makes my application completely useless.
If by "useless" you mean nonresponsive, then I suggest you put the processing code in a separate thread. That way, your UI remains responsive. See this article for more.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|