|
Aamol M wrote: I handled OnMove(), OnSize() every other meaage in DialogBar
I wouldn't try that way, because the dialog bar should resize itself when the application resizes, whatever the user-defined lock (or you will face ugly display problems, for instance when your dialog bar docked in the application will be higher than its container). I would rather try to prevent the user to resize by blocking its actions means, that is the mouse and the maximize/minimize buttons if any. So I would rather work on mouse and button messages
I won't be able to be more precise, I don't work with CDialogBar but generally with CControlBar derived classes.
HTH anyway,
When they kick at your front door
How you gonna come?
With your hands on your head
Or on the trigger of your gun?
Fold with us! ¤ flickr
|
|
|
|
|
Yes. You are right....
Here it is nothing to do with resizing the dialogbar. Its perfectly acceptable that the controls and dialogbar remains as is regardless of application size. I have only 3 bitmaps to show on dialogbar.
I hv handled OnLButtonClick for DialogBar by not calling default LButton event and now I can only handle moving of it (blocking of MOVE)from DialogBar. But when I click on CaptionBar of dialogBar then event doesnt come for LButtonDown() in DialogBar class. So if I can know "When I click on CaptionBar of DialogBar then where shd I get message (in MainFrame - parent of that window) or somewhere else. If that only I can figure out, then in that case I will not call default OnLButtonDown() and things shd work for me....
But I cant find where the event comes when I click on CaptionBar() of DialogBar......
Thanks
AmolM
|
|
|
|
|
Hi all,
Recently, I have encountered a problem and I tried to debug it. I found that system throw out a CMemoryException when I try to allocate 256MB memory.
I have a member function in one class . see the below list.
ClassA:ClassA()<br />
<br />
{<br />
<br />
...<br />
<br />
mImage = NULL;<br />
<br />
...<br />
<br />
}<br />
<br />
ClassA:~ClassA()<br />
<br />
{<br />
<br />
delete []mImage;<br />
<br />
}<br />
<br />
bool ClassA : FuncA()<br />
<br />
{<br />
<br />
...<br />
try<br />
{<br />
<br />
unsigned long* mImage = new unsigned long[67108864];
<br />
}<br />
catch( CMemoryException* pEX)<br />
{<br />
CString cstmp;<br />
CString csOut;<br />
MEMORYSTATUS stat; <br />
GlobalMemoryStatus (&stat); <br />
<br />
cstmp.Format("The MemoryStatus structure is %ld bytes long.\n",stat.dwLength);<br />
csOut+=cstmp;<br />
cstmp.Format("It should be %d.\n", sizeof (stat));<br />
csOut+=cstmp; <br />
cstmp.Format("%ld percent of memory is in use.\n",stat.dwMemoryLoad);<br />
csOut+=cstmp;<br />
cstmp.Format("There are %7d total Kbytes of physical memory.\n",stat.dwTotalPhys/ 1024);<br />
csOut+=cstmp;<br />
cstmp.Format("There are %7d free Kbytes of physical memory.\n",stat.dwAvailPhys/1024);<br />
csOut+=cstmp;<br />
cstmp.Format ("There are %7d total Kbytes of paging file.\n",stat.dwTotalPageFile/1024);<br />
csOut+=cstmp;<br />
cstmp.Format("There are %7d free Kbytes of paging file.\n",stat.dwAvailPageFile /1024);<br />
csOut+=cstmp;<br />
cstmp.Format("There are %7x total Kbytes of virtual memory.\n",stat.dwTotalVirtual/1024);<br />
csOut+=cstmp; <br />
cstmp.Format("There are %7x free Kbytes of virtual memory.\n",stat.dwAvailVirtual/1024);<br />
csOut+=cstmp;<br />
pEx->Delete();<br />
AfxMessageBox(csOut); <br />
}<br />
...<br />
}
When I called FuncA() to allocate memory and if I called another function beforre, system will throw out CMemoryException.
But if I called FuncA() to allocate memory and I don't called another function, sysem will not throw out CMemoryException.
When system throw out CMemoryException, I tried to print out the usage status of memory.
The result is as below
The MemoryStatus structure is 32 bytes long.
It should be 32.
36 percent of memory is in use.
There are 2096100 total Kbytes of physical memory.
There are 1321288 free Kbytes of physical memory.
There are 4041780 total Kbytes of paging file.
There are 3615048 free Kbytes of paging file.
There are 1fff80 total Kbytes of virtual memory.
There are 70e94 free Kbytes of virtual memory.
I think system has enough memory but I can't allocate successfully.Why? Could anybody give me some suggestions? Just like adjust some parameters for complier or OS.
Regards,
Pogo
|
|
|
|
|
One thought - you are allocating this in one big chunk of 256Mb.
Have you tried doing 16 lots of 16. and seeing how it fails?
And check the available RAM after each chunk of allocation to see if it drops nicely as expected.
Iain.
|
|
|
|
|
OK~ I see! I will try. Thanks for your suggestion.
|
|
|
|
|
Pogo Lin wrote: I think system has enough memory...
But is there a contiguous 256MB chunk?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I don't know. Could you tell me how to check that system has a contiguous 256MB chunk?
Thanks a lot.
|
|
|
|
|
I have a little problem for using SaveAs in outlook
Can someone tell me how to assign the parameter for olVCard ?
It is a variant, but I always fail. I don't know why.
Outlook::_ContactItemPtr pContact = NULL;
lpDispatch->QueryInterface(IID__ContactItem, (void**)&pContact);
if(pContact)
{
_variant_t VAR = vtMissing;
VAR.intVal = OlSaveAsType::olVCard;
HRESULT hr = pContact->SaveAs(L"c:\\11.vcf",VAR);
assert(SUCCEEDED(hr));
}
Reference:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/jul07/hey0724.mspx
On Error Resume Next
Const olFolderContacts = 10
Const olVCard = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
For Each objContact In colContacts
strName = objContact.FirstName & objContact.LastName
strPath = "C:\Test\" & strName & ".vcf"
objContact.SaveAs strpath, olVCard
Next
|
|
|
|
|
faulfish wrote: ...but I always fail.
What is this supposed to mean?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all!
i need help.. i m calling fileRead function which reads the file and put some values in three strings cName1 ,cSvnPath1 ,cPassword1...now my question is ...that how should i call this function in main file so that these three strings can be utilised in main file only...??? please answer as early as possible.
void FileOperation::fileRead(char cName[100] , char cSvnPath[100] , char cPass[100])
{
char cName1[100];
char cSvnPath1[100];
char cPassword1[100];
FILE *fp;
fp = fopen("config.txt","r");
fgets(cName1 , 100, fp);
fgets(cSvnPath1 ,100 , fp);
fgets(cPassword1 ,1 ,fp);
fclose(fp);
}
|
|
|
|
|
1) i don't understand your question
2) i don't understand your code either
3) no need to say "i need help" (if you ask something, it's obviously because you need help), nor "please answer as early as possible" (people do reply when then know the answer... if no one reply you, it's because no one knows, or no one got your question).
so, i ask you the question. What is it you're trying to achieve, and what have you already tried ?
what do you mean by "these three strings can be utilised in main file only" ??
|
|
|
|
|
I simply mean that i m calling fileRead() in main()..i have other three strings ...a[] ,b[],c[]...now i want that data from cName1 ,cSvnPath1 and cPassword1 should get passed in main to Strings a, b, c respectively..i hope u'll get it now..So, how can it be done..i m getting problem in initialising...thanks.
|
|
|
|
|
toxcct wrote: if you ask something, it's obviously because you need help
Simple, yet powerful.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My comments to your code:
Why do you get 3 char-arrays as parameters, but never use them?
Instead you are putting your read data into local variables (which will get destroyed upon leaving the function).
You definitely want more error checking when opening the file and reading the data.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
these mistakes r becoz i was trying something to get solution but i did nt get..i want these local variables to be passed to main function
|
|
|
|
|
dona jain wrote: i want these local variables to be passed to main function
Why?
Wouldn't it be better to pass the buffers from Main to your function?
Local variables get destroyed on leaving their scope.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
well this is my requirement to do so..thats y i m here
|
|
|
|
|
Ranjoy Guha already programmed you a function which you simply need to give the buffers as parameters:
char buffer1[100];
char buffer2[100];
char buffer3[100];
FileOpration fcRead;
fcRead.fileRead( buffer1, buffer2, buffer3); Now look at buffer1, 2, 3 in the debugger.
As a side-question:
Do you really desire to learn C?
And why do you ask your questions in a C++/MFC-Forum?
The C++ way of reading a file would be std::ifstream .
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: And why do you ask your questions in a C++/MFC-Forum?
man, don't be rude on this... there's no C board, and most C++ programmer can understand a C problem.
but the problem of the OP is that he doesn't know anything (maybe VB...) but he doesn't want to learn either
|
|
|
|
|
void FileOperation::fileRead(char cName[100] , char cSvnPath[100] , char cPass[100])
{
//char cName1[100];
//char cSvnPath1[100];
//char cPassword1[100];
FILE *fp;
fp = fopen("config.txt","r");
fgets(cName , 100, fp);
fgets(cSvnPath ,100 , fp);
fgets(cPass ,100 ,fp);
fclose(fp);
}
Now use the arguments in your main file
|
|
|
|
|
ohh..thanx...can u tell me how to call this function in main
FileOpration fcRead;
fcRead.fileRead();
this or something else??
fileRead() --> is this correct?
|
|
|
|
|
You just pass the arguments you want to your function. Calling a function and passing parameters is basics C++ so I really suggest you read some book before going on with classes otherwise you'll get totally lost.
|
|
|
|
|
dona jain wrote: can u tell me how to call this function in main
oh my god !!!
you know what ?
stop this immediately, go to a book shop, find Kernigan & Ritchie's Book about the C language, and read (i mean, read and LEARN) !!!
then you'll find all this becoming very easy
|
|
|
|
|
char cName[100];
char cSvnPath[100];
char cPass[100];
fileRead(cName, cSvnPath, cPass);
|
|
|
|
|
Hey..its working now...u r realy a nice person here ..others always uggest book..never answer me properly.
Thank A lot
|
|
|
|