|
Can anyone tell me how to save from a dialog not a SDI or MDI but Dialog.
You know like putting a variable into it or several into a specified external file and opening it. Need Details since I'm kinda new to saving/serializing
[It is possible to represent everything in this universe by using 0 and 1]
I'm going to live forever or die trying.
|
|
|
|
|
//Serialize Save Int
CFileException e;
CFile theFile;
if (!(theFile.Open(filename, CFile::modeWrite | CFile::modeCreate, &e))) { TRACE("can not open file for writing"); return; }
CArchive ar(&theFile, CArchive::store);
int p = 1
ar << p;
//Serialize Load Int
CFileException e;
CFile theFile;
if (!(theFile.Open(filename, CFile::modeRead, &e))) { TRACE("can not open file for reading"); return; }
CArchive ar(&theFile, CArchive::load);
int num;
ar >> num;
Repeat this for everything/datatypes you want to serialize. Can't remember whether you have to close the file after or if MFC takes care of that for you when you serialize, so I left it off.
|
|
|
|
|
The destructor of CFile closes it for you! If you create the CFile object on the heap, you have to close it manually.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Is hyperthreading anything to get excited about.
XP is meant to support it, so I was wondering if in future apps that I make that are CPU intensive should I consider an architecture that can be modified to use it?
If so, I guess I'm on another learning curve.
Regardz
Colin J Davies
* WARNING * This could be addictive The minion's version of "Catch "
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|
|
AFAIK, from an application's point of view, a HT CPU looks the same as two non-HT CPUs. So you can just use your existing multi-threaded programming talents.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
Michael Dunn wrote:
AFAIK, from an application's point of view, a HT CPU looks the same as two non-HT CPUs.
Yeah, I'm pretty sure that's the way it's supposed to look
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Mike,
Since you have replied I have been looking into this.
As wb (below) suggests their could be some problems.
A threaded app may actually end up running slower on a hyperthreaded CPU. What I am looking for is some sort of a guideline as to what would cause said bottlenecks to occur.
Possibly it appears that hyperthreading is really more use at the multitasking rather than multithreading.
I envisage that you could set up one set of guidelines for the current XEON processor, and then with the next generation the rules will have changed.
Really I must get a hyperthreaded CPU to run my own tests, and try to create the bottlenecks. At the moment my interest is more academic then anything else.
Regardz
Colin J Davies
* WARNING * This could be addictive The minion's version of "Catch "
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|
|
with SimultaneousMultiThreading (or Intel: HT ) you can gain a lot of spead up, but there is stil one CPU with one cache, one set of registers ..... sometimes its even slower then on a normal CPU becaus of CacheTrashing (if two different threads have a mem block , which is mapped to the same cacheline in the CPU cache)
then you have to download VTune from Intel it helps you to find such bottlenecks.
|
|
|
|
|
What you are saying makes sense to me.
HT must have a cost, and at some stage there will be a bad return on usage. I guess it would be possible to spawn countless threads to find where this happened. There are now 3 Levels of cache, and I guess one must hold the main mapping of activity.
I actually think hyperthreading is quite exciting, its a bit like a brain having its own smaller brain to control itself.
Regardz
Colin J Davies
* WARNING * This could be addictive The minion's version of "Catch "
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|
|
Hi all,
I have a two part application.
1. Windows 2000 Service
2. A MFC dialog based GUI application to configure the service.
I am communicating between Service and GUI app through file mapping. The problem is service part has created the file and weh GUI app tries to access the file, I am getting error "Access is denied".
Is there any right conflict between system process (service) and user process(GUI app). I am logged through "Administrator".
Any urgent help is neeeded.
regards.
|
|
|
|
|
When you create the file mapping object, you need to specify a DACL -- the LPSECURITY_ATTRIBUTES parameter that you usually leave NULL to use the default DACL. The trouble with that is that the default DACL for code running as the system account is highly secured, to prevent tampering by other processes.
You'll need to create a DACL that grants access to your admin account, or the admins group.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
aef392rDFA#@(#*@%@#$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
Thank you very much. But can you give here an example of creating our own DACL to grant access to admin account or is there any article regarding this on this forum?
Thanks
Hashim Saleem
|
|
|
|
|
|
I am trying to debug my activex control using tstcon
(activex control test container). Seems there is a
problem. This is the control to display graphics
Before it(my activeX control) shows some grahpics,
I need my project to load some data. I don't know
how to combine this tstcon with my project.
someone has done this before?
Thank you for the help in advance.
shin
|
|
|
|
|
Hi!
I have worked on vc for around 2 years. Sometimes i face very weird bug, and spend several hours to check it but find all logical is correct. After i try rebuild all, all bugs disappear. Today i meet this problem again (i just change a #define).
Would you please tell me when we should rebuild all the project? Why there is such weird bug?
Thanks!
|
|
|
|
|
In my feel, the misfunction project work like some part be refreshed(by my edit) and some others are still old state.
Doesn't visual studio check the date and their depend relation?
|
|
|
|
|
pretty sure visual cpp will only build what it considers to be old files when you build, then relinks.
sometimes it misses files that were modified, and simply links the old object files.
to answer your question, rebuild all when it doesn't work, and you have to.
|
|
|
|
|
Hi all,
This was taken from the MSDN:
"It is not recommended that you add and subtract values from the SYSTEMTIME structure to obtain relative times. Instead, you should
1) Convert the SYSTEMTIME structure to a FILETIME structure.
2) Copy the resulting FILETIME structure to a ULARGE_INTEGER structure.
3) Use normal 64-bit arithmetic on the ULARGE_INTEGER value. " .....
i have the local time stored in SYSTEMTIME format.
i've done 1+2. now i have an __int64 to store the SYSTEMTIME.
i want to add a week (7 days) to this ularge_integer....how do i do that?
does the _int64 represents the number of seconds till today???
can any1 help?
thanks in advanced
Yaron
|
|
|
|
|
|
thanks
i also discovered (based on experiment only) that whilst using SYSTEMTIME
(without converting to FILETIME) adding 1400 to the higher value of the DWORD will do the trick for me....
i guess in a math way 1400 related to the 10000000x60x60x24x7 somehow
thanks again for reply
Yaron
|
|
|
|
|
wooooppppssss
sorry what i ment to say is to add the 1400 to the higher value of the FILETIME as follows:
SYSTEMTIME st;
FILETIME ft;
GetLocalTime(&st);
SystemTimeToFileTime(&st,&ft);
ft.dwHighDateTime += 1400;// adding the 7 days
i think your way was to work on the ULARGE_INT i.e __int64 i.e:
__in64 uli;
memcpy(&uli,&ft,sizeof(uli));
uli += 10000000x60x60x24x7;
and then convert it again to FILETIME with memcpy:
memcpy(&ft,&uli,sizeof(ft));
am i correct?
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Well, you were fudging the calculation, not doing it exactly like I was.
10000000x60x60x24x7 = 0x0580 28E4 4000
0x580 == 1408, so you were close
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
Hi!
I find in vs.net impossible to use user defined type for function parameter.
In the COM function i declare some user defined type. for example
typedef unsigned char d8u;
in vc6, i only need include a header descriping d8u in the idl file.
But in vs.net, i create a ATL control, find the idl file is dynamic generated when you compile it. Not a static file as in vc6 that you can edit it manually. And it will never include the header i need, so there are always error of shorting of such type.
Why vs.net take this solution? is there any place i can make midl to include the header?
I have blocked there for 2 days. If there isn't a good solution i have to reinstall vc6 to work. sigh...
Any idea,pals?
|
|
|
|
|
You don't have to use attributes - there's a checkbox in the AppWizard that controls whether the project uses attributes or the VC 6 style with the IDL and other files.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
aef392rDFA#@(#*@%@#$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
How can I calculate the required size of text which can be placed in one column of CListCtrl object and fits in.
when I tried to use the next code, some text did not appear all, I get three dots at the end of the appeared text on the column.
Can you help me please what is wrong with code ?
void CMyDialogDlg::AdjustColSize(int ColNo,CString s)
{
CClientDC dc(this);
CSize sz;
CFont *f = m_ListControl.GetFont();
dc.SelectObject(f);
sz = dc.GetTextExtent(s,_tcslen(s));
sz.cx += GetSystemMetrics(SM_CXBORDER);
if( width[ColNo] < sz.cx )
{
m_ListControl.SetColumnWidth(ColNo,sz.cx);
width[ColNo]=sz.cx;
}
}
Dr Abudawood
|
|
|
|