|
Peter Weyzen wrote: Absolutely!
Several utilities made by SysInternals do this, but they work in conjunction with a file-system driver. Many years ago, there used to be a "How does it work?" blurb on their Web site. I think it was removed even before Microsoft bought them.
"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,
Saw a lot of posts related to this but still not totally clear -
It appears that even if you override OnOK for all property pages only the first page(1) OnOK override is called. The others are never called even if the user hits OK when page 2-n is active.
Does this means it is difficult to perform additional OnOK processing of the data on pages 2-n when the user dismisses the sheet?
Thanks
modified on Friday, October 23, 2009 2:34 PM
|
|
|
|
|
|
al2500 wrote: The others are never called even if the user hits OK when page 2-n is active.
With a very basic app created, I found this to not be true. Each page's OnOK() method was indeed called.
"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
|
|
|
|
|
But normally you would need any modified page's OnOK called since the user may modify more than one or close from a different page.
Regardless, I think the best method (for me) is as follows (found it in a post here):
Add afx_msg void OnOK(); to the property sheet definition
Add ON_COMMAND(IDOK, OnOK) and
void CMyPropSheet::OnOK()
{
AfxMessageBox("Hello World");
CPropertySheet::EndDialog(IDOK);
}
to the implementation. Then you have access to data memebers of all pages.
|
|
|
|
|
al2500 wrote: But normally you would need any modified page's OnOK called...
Which is exactly what happens, plus the pages that were not selected (i.e., no modifications).
"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
|
|
|
|
|
David,
Thanks for your help - I see now that it calls OnOK (using afx_msg void OnOK()) for any pages that were viewed and I initially expected all pages to call OnOk regardless so I did not "view" them when testing...
However, I have verified that it only calls OnOK for pages that were viewed. This is OK with me but it might be good to understand why your behavior is different.
My code is -
For each page definition-
afx_msg void OnOK();
For each implementation -
ON_COMMAND(IDOK, OnOK)
void CPageN::OnOK()
{
AfxMessageBox("PageN");
CPropertyPage::OnOK();
}
Again, thanks for the help. It's actually much cleaner to perform any data validation/storage in the page implementation vs. the sheet implementation.
|
|
|
|
|
Messing around trying to learn something and I'm having trouble seeing the time benefits in my openMP example.
Each array (pArray1 and pArray2) hold about 10meg of RGB bitmap data, bufferSize2 is the bmp file size. OpenMP is enabled in VS.
So I can run the following with or without #pragma and get the same 20Msec's or there about.
<br />
<br />
#pragma omp parallel for //<-no impact on time<br />
for(long loop=0;loop<bufferSize2;loop++)<br />
pArrayResult[loop]= ~(pArray1[loop] - pArray2[loop]);<br />
<br />
I can try the common openMP example:
<br />
#pragma omp parallel<br />
{<br />
printf("hello world");<br />
}<br />
and never get something that looks like the example warning
helhelloo w world orld
I always get
hello world hello world
I can try
<br />
#pragma omp parallel<br />
{ <br />
int ID=omp_get_thread_num();<br />
printf("Hello(%d)",ID);<br />
printf("world(%d)",ID);<br />
}<br />
and the result is always sequential
hello(0)world(0) hello(1) world(1)
Anyone have an idea as to why everything seems sequential? What am I doing wrong?
Thanks,
Andre
|
|
|
|
|
A common misconception about multi-threaded programs is that they produce faster code. This can only be true if you have more than one processor. Otherwise, the context switches will actually make your code slower. Multi-threaded programs do make some problems easier to solve, however.
"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
|
|
|
|
|
Sorry for not being clearer... As the beginning of my post suggest I'm working on two 10 meg arrays. I "think" I was careful in how I split the work with respect to memory as well. I thought that workload would be perfect for the openMP test. And strangely enough I was sure to run it on a dual-core machine.
Thanks,
Andre
|
|
|
|
|
In my non-Unicode application, If I put in Chinese Text into a Rich Edit Control, it displays the chinese characters fine. I was wondering how would I be able to read that variable into a string that would hold the chinese Text, Can I somehow read that into binary? or am I going about this the wrong way to be able to read and write chinese Text in non-unicode app?
|
|
|
|
|
|
Hi,
(Traditional, Big 5)
I have one simple program with a dialog and Edit field that I would like to enter chinese Text (like Customer Address). Usually I Serailize this field, and I read it from a different application thru the Serialize() function and display it. CString is what I use for that variable, but I know it doesn't work with chinese characters.
|
|
|
|
|
Software2007 wrote: CString is what I use for that variable, but I know it doesn't work with chinese characters
CString (on a non-Unicode build) should work just fine with the Big 5 encoding (Code page 950).
If I understand your requirements correctly, you could read the text from the rich edit control as Unicode (see EM_STREAMOUT[^] and then convert it back to CP 950 with WideCharToMultiByte[^] function.
|
|
|
|
|
I cannot type in Chinese Text into the regular Edit field to begin with, it displays ???? instead.
But if I use RichEdit control, I guess, I would be able to put in Chinese text, but I am not sure how to hold it in strings to serialize it, then when I read it back thru Serialize again it would turn back into chinese.
|
|
|
|
|
Software2007 wrote: I cannot type in Chinese Text into the regular Edit field to begin with, it displays ???? instead.
Did you read my response from yesterday?
|
|
|
|
|
Hey, I am using PROCESSENTRY32.szExeFile which is of type CHAR, but CHAR is only #define char of size [260].
I just want to store this a list of these in a char* listArray. So I need to convert from CHAR to char. (which are the same thing!) But if I cast it it doesnt work?
I know it's probably really simple for most people, but whenever i search this I can only find for wide chars or LPSTR and LPWSTR and I find all the conversions a little baffling.
Can anyone suggest anything?
Thank you,
Nicola.
|
|
|
|
|
|
Well friday night is going to be fun for me! haha. I'll let you know. Thanks
|
|
|
|
|
Two examples:
char name[260] = "Apple";
char *pname = new char[260];
strcpy(pname, name);
vector<char *> array1;
array1.push_back(pname);
vector<string> array2;
array2.push_back(name);
"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
|
|
|
|
|
if I do
strcpy(m_cProcessList[m_iProcessCount], stpePrcEntry32.szExeFile);
where m_cProcessList[m_iProcessCount] is a pointer to the current stpePrcEntry32.szExeFile is of type CHAR then it compiles but it doesnt work. I get:
Unhandled exception at 0x102af679 (msvcr80d.dll) in blueline.exe: 0xC0000005: Access violation writing location 0xcccccccc.
I think I need to convert stpePrcEntry32.szExeFile to something else first.
|
|
|
|
|
Nicola Curran wrote: strcpy(m_cProcessList[m_iProcessCount], stpePrcEntry32.szExeFile);
What is m_cProcessList declared as? What value does m_iProcessCount have?
This will obviously not work:
char *pname;
strcpy(pname, "My name is X");
Nicola Curran wrote: I think I need to convert stpePrcEntry32.szExeFile to something else first.
No, but you do need to have a better understanding of pointers.
"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
|
|
|
|
|
This field is actually defined as TCHAR szExeFile[MAX_PATH]; , where TCHAR is either an ASCII or wide character depending on your configuration type (although the doc implies Unicode only). Assuming that you are using this in conjunction with Process32First()/Process32Next() then each call will return the exe path name in this field. If you then wish to store these names in an array you will need to copy them to a new buffer whose address is stored in the array. If your code is non-unicode then you will also need to convert the strings from Unicode to mbcs types.
|
|
|
|
|
typedef struct tagPROCESSENTRY32
{
DWORD dwSize;
DWORD cntUsage;
DWORD th32ProcessID; // this process
ULONG_PTR th32DefaultHeapID;
DWORD th32ModuleID; // associated exe
DWORD cntThreads;
DWORD th32ParentProcessID; // this process's parent process
LONG pcPriClassBase; // Base priority of process's threads
DWORD dwFlags;
CHAR szExeFile[MAX_PATH]; // Path
} PROCESSENTRY32;
this is the struct, and CHAR is typedef char CHAR; ... or am i using a wrong version of the file?
|
|
|
|
|
Nicola Curran wrote: this is the struct, and CHAR is typedef char CHAR; ... or am i using a wrong version of the file?
You are correct, I looked at the MSDN documentation and it showed me the 'generic' version. The version you have is fine and should return you exe path names in ASCII.
|
|
|
|