|
There's no errors until the first-chance exception. If that exception isn't handled
then the app will terminate. If the exception is handled, it may or may not be fine,
depending on what code is causing the exception and how it's being handled.
In other words, if the exception is occurring in your code, you may want to look into it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark.
It seems that Exit function and Next Function got these errors because when I hit these buttons I got the message and program terminates.
Thanks again for any ideas.
|
|
|
|
|
If you run the application in the debugger, execution will break when the exception occurs.
You should at that point be able to see the offending line(s) of code.
If the exception didn't occur in your code, you can use the call stack window to
trace back to a point in your code and hopefully find the problem.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark.
I followed your suggestion with break point and I got to Exit function and the program terminated. Here is my Exit function. please see if anything wrong. Thanks again.
//---------------------------------------------
void CBlast_vib_procDlg::OnExit()
{
// TODO: Add your control notification handler code here
//
CDialog::OnCancel();
}
//
here is message map:
BEGIN_MESSAGE_MAP(CBlast_vib_procDlg, CDialog)
//{{AFX_MSG_MAP(CBlast_vib_procDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDNext, Next)
ON_BN_CLICKED(IDExit, OnExit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
|
|
|
|
|
Nothing that should cause an exception there.
Do you get an unhandled exception error or does it just terminate
as expected?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark. I do get error message:
The application encountered a problem and needs to close.WHen I hit the debug button in the message, I got:
"he instruction at "0x0048d044" referenced memory at "0x61746596", the memory could not be "written",Click on OK to terminate the program.
Thanks again
|
|
|
|
|
Looks like a bad pointer. I couldn't possibly guess where and/or how it's getting trashed.
Some debugging is needed!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have to do what, seems to me, is a binary search.
I have different hardware modules "out on the buss" each with its own unique 17 character ascii serial number. Initially, I don't know each's serial number and until I do, I can't communicate with them. I am going to scale down my example to 3 modules each with a 4 character wide alphanumeric (in real life each character can be any of the printable ascii characters)serial number.
Here would be the 3 units and their serial numbers..
Module # Serial #
1 ABG5
2 ABN4
3 BFT9
The way the hardware and software interface works is like this.
If I ask for any serial number starting with 'A', I will get a reply.. But I don't know how many yet.
If I ask for any serial number starting with 'B', the same holds true.
If I ask for any serial number starting with any other character other than 'A' or 'B', I don't get "a hit". Now, I can eliminate any serial numbers that don't start with the letters 'A' or 'B'
Now, I ask for serial numbers starting with 'AA' through 'AZ...A9' and get "hits" for 'AB' only.
I also run through any serial numbers starting with 'BA' through 'BZ...B9' and get one "hit" for 'BF'
This time, I eliminate anything that doesn't start with 'AB' or 'BF'
Each time I get "a hit" I don't know how many. Until I "drill" my way down through all four characters. At some point I will have only "one hit" for each of the serial numbers.
Nowwwwwwwwwwwwwwwwwwwwww.... How can I do this in Visual C++?????
As I mentioned above, I think this would be a binary search. But I am having a hard time figuring out how to "keep score" of the "non-hits" so that I don't waste time trying those on future iterations. Keeping in mind that each serial number is 17 characters wide and can be made up of any of the 95 printable ascii characters
Are there any code snippets that I can "stitch" together to do this....
Thank you in advance
Pierre
|
|
|
|
|
Sounds to me like a binary tree would do what you want. Once you have found the first node, starting with the letter "A", use that node then to find the next highest, either "B" or "AD".
Waldermort
|
|
|
|
|
WalderMort wrote: Sounds to me like a binary tree would do what you want. Once you have found the first node, starting with the letter "A", use that node then to find the next highest, either "B" or "AD".
The more I look at this the more I am no so sure that this is a binary-tree search. A binary-tree search implies that the tree exists and you are searching through it. In my application, I don't think the tree exists. I am creating it right????
|
|
|
|
|
I re-read you origional post and realized that my reply may have been a little wrong.
From what I understand you are applying a brute force attack on the driver to gather the serial numbers?
I would suggest you create a function which given a string will append the characters A-9 and call your driver. If you get a hit, call your function again with the new string ( complete with appended character ). This is a similar way to how files are found on a drive.
Something like this:
void RecurseSearch( LPTSTR szID )<br />
{<br />
TCHAR szSearch[ 128 ];<br />
<br />
_tcscpy( szSearch, szID );<br />
_tcscat( szID, "A" );<br />
<br />
if ( SomeUnknowFunction( szIdSearch ) )<br />
{<br />
RecurseSearch( szSearch );<br />
}<br />
}
Waldermort
|
|
|
|
|
Exactly what I am looking for...
Something that "finds" filenames
YESSSSSSSSSS
|
|
|
|
|
Welllllllllll
I got side-tracked and now I am finally getting back to this. I was able to use a kind-of brute force recursive search. Using my example, it goes through and finds ABG5. I have also figured out a way to keep track of that. My question now is, how can I have it remember to go back and continue searching from ABxx to find ABN4 and eventually BFT9?
Thanks in advance
Pierre
|
|
|
|
|
I am trying to create an application which requires me to open videos taken from an assortment of cameras, both digital still cameras taking motion pictures and standard video camera. As you are probably well aware, each camera has its own type of file storage format. From my research I have found the four most common types that cameras will save video as being mpeg-1, mpeg-2, QuickTime .mov and .avi. From that list you can already see a problem with QT .mov being proprietary.
The functionality I need in any sort of interface with the videos is very simple.
1. Open the file
2. Grab each frame of the video one at a time
2.a. Allow me to do whatever I want to the data because I will not be altering the file in any way
3. Close the file
I will be doing processing on the actual video data (image matrix). I have tried using both the QuickTime API for this application, as well as the Video for Windows API. I began using OpenCV for video access, but it does not have the capabilities I require. According to VFW, if the codec is registered, the API will interface with the video, but that does not seem to be the case with the .mpg file I am testing the interface out on. Windows Media Player and QuickTime both play the video, and I downloaded GSpot, a codec detection algorithm, and know the correct codec is available, but alas...
What I am getting at is that I need a suggestion as to how to accomplish this task.
Do any of you have any suggestions? I would really appreciate it.
The code for processing the video, developed using a .mov converted to a .avi format, is about 80% complete, I just need this interfacing to be able to complete it.
I reject your reality and substitute my own. Adam Savage - MythBusters
|
|
|
|
|
Ctrl Shift F9 will clear all breakpoints in VC 6.0 , however.... being lazy and keyboard challenged I am asking the forum these questions and hoping for some answers.
1. You can add "remove all bookmarks" in Tools->Customize->Commands->Edit
But I cannot find similar icon "Remove all breakpoints"
Side note - why does one need to click on icon to find out what it does?
How about plain vanilla list instead of this “bearware” icon happy approach?
2. You can right click in edit pane gray left border area to manipulate breakpoints.
How can one add, “Remove all breakpoints” to this popup?
Actually – where can you edit this popup anyway?
3. The “Remove all” button is in Breakpoint dialog – why not anywhere else?
4. Years ago there was a macro or Add-in to accomplish this (remove all breakpoints) but of course I forgot where I found it.
Cheers
Vaclav
|
|
|
|
|
in VC6, you can use ctrl-B to open the breakpoint dialog; there you can remove all break points.
|
|
|
|
|
I am using CRectTracker in an MFC 7.1 app and noticed that it works correctly when linking with "shared" MFC but if I "statically" link to MFC, the Cursor disappears when I move the mouse over any of the handles.
I checked an old app that was written in MFC 4.2 and linked "statically" to that MFC and CRectTracker misbehaves as well. It works correctly when linking to "shared" MFC.
Is anyone familiar with this problem and do you know of any workarounds?
|
|
|
|
|
Try adding this to your resource (.rc) file
#include "afxres.rc"
If it's already there, make sure you don't have _AFX_NO_TRACKER_RESOURCES
defined somewhere.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Damn your good!
It's working now.
Thanks for taking the time out to help.
|
|
|
|
|
hi,
i tried to execute the following program(which was given in turbo c++ documentation) in vc++. but it gives an error, that graphics.h can't be found.
so i copied that graphics.h from turbo c to the vc++'s include folder. now it is showing many errors, which i can't resolve(i even don't understand these errors). i am studying c++ in my college. our syllabus include everything from file handling to all oops concepts. but graphics is not covered in out syllabus. so i decided to learn it on my own. but don't know how to start
someone help me please
the following code works perfectly in turbo c, but not in vc++
<br />
#include <graphics.h><br />
#include <stdlib.h><br />
#include <stdio.h><br />
#include <conio.h><br />
<br />
int main(void)<br />
{<br />
<br />
int gdriver = DETECT, gmode, errorcode;<br />
int xmax, ymax;<br />
<br />
<br />
initgraph(&gdriver, &gmode, "");<br />
<br />
<br />
errorcode = graphresult();<br />
<br />
if (errorcode != grOk)<br />
{<br />
printf("Graphics error: %s\n", grapherrormsg(errorcode));<br />
printf("Press any key to halt:");<br />
getch();<br />
exit(1);<br />
}<br />
<br />
setcolor(getmaxcolor());<br />
xmax = getmaxx();<br />
ymax = getmaxy();<br />
<br />
<br />
line(0, 0, xmax, ymax);<br />
<br />
<br />
getch();<br />
closegraph();<br />
return 0;<br />
}<br />
|
|
|
|
|
C++ does not have any "native" "Graphics" support. Most graphics libraries are either vendor specific or API's exposed by the OS.
The Turbo C++ graphics library will be borland specific. You will need to refer to Borlands documentation on how to use it correctly.
A majority of the programmers here probably (just a guess) have more experience and better command of GDI and GDI+ either directly or through avenues such as MFC classes, GDI+ wrapper classes, or .NET.
|
|
|
|
|
Good old Turbo C++ came with its own DOS/Console graphics library. You would need to port/include probably the whole thing for there to be any chance of this working. If all the source was provided, I seem to remember it was, then there's no reason in principle why this wouldn't compile under MSVC. Things have moved on though in the C++ language and you may hit really tricky problems down the line if you persue this.
Functions you're calling in the above code like initgraph , setcolor and graphresult are from the Borland graphics library.
I still have a copy of Turbo C++ on a Win 3.11 virtual PC with many of my old university projects which were developed in Borland Turbo C++ 0.99 and ported to Unix, Solaris and NextStep platforms with no problems although they didn't make use of the graphics library.
Enjoy.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
as mentioned you cannot copy a vendor graphics library for use elsewhere. TurboC's was for itself only. It didn't even work with the borland C compiler after a few versions later.
You can use OpenGL, or DirectX, or a variety of other graphics libraries with VC++.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Thanks for the help.
I am trying to use the following code to read an array of file names. However,
I found all the ftitle[i] used the same memery as ftitle[0]. So after the code read all the array, all array of ftitle[0],ftitle[1],ftitle[2] have all the same value of ftitle[2]: "dogfile3"
CString ftitle[10];
for (i=0;i {
fscanf( f_ptr3,"%s\n", ftitle[i]);
}
//
input data file:
dogfile1
dogfile2
dogfile3
Please help me how to read array of filenames correctly with array of CString?
Thanks a lots
|
|
|
|
|
a CString is not a buffer of char's, and you can't treat it like one.
if you want to use CString, you should use the MFC file classes (ex. CStdioFile).
|
|
|
|