|
to go to Solution explorer Ctrl + Alt + L
to go to resource view ctrl + shift + e
|
|
|
|
|
I have a visual c++ program, it worked nicely for data processing.
Recently I added a edit box and add more code in the "next" subroutine.
The program is complied and generated *.exe successfully. This routine
should be invocated by pressing "Next" button.
Now when I run the program and push the "Next" button, I got:
<data_proc mfc="" application="" has="" encountered="" a="" problem=""
and="" needs="" to="" close.="" we="" are="" sorry="" for="" the="" inconvenience.="">
I tried to display some variable values at the right beginning of
the subroutine Next, it seems the program even not reach the point.
I do not know how to fix this. I need a help.
Thanks
-- modified at 23:56 Sunday 9th April, 2006
|
|
|
|
|
hi there
paste the code which is called in the event handler ..
redindian
|
|
|
|
|
#include <string>
#include "stdafx.h"
#include "data_vib_proc.h"
#include "feature_display.h"
#include "data_vib_procDlg.h"
#include "test_window.h"
#include "cmath"
using std::string;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CData_vib_procDlg dialog
CBlast_vib_procDlg::CBlast_vib_procDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBlast_vib_procDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CData_vib_procDlg)
m_linklist_file_Name = _T("");
m_monitors_coord = _T("");
m_output_file_name = _T("");
m_seed_waveform_input = _T("");
m_predicted_waveform_output = _T("");
m_prediction_monitor_no = 1;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
....
....
....
void CData_vib_procDlg::Next()
{
FILE *f_ptr1;
FILE *f_ptr2;
FILE *f_ptr3;
FILE *f_ptr4;
FILE *f_ptr5;
const int MAX=15;
CString title_seed_file;
// ifstream f_ptr3;
float f0 = 30.0;
int nz,nz1,ndeck2;
float ppv_pred, ppa_pred, pi = 3.1415926f;
char buffer[MAX];
CBlast_vib_procDlg rr;
feature_display ff;
test_window twindow;
// TODO: Add your control notification handler code here
//
twindow.m_test_variable = int(1.5);
twindow.DoModal();
UpdateData(false);
UpdateData();
if(m_linklist_file_Name == "" || m_monitors_coord == ""||m_output_file_name=="" || m_si_waveform_input == ""||m_predicted_form_output=="")
{
MessageBox("All file names have to be typed in !");
rr.m_linklist_file_Name = m_linklist_file_Name;
rr.m_monitors_coord = m_monitors_coord;
rr.m_output_file_name = m_output_file_name;
rr.m_si_form_input = m_si_form_input;
rr.m_predicted_form_output = m_predicted_form_output;
rr.m_prediction_monitor_no = m_prediction_monitor_no;
rr.DoModal();
UpdateData(false);
}
// open linklist data file
if((f_ptr1 = fopen(m_linklist_file_Name,"r")) == NULL) {
MessageBox("Linklist file open problems !");
rr.m_linklist_file_Name = m_linklist_file_Name;
rr.m_monitors_coord = m_monitors_coord;
rr.m_output_file_name = m_output_file_name;
rr.m_si_form_input = m_si_form_input;
rr.m_predicted_form_output = m_predicted_form_output;
rr.m_prediction_monitor_no = m_prediction_monitor_no;
rr.DoModal();
UpdateData(false);
}
// open monitor coordinates data file
.....
.....
|
|
|
|
|
Set a breakpoint in the Next() method and single-step through it from that point.
mrby123 wrote: twindow.DoModal();
Is this dialog displayed?
mrby123 wrote: UpdateData(false);
UpdateData();
Consider removing these. Used incorrectly, which it looks as though they are, can lead to all sorts of unwanted problems.
What does the message map for CData_vib_procDlg look like?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I tried to set-up a breaking point inside "Next", but the program did not go that far (even the breaking point at the beginning of the "next") and stoped to give the error message.
I am thinking some of the array size in the program is too big causing overflow. That may be the problem.
|
|
|
|
|
mrby123 wrote: I tried to set-up a breaking point inside "Next", but the program did not go that far
Does the "Next" button have an ON_BN_CLICKED() handler? What does the message map for CData_vib_procDlg look like?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
here is the message-map:
BEGIN_MESSAGE_MAP(CData_vib_procDlg, CDialog)
//{{AFX_MSG_MAP(CData_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()
|
|
|
|
|
Hmmmm, if you've set a breakpoint in the Next() method and it is not being hit, I do not know what the problem is.
You mentioned something about an array. Does your program have them? Are they on the stack or the heap?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Now I found the array size is too big (global array - stack ?)
I get into the Next subroutine. I put a few breaking point and I checked the reading
all right.
However, I got:
"Debudg assertion failed."
what is the problem and how to fix it ?
Thanks
|
|
|
|
|
mrby123 wrote: Now I found the array size is too big (global array - stack ?)
How is it declared? How large is it?
mrby123 wrote: I get into the Next subroutine.
What statement?
mrby123 wrote: However, I got:
"Debudg assertion failed."
what is the problem and how to fix it ?
That's hard to say without knowing what line of what file asserted.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Are there any necessary apis that I should know?
I think my question was too short to understand. I want to disable internet using(such Web browsing,Chat or anything using internet) by press a button and can use internet again by press another button.
I want to know how to stop internet in windows 98.
I'm not good at English sorry.
-- modified at 3:18 Tuesday 11th April, 2006
|
|
|
|
|
What is an "apis?" What are you wanting to know?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
T532 wrote: Are there any necessary apis that I should know?
actually what you want ot do.. close internet connection or something else, if internet connection hook InternetDial api
|
|
|
|
|
DEF Files seem to have gone out of fashion. Where do I find an Authorative account for Syntax and Options.
Immediate Needs: Shared Data Sections in a DLL
A Forwarder DLL:
'MyApi=ANOTHERDLL.?PrivateMyApi@@YAKKKKK@Z'
LateNightsInNewry
|
|
|
|
|
LateNightsInNewry wrote: DEF Files seem to have gone out of fashion.
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I have seen your See Here, and read all that, What it does not explain is the Syntax of Forwarding a Function. DEF Files seem to have gone out of fashion to the extent that the only help the IDE gives, is, (in my version anyways), that All you can do in a DEFFile, can be done better by using command line options for the Linker/ Compiler. I know that not to be the case, but hence my question.
LateNightsInNewry
|
|
|
|
|
I want to draw a bitmap,(droughts for example)on dialog,
at mouse's coordinate when it's pressed !
Could you help me !
Lgx
|
|
|
|
|
This is Not a simple Problem, and a Full solution for your own custom application will resort to a long list of API's
The Outline would be as follows:-
-Create a Dialog with a Bitmap Resource in it.
-Assign a Bitmap
-In the Dialog, implement the OnPaint Method to paint the Bitmat,taking account of where you want it painted.
-Use the WM_MOUSEBUTTON messages to capture the mouse when it is clicked over the immage
-Use the WM_MOUSEMOVE messages to track the mouse, and to issue WM_PAINT messages to keep the image following the mouse.
(The Latter is not as simple as it seems)as you will discover.
You will also see that the easier UpdateWindow Call does not work for this in a dialog, it only sends a WM_PAINT after you finally release the mouse button.
As I said, Not a simple task, there is not a single API available that does the lot, Also, not a task for beginners(Choose something simpler, i.e. Move the Image to where the mouse was released, without dragging), at the same time, we all have to start somewhere. The prize is, that when you master this, you have learned a lot about the Windows API.
Let me know how you get on
Regards
LateNightsInNewry
|
|
|
|
|
thank you !
i am studying to build a program that play chess(or gomoku) over LAN !
i will build it step by step !
there are very much so program !
when you click mouse on coordinate(x,y) on the board,
drought (stone) will paint !
i want also do that !
have you ever done that ?
Lgx
|
|
|
|
|
No, I have never build a program that play chess(or gomoku) over LAN !.
However, I see that you are taking on a very complex task. If I where you, I would break the task up into a number of DLL's
Seeing that you want to play some sort of game over a network, you will need somewhere where the score is kept, i.e. a server for the purpose of the game.(This need not be the Network Server). The way I would write this would be, Game server Software, which keps track of the various games being played, and which would need no other interface than something to keep track of players and scores, and Client software, which monitors the Game moves, and communicates same with the Game server. The game Server in this case would be the final arbitor on the legality, or otherwise, of any moves.In this scheme of things, you need to think first of exchange protocols for this type of information, implementation of game rules, etc, etc.
I would be inclined at the development stage at least, to implement the clients as a console program, i.e. a Chess Move is implemented by a client by typing something like "E2->E4!, and getting back an error message like: "Err 4087: Sorry, The Piece on Field E2 is a Knight, For a Knight the move E2->E4 is Illegal". After you have this Up,Going and Debugged, you can write some beautiful graphics to simulate the game, using essentially the same messaging service to the server.
Hope this is Usefull,
LateNightsInNewry
|
|
|
|
|
http://www.codeproject.com/internet/renju.asp[^]
thank you for sincere advice !
sorry for my bad English !
the game that i want buid that don't need game server !
for example, game :HalfLife,age of empire,...
all is only a program !
when a person run game program, that person can establish
that is server program, other persons who want join in will click "show all game" and see a game that they want play with and therefore this program is client !
score and other information is stored temporality, when game over, that information is lost.
the game that i want buid is don't need in real time mode
it's turn move by move !
especial, i want that : when game is being played, everybody can see all game is playing, opening(that game is created but nobody join in)
the this game have many characteristic similar to multiuser chat program !
the link i wrote upper is renju game program over LAN
i hope that you will for me many your advice !
see you !
|
|
|
|
|
I think you are doing this the wrong way.
First you don't really to handle the WM_MOUSEMOVE message unless you are drawing to a particualr size or dragging a bitmap across the screen.
Second, you don't need to draw the bitmap to the exact position of the mouse for the game you have mentioned.
Consider this. you have a checkerboard, each square being 20x20 pixels, you have a checker piece 15 pixels in diameter. now, if the user clicks the board at say 5,5 of a square (upper left corner), and you draw the piece (from the center) at these coordinates, the piece will overlap into the neighbouring squares.
Here's your solution. create a map of your board (an array holding position of each square). Check for user mouse clicks, when user clicks, check the position against those in your array to find the square. Then draw the bitmap to the center of that square.
This type of game is called a "tile based game", a search on google will yield many results. Also if you are keen to start coding games, I would recomend a library called Allegro, which enables you to handle bitmaps and user input very easily.
|
|
|
|
|
of course as you say about overlap
the thing that i want say is how to paint a bitmap when mouse click event happened and location that bitmap is drawed is belong to coordinate of mouse !
i tryed many code but if i minimize the dialog of program,
then nothing to see!
void CGomokuDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if((nFlags & MK_LBUTTON)== MK_LBUTTON)
{
//get Device context:
CClientDC dcc(this);
//draw pixel:
dcc.SetPixel(point.x,point.y,RGB(0,0,0));
}
CDialog::OnMouseMove(nFlags, point);
}
void CGomokuDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CClientDC dc(this); // device context for painting
CBitmap bitmap;
bitmap.LoadBitmap (IDB_BITMAP1);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap* pOldBitmap = dcMem.SelectObject(&bitmap);
CPen pen1(PS_SOLID,16, RGB(255,100,0));
dc.SelectObject(&pen1);
//dc.StretchBlt(100, 130, 20, 20, &dcMem,
// 0, 0, 20, 20, SRCCOPY);
dc.MoveTo(0,0);
dc.LineTo(30,400);
CDialog::OnLButtonDown(nFlags, point);
}
-- modified at 22:14 Sunday 9th April, 2006
|
|
|
|
|
See the following link
<a href="http://www.codeproject.com/buttonctrl/hoverbutton.asp" rel="nofollow">http:
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|