|
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 !!
|
|
|
|
|
First of all you hardware must support 640*480 format.
|
|
|
|
|
Hi all,
I am using a program which generates values in hex and in order to plot I want to convert these values to decimals.
I wonder if there is any free editor which coverts hex values to decimals.
thanks for help
regards
/rsasalm
|
|
|
|
|
rsasalm_ wrote:
I wonder if there is any free editor which coverts hex values to decimals.
Windows Calculator?
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Thanks for reply.
Windows calculator convert one value at a time.
The program I use generate the hex values in a file and it is a big file.
What I want is to paste all the hex values generated from the program and convert them to their corresponding decimal values.
Any help
regards
/rsasalm
|
|
|
|
|
Perhaps something simple like the following could take care of it? Maybe you need to throw in a hex for the input stream also.
#include <iostream>
using namespace std;
int main()
{
int foo;
while ((cin >> foo)) {
cout << foo;
}
return 0;
}
|
|
|
|
|
Not sure if this tool is what you're looking for, but it's really cool nonetheless:
Hex Workshop
Ty
|
|
|
|
|
I'm sure it was asked a hundred times, but I just dont find it.
So, how do I get the screen position (or any position) of MY icon in the system tray? I need it to display a balloon tip pointing toward it.
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
I'm sure you already new this, but in 2k/XP the OS does provide balloon tooltips natively.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Use Shell_NotifyIcon function in ANY win32 OS to set tooltip text. Everything else will be done by windows.
Warm regards,
Vladimir V. Polischuk
AlarIT developer
E-mail: greykite@mail.ru
URL: http://www.alarit.com
|
|
|
|
|
That is really helpful. [imagine sarkastic grin here]
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
yes, i know it and they are f... bad like the normal tooltips. Nope. I want some nice ones. So? How i get the position?
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
I've created an mfc-dll which contains a shared memory zone, to be shared by 2 instances.
The first instance creates the memory zone using CreateFileMapping() . The second instance opens the memory zone using OpenFileMapping() . They both get the pointer to the address of the first byte of the memory using MapViewOfFile() .
That works just fine on a win98 machine. The 2 instances get the same address.
But if we run it on a winNT, the MapViewOfFile returns different addresses for the 2 instances (shared memory huh?). How is that possible?
Here's how I created the memory:
if(bInit)
{
hMapHandle=CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,0,SHMEMSIZE,"XE_MEMORY_MAP");
if(!hMapHandle)
AfxMessageBox("CreateFileMapping failed");
}
else
{
hMapHandle=OpenFileMapping(FILE_MAP_ALL_ACCESS,FALSE,"XE_MEMORY_MAP");
if(!hMapHandle)
AfxMessageBox("OpenFileMapping failed");
}
lpMapAddress=MapViewOfFile(hMapHandle,FILE_MAP_ALL_ACCESS,0,0,0);
if(!lpMapAddress)
AfxMessageBox("MapViewOfFile failed");
if(bInit)
memset(lpMapAddress,0,SHMEMSIZE);
char buf[100];
sprintf(buf,"memory initialised: %d",bInit);
AfxMessageBox(buf);
sprintf(buf,"\tlpMapAddress=%p",lpMapAddress);
AfxMessageBox(buf);
lpMapAddress points to the same address on win98, but not on NT.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|