|
(This is getting surrealistic )
Won't you have by chance forgotten returning from OnSelectDatabase right after posting the quit message? If you have, then more code could be subsequently be executed that is causing the crash.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
So even after posting message (I also tried SendMessage) one needs to return! Esp sendMessage I thought would finish the app off immediately, so no return was needed, but apparently not!
Many many thanks.
ns
|
|
|
|
|
I have to take off for a couple of hours. I truly appreciate all the input. I'll be struggling with this later today, so if you are still around....
|
|
|
|
|
|
I've got a go to a party dinner in a few minutes, so the break's also good for me.
If you don't get to solve the problem and don't mind other's eyes peeping your code, zip your project and send it to me: I'll be able to load it into my VC++ next monday and could do a more thorough check.
Bye
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I didnt do a return; in my code after postmessage. No one (except for the latest post) said I had to.
Now I have
if(nRetValue == IDCANCEL)
{
AfxMessageBox ("No Image folder selected, terminating application");
AfxGetMainWnd()->PostMessage(WM_CLOSE);
<code>return</code>;
}
and by golly it works. I didnt think or imagine I'd need return.
Sorry if I've been an idiot and wasted everyones time!
ns
|
|
|
|
|
Wow! You'd actually help debug my code!!! I thank you so much for the offer. You resolved it this time, so I hope I can take a raincheck on your offer (too good!) next time I have a perplexing crash! Hope you enjoyed the party.
Thank you,
ns
|
|
|
|
|
I'm glad I was of an help. The party was fine, thanx. Happy programming.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Another debugging test. Omit the call to CFileDialogST within the view command handler and simply post the quit message. Still crashing?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yes. I commented out the CFileSt stuff and put in a plain old AfxGetMainWnd()->PostMessage(WM_CLOSE);..it crashed.
WHat does this mean?
Thanks,
ns
|
|
|
|
|
Well, we have ruled out the CFileDialogST bit, at least possibilities are shortening.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I appreciate all your help!
|
|
|
|
|
Use AfxGetApp ()->CloseAllDocuments () . I am nearly sure that this is gonna work
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
<nobr>They say I'm lazy but it takes all my time
|
|
|
|
|
Sorry, use it this way:
AfxGetApp ()->HideApplication ();
AfxGetApp ()->CloseAllDocuments (TRUE);
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
<nobr>They say I'm lazy but it takes all my time
|
|
|
|
|
I did. It ignored it and went on to pop up another CFILedlg (the following code doe s that). Now fromn this second CFiledlg I have been able to cancel without problems before, but this time it crashes (the second dialog I meaqn. The first one just ignores it and goes away)
|
|
|
|
|
Hi all,
I'm having a very difficult time trying to display a bunch of data to a view and to the printer.
I'm using MFC's document/view arch with a single view derived from CScrollView. What I'm trying to do is based on the file opened by the user, I generate a document (which is more like a datawarehouse containing info retrieved from the file, NOT in the same format in the file). From that document I am trying to display a text-based view to the screen using CDC's text output functions and the Gdi objects to change the colors, font, etc.
My problem is getting the text to look presentable. I seem to be missing something in how to approach drawing the text in such a way that it has rows/columns and is centered and aligned properly. An example is this:
General Info
Data 1: somedata
Data 10: mordata
....
Does anyone have any suggestions? I don't know a ton about MFC so I don't know if I can changes things quickly other than the way the text is being drawn.
Any suggestions, comments or ideas are GREATLY appreciated.
Thanks!!
Dan
|
|
|
|
|
What you're trying to do is very messy, to say the least. A simpler alternative is to use CHtmlView and format your data for presentation as a simple HTML doc.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquin,
Thanks for the advice. That does seem much easier than what I was attempting. I could just create and HTML document and then display that document in the view. But there is still another issue that I'll have which I'm unsure how to approach using this method. I need to be able to print the document from my current application, preferably allowing the print preview as well. Any suggestions as to how I can do this? Is there any difference than using CScrollView? I really need to be able to print from my app.
Any suggestions/comments/ideas are GREATLY appreciated.
Thanks!!!!!
Joaquín M López Muñoz wrote:
What you're trying to do is very messy, to say the least. A simpler alternative is to use CHtmlView and format your data for presentation as a simple HTML doc.
|
|
|
|
|
|
Thanks! You just made my life much much easier. Now I just need a refresher on HTML which is nothing. I ran some examples of the print and it works alright. I just need to be aware of page limits and so on when printing. I have to take a step backwards a little becuase of the change from CScrollView to CHtmlView, but in the long run it makes my programming time much much shorter.
Thanks!!
Dan
|
|
|
|
|
capDlgVideoFormat is a dialog box to allow user to select resolution dib image but instead of that , i wish to fix the resolution to 640 x 480 :
BITMAPINFO bi;
capGetVideoFormat( ghWndCap, &bi, sizeof(bi));
bi.bmiHeader.biWidth = 640;
bi.bmiHeader.biHeight = 480;
capSetVideoFormat (ghWndCap, &bi, sizeof(bi));
what i got is image resolution (saved image ) remain as 320 x 240, and what i see is a totally black image. What went wrong ?
Anyone familiar with this pls help ?
|
|
|
|
|
Your code is OK (I've used somehing similar in the past without problems). Most probably, the video grabber you're using does not provide the resolution you're asking for. Some allow for any resolution up to a maximum, others only a few predefined sizes. If the device you're using comes with its own video recording program (as most do), you might want to take a look at it to determine which resolutions are available.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi
Thanks for the reply, u were saying that the problem could be cause by the the video grabber, sorry but what is a video grabber? is it the software that controls the webcam ? I actually verify this using another application available : http://codeguru.earthweb.com/multimedia/AviCap.shtml
i modified the codes to fix the resolution, and still, it gives me a black screen. Could the problem be caused by the web cam itself ? what webcam will be better then ?
Thanks in advance!
Chu - Alan
|
|
|
|
|
Well, by "video grabber" I meant the webcam you're using with yopur program. Many webcams allow only for a few dimensions to be set.
Does your program work at all with the webcam. If the app you mentioned manages to get some video, then the problem most likely is in your program, not in the webcam itself. COmpare your code with that of http://codeguru.earthweb.com/multimedia/AviCap.shtml and try to find significative differences.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hi
i got what u meant. i actually suspected that the problem lays in the webcam more than it lays in my app. As mentioned, i modify the app found in : http://codeguru.earthweb.com/multimedia/AviCap.shtml to fix the resolution as indicated in my 1st thread, and this modified app gives me the same result as my app. : black screen .
i really need to further conclude by getting another webcam to try it out. Thanks for ur wonderful advice !!
|
|
|
|