thank you sanjaylk. it really helped. Regards Jawad
jawadali477
Posts
-
Use of Multiple Check boxes in MFC -
Use of Multiple Check boxes in MFChi, i am using multiple Check Boxes in my GUI and i wanted that only one gets checked at a time i.e when one Check Box gets checked by user the others should automatically get unchecked. i can't use Radio Buttons since i don't find its "Auto" check and uncheck from "Behavior" in its "Properties" in vs2008. any help in this regards please. Regards Jawad
-
(SOLVED) make single executable file in vs2008 (MFC)thak you so much pasztorpisti. that was really helpful :-) Regards Jawad
-
(SOLVED) make single executable file in vs2008 (MFC)sorry, i didn't understand. what kind of bug we are talking about? i didn't understand the reason behind this. can you please tell me why this behavior is happening (i.e running fine in debug mode but in release mode, opens one port and not the other)? Regards Jawad
-
(SOLVED) make single executable file in vs2008 (MFC)thank you pasztorpisti for your reply. i configured my project to release mode from Configuration Manager and did what you earlier suggested. it builds without errors but when i run exe file, one of the serial ports does not open and gives error 0x7B (system error code). it runs fine (both serial ports open) when build in debug mode. any idea what is happening? Regards Jawad
-
(SOLVED) make single executable file in vs2008 (MFC)hi, i have developed program using MFC in vs2008 and now trying to build single executable file (.exe file) so that it can be used on other PCs. my source file contains both .c and .cpp files. i have tried to compile/build the program in Release mode but getting errors like:
fatal error C1853: 'Release\readtxtfile.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)
so i changed the properties of precompiled header from Use Precompiled Header (/Yu) to Create Precompiled Header (/Yc) and now i'm getting errors like:
error C2857: '#include' statement specified with the /Ycstdafx.h command-line option was not found in the source file
can anyone help me in this regard. i.e how to make executable file with source file containing both .c and .cpp files. Regards Jawad
-
set focus to main dialog form in MFC (SOLVED)thank you Richard MacCutchan.
-
set focus to main dialog form in MFC (SOLVED)hi, i have developed program where two separate windows, one containing Map and other the dialog form with some controls, are opened. the program is when i click on Map window, its coordinates are displayed in the static text on the dialog form window. what i want is that when i click on Map window (which is at the front at the time of clicking) the dialog form window should appear at the front showing the results of my click, i.e the coordinates. Regards Jawad
-
need help Opencv with MFC (Solved)thanks you Richard MacCutchan for your replies. that was really helpful.
-
need help Opencv with MFC (Solved)i'm new in programming, specially in MFC. my understanding of handle is weak. so can you please help me in this regard. means how to pass the handle of dialog window to SetDlgItemText()? any example please. Regards Jawad
-
need help Opencv with MFC (Solved)hi, i am developing code using Opencv and MFC in vs 2008. i am getting error:
error C2660: 'SetDlgItemTextW' : function does not take 2 arguments
the complete code is:
//headers files included
#ifdef _DEBUG
#define new DEBUG_NEW
#endifvoid mouseEvent( int evt, int x, int y, int flags, void* param );
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
.......
.......
protected:
.......
}:
........
........
........BEGIN_MESSAGE_MAP(Copencv01Dlg, CDialog)
.......
.......
END_MESSAGE_MAP()// Copencv01Dlg message handlers
BOOL Copencv01Dlg::OnInitDialog()
{
CDialog::OnInitDialog();........ ........ MoveWindow(0, 0, 500, 500, 1); AfxBeginThread(MyThreadProc, this); return TRUE;
}
UINT Copencv01Dlg::MyThreadProc(LPVOID pParam)
{
Copencv01Dlg * me = (Copencv01Dlg *)pParam;
me->MyThreadProc();
return TRUE;
}void Copencv01Dlg::MyThreadProc()
{cvNamedWindow("MyWindow"); //assigning the callback function for mouse events cvSetMouseCallback("MyWindow", mouseEvent, 0); IplImage\* img = cvLoadImage("box.png"); cvShowImage("MyWindow", img); cvWaitKey(0); cvDestroyWindow("MyWindow"); cvReleaseImage(&img);
}
void Copencv01Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
........
........
}void Copencv01Dlg::OnPaint()
{
.........
.........
}HCURSOR Copencv01Dlg::OnQueryDragIcon()
{
return static_cast(m_hIcon);
}
void mouseEvent(int evt, int x, int y, int flags, void* param)
{
if(evt==CV_EVENT_LBUTTONDOWN){
CString cx, cy;
cx.Format(_T("%d"), x);
cy.Format(_T("%d"), y);
SetDlgItemTextW(IDC_Blue, cx); //error generating line
SetDlgItemTextW(IDC_Green, cy); //error generating line
}
}can anyone help me with this errors? Regards Jawad
-
help: image coordinates(x,y) in opencv with mfchi, i'm still stuck with the dialog handle. i have posted the complete code. please i need help. Regards Jawad
-
help: image coordinates(x,y) in opencv with mfchi, i'm still stuck with the dialog handle. i have posted the complete code. please i need help. Regards Jawad
-
need help: image coordinates(x,y) in opencv with mfc Pinthank you Richard MacCatchan for replies. i have implemented MFC based application using picture control. i have included bitmap image in picture control and have defined subclass where i have used
OnLButtonDblClk
to get the co-ordinates of picture control (not image u know) in static box. and it works fine. but i have some questions and need help. 1. how to implement zoom in/out an the scroll option (for large image sizes)? 2. when applying zoom in/out, will the pixel co-ordinates change (i mean if a point is lying on say (x,y) in picture control before zoom in what will happen to its co-ordinates after zoom in)? Regards JAwad -
need help: image coordinates(x,y) in opencv with mfc Pinthank you Richard MacCutchan for your replies. i did use
m_hWnd
inSetDlgItemText()
in first place, but at that time it gave the error asm_hWnd :undeclared identifier
. you see i'm using a thread to call mouse function. do i need to redefinem_hWnd
?? if yes, where?? -
need help: image coordinates(x,y) in opencv with mfc Pincan you please elaborate it because i didn't get your point i.e
"pre-defined CWnd::m_hWnd[^] variable which contains the handle to your object's window."
you see, i'm not good in programming with handles. :( -
need help: image coordinates(x,y) in opencv with mfc Pini have checked it with some other examples. works fine. but for this program it does not display the coordinates in static boxes. am i defining the handle HWND hwnd correctly??
-
need help: image coordinates(x,y) in opencv with mfc Pinhi, below is the complete code that i have developed using opencv with MFC in vs2008. it builds fine and after debugging it shows two different windows, one containing image and other containing static boxes. the purpose of this code is to display image coordinates (x,y) in static boxes but when i double click on the image window (which is my mouse event), values of (x,y) coordinates are not displayed in the static boxes (static boxes are in the separate window). please pardon my mistakes.
#include "stdafx.h"
#include "opencv01.h"
#include "opencv01Dlg.h"
#include "highgui.h"
#include "afxwin.h"
#include "cv.h"
#include "math.h"
#include#ifdef _DEBUG
#define new DEBUG_NEW
#endifvoid on_mouse( int evt, int x, int y, int flags, void* param ); //defining mouse event
HWND hwnd; //defining handleclass CAboutDlg : public CDialog
{
public:
CAboutDlg();enum { IDD = IDD\_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange\* pDX); // DDX/DDV support
protected:
DECLARE_MESSAGE_MAP()
};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()Copencv01Dlg::Copencv01Dlg(CWnd* pParent /*=NULL*/)
: CDialog(Copencv01Dlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}void Copencv01Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}BEGIN_MESSAGE_MAP(Copencv01Dlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()// Copencv01Dlg message handlers
BOOL Copencv01Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);CMenu\* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS\_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF\_SEPARATOR); pSysMenu->AppendMenu(MF\_STRING, IDM\_ABOUTBOX, strAboutMenu); } } SetIcon(m\_hIcon, TRUE); // Set big icon SetIcon(m\_hIcon, FALSE); // Set small icon AfxBeginThread(MyThreadProc, this); //calling thread return TRUE; // return TRUE unless you set the focus to a control
}
UINT Copencv01Dlg::MyThreadProc(LPVOID pParam)
{
Copencv01Dlg * me = (Copencv01Dlg *)pParam;
me->MyThreadProc();
return TRUE; -
help: image coordinates(x,y) in opencv with mfchi, below is the complete code that i have developed. it builds fine and after debugging it shows two different windows, one containing image and other containing static boxes. but when i double click on the image window (which is my mouse event), values of (x,y) coordinates are not displayed in the static boxes (static boxes are in the separate window). please pardon my mistakes.
#include "stdafx.h"
#include "opencv01.h"
#include "opencv01Dlg.h"
#include "highgui.h"
#include "afxwin.h"
#include "cv.h"
#include "math.h"
#include#ifdef _DEBUG
#define new DEBUG_NEW
#endifvoid on_mouse( int evt, int x, int y, int flags, void* param ); //defining mouse event
HWND hwnd; //defining handleclass CAboutDlg : public CDialog
{
public:
CAboutDlg();enum { IDD = IDD\_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange\* pDX); // DDX/DDV support
protected:
DECLARE_MESSAGE_MAP()
};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()Copencv01Dlg::Copencv01Dlg(CWnd* pParent /*=NULL*/)
: CDialog(Copencv01Dlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}void Copencv01Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}BEGIN_MESSAGE_MAP(Copencv01Dlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()// Copencv01Dlg message handlers
BOOL Copencv01Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);CMenu\* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS\_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF\_SEPARATOR); pSysMenu->AppendMenu(MF\_STRING, IDM\_ABOUTBOX, strAboutMenu); } } SetIcon(m\_hIcon, TRUE); // Set big icon SetIcon(m\_hIcon, FALSE); // Set small icon AfxBeginThread(MyThreadProc, this); //calling thread return TRUE; // return TRUE unless you set the focus to a control
}
UINT Copencv01Dlg::MyThreadProc(LPVOID pParam)
{
Copencv01Dlg * me = (Copencv01Dlg *)pParam;
me->MyThreadProc();
return TRUE;
}void Copencv01Dlg::MyThreadProc()
{
//image initializationIplImage\* img = cvLoadImage("box.png", CV\_WINDOW\_AUTOSIZE);
-
help: image coordinates(x,y) in opencv with mfcsorry for not well explained actually the problem is that static box does not show any value when mouse is being clicked. means it remains unchanged as it was. Jawad