|
Should have said that the suggestion will only help you debug a release version of an app. Not necessarily find this specific problem.
You could try the Exception dialog in the Debug menu. Only available during debugging. It lets you control debugger behaviour in the event of an exception. Can be useful but time consuming.
|
|
|
|
|
Not enough information. Can you list the call stack? The OS version. A list of loaded DLL's and their versions and base addresses?
Steve
|
|
|
|
|
I have a class derived from CDialogBar.
I create it in CMainFrm::OnCreate()function.
Used- EnableDocking(0) and FloatControlBar(), ShowControlBar() fuinctions to show, set poesition and set size of DialogBar.
Now it works well.
But in one condition (Say by clicking on some Menu) I dont want Dialogbar to be moved elsewhere. Meaning positions for Dialogbar should get locked. . Again by clicking on same menu it should be moved anywhere.
This is the requirement.
Now I tryed everything for making it FIXED at one place with
OnMOve() for dialogBar. With SetWindowpos() function.
For SetWindowPos() I tryed last flag parameter to be NORESIZE but it didnt worked. To confirm that this function works I tryed SWP_HIDEWINDOW then it hides the window.
Is there any way that I can toggle between FIXED position mode and Moving mode for Dialogbar???
Parametrs passed to create of Dialogbar
CBRS_BOTTOM | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
Is there any message I can get in MainFrame when I am resizing the DialogBar...
AmolM
|
|
|
|
|
Did you try to modify the window style?
If this does not work, AFAIK, you should override your CDialogClass and block the resizing from within, that is to forbid to resize it with the mouse if a boolean set by your menu item is true.
Aamol M wrote: SetWindowPos() I tryed last flag parameter to be NORESIZE but it didnt worked.
The SWP_NOSIZE flag is used to specify that the SetWindowPos function arguments relative to resizing won't be used.
Jouir et faire jouir sans faire de mal ni à toi ni à personne, voilà je crois le fondement de toute morale
Fold with us! ¤ flickr
|
|
|
|
|
ModifyStyle() will work if I remove the caption Bar of it BUT it does not look good. AND requirement is just to make it locked without removing caption abr.
Sorry. I have used SWP_NOMOVE flag for not moving the DialogBar...
My problem is I want to LOCK the positions in one case and unlock the positions (user can move it anywhere in other case.
But what should I override in my class???
I handled OnMove(), OnSize() every other meaage in DialogBar class but it doesnt come there at any time.
Is there anything I get notified in CMainFrm OR myDialogBar class that dialogBar is about to move....
I also handled WM_CAPUTRECHANGED message in DialogBar class. Control comes here when I release the capture from that dialogBar. But even at this time I call FloatControlBar() to some fixed position then also it doesnt work.
I have read somewhwre that DialogBar notification are sent to the parent window. In this case CMainFrm. But I didnt get it.
In CalcDynamicSize() handler of Dialogbar class, control comes here when we even click on caption bar of it. But there also I cant do anything to set the positions to default. I have uesed FloatControlBar() here.
AmolM
|
|
|
|
|
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
|
|
|
|