|
Are your tabs also derived from CDialog?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Yes. But it is solved now. I just overrided OnOK() and OnCancel() in each tab. Thanks for showing interest.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
That's what would have been my suggestion...yourwelcome for the interest.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Hello all,
I would like to know of any software, books or resources I could use to create a software you can boot from the BIOS (basic input-output system), like (1.) you turn on your computer pressing the power button. (2.) You hit the F8 key, (3.) you select boot from CD or from USB [or any other media] (3.) you select the software from what the computer detects and BAM! your software is loading. Something like that.
I've heard of using .img, .lst and just plain files (files without extensions), just like "KonBoot" does (just three simple files).
Simple Thanks and Regards,
Brandon T. H.
Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst).
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
|
|
|
|
|
Brandon T. H. wrote: I would like to know of any software, books or resources
There are some articles[^] here on CodeProject that discuss building your own OS; no doubt they will contain sections on bootstrapping. You can also use Google which will probably have thousands of references.
|
|
|
|
|
hi,
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<stdlib.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
void on_mouse( int evt, int x, int y, int flags, void* param );
HWND hwnd;
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
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 )
: 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()
END_MESSAGE_MAP()
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);
SetIcon(m_hIcon, FALSE);
AfxBeginThread(MyThreadProc, this);
return TRUE;
}
UINT Copencv01Dlg::MyThreadProc(LPVOID pParam)
{
Copencv01Dlg * me = (Copencv01Dlg *)pParam;
me->MyThreadProc();
return TRUE;
}
void Copencv01Dlg::MyThreadProc()
{
IplImage* img = cvLoadImage("box.png", CV_WINDOW_AUTOSIZE);
cvNamedWindow("map", 0);
cvShowImage("map", img);
cvSetMouseCallback("map", on_mouse, NULL);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("map");
}
void Copencv01Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
void Copencv01Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
HCURSOR Copencv01Dlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void on_mouse( int evt, int x, int y, int flags, void* param )
{
CString xaxis, yaxis;
if (evt == CV_EVENT_LBUTTONDBLCLK)
{
xaxis.Format(_T("%d"), x);
yaxis.Format(_T("%d"), y);
SetDlgItemText(hwnd, IDC_Blue, xaxis);
SetDlgItemText(hwnd, IDC_Green, yaxis);
}
}
Jawad
|
|
|
|
|
Use your debugger to check that your mouse event handler gets called when you double click it. Looking at this code it seems to be somewhat complicated by using opencv and MFC; I wonder why you do not just use MFC on its own?
|
|
|
|
|
i 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??
|
|
|
|
|
jawadali477 wrote: am i defining the handle HWND hwnd correctly?
Yes, but you do not initialise it anywhere. In any case you do not need this variable as you already have the pre-defined CWnd::m_hWnd [^] variable which contains the handle to your object's window.
|
|
|
|
|
can 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.
|
|
|
|
|
The pre-defined variable m_hWnd already holds the handle to the window of the dialog, so that is the one to use in your calls to SetDlgItemText() .
jawadali477 wrote: i'm not good in programming with handles. This is something you need to study as it is fairly key to the whole Windows framework.
|
|
|
|
|
thank you Richard MacCutchan for your replies.
i did use m_hWnd in SetDlgItemText() in first place, but at that time it gave the error as m_hWnd :undeclared identifier . you see i'm using a thread to call mouse function. do i need to redefine m_hWnd ?? if yes, where??
|
|
|
|
|
If your mouse handler is not part of the dialog class then you need to store m_hWnd into a global variable in your OnInitDialog() method. I wonder, however, why you think it necessary to run this in a separate thread and why you are using opencv, when you could accomplish your goal with a much simpler MFC based application.
|
|
|
|
|
thank 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
|
|
|
|
|
1. Google should be your first place to look for some suggestions[^].
2. As far as I know, the position will remain constant, it is just the scale that changes, but again you may wish to try some research to see if there are any suggestions around.
|
|
|
|
|
I am developing a application in MDI which contains few child windows.
And also i want few windows which is not attached to CMainframe.So i created new class derived from CFrameWnd.
pTagSummaryTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CHarmonyDoc),
RUNTIME_CLASS(CFrameWnd), RUNTIME_CLASS(CTagSummary));
AddDocTemplate(pTagSummaryTemplate);
And also each window has to updated frequently and im doing this by uisng below code for MDI childwindows from CMainframe
CMDIChildWnd *fChWnd = GetActivePanelWnd();
if(fChWnd->GetSafeHwnd())
{
CView *curView = ((CView *)fChWnd->GetActiveView());
if(curView)
{
((COverView *)curView)->UpdatePanel();
}
}
But for SDI, i dont know how to get activeview(Current active view of SDI)So pls help me.
|
|
|
|
|
Since SDI stands for Single Document Interface there is only one document and one view, so it is always the active one.
|
|
|
|
|
Actually, in an SDI, there is only one document, but there can be many views.
In any event (to the OP) the proper way to update views in SDI or MDI is to store and update your data in the document, then call the document's UpdateAllViews method, passing a hint if needed.
This automatically calls the OnUpdate method of every view without you having to call it manually. In that method, you can do whatever is necessary to update the view.
Hope this helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Fine, but you should be replying to the OP's message, not to mine.
|
|
|
|
|
Hi,
I have a CAsynSocket derived class as a member of my CWinThread derived the problem
is my CAsynSocket derived constructer takes a port #
How can I call/create my CAsyncSocket derived class implicitly passing the constructer a port no
for example my derived CWinthread class
Class MyCWinthread : public CWinThread
{
Myasnycsocket thissocket;
.
.
.
.
}
// myderived CAsynSocket Class
class Myasncsocket : public CAsyncSocket
{
private:
int port;
};
// constructer
Myasnycsocket::Myasynsocket(int myport)
{
port = myport;
};
thanks
|
|
|
|
|
Just write a default constructor that calls the other constructor with a default port number. Something like:
Myasnycsocket::Myasynsocket()
{
Myasynsocket(33);
};
Note: please use proper <pre> tags around your code, and indentation within it, so it is more readable as in this case.
|
|
|
|
|
Hi,
I have used pre tags in the past they don't seem to take
I'll try again
What I would really wanted to do was to call Myascncsocket constroctor directly so I can initlize it withe port I want
E.g.
<pre lang='cpp'>
class MyCWinThread : public CWinThread
{
myasncsocket thisasyncsocket;
.
.
.
};
MyCWinthread::MyCwinthread(int myprort)
{
mayasyncsockt(port);
}
myasncsock::myasncsocket(int myprot)
{
port = myport;
}
</pre>
I am assuming this will initlize myasyncsocket with the port I want
Thanks
|
|
|
|
|
As you can see (when you are editing and even after you have posted) your <pre> tags are not working, you may need to check your settings under the "Forums" tag.
As to your question, it's still not clear what you are trying to do. The above code does not really make sense.
|
|
|
|
|
I don't know where the settings tab is however I unchecked the box "treat my content as plain text not HTML" maybe that will do the trick
My question is the following
if I have a derived the CWinThread with a derived CAsynSocket class as a member of that CWinThread derived class
However my Derived CAsyncSocket Class contructer takes a int "port" number
is there anyway to call the derived CasynSocket constructer directly passing it a port number calling class member class members contructors directly I can control thier
creation
class MyCwinThread : public CwinThread
{
Myasycsocket thisasynsocket;
.
.
.
.
}
class Myasncsocket : public CAsyncSocket
{
private:
int port
}
MyCwinThread::MyCWinThread(int myport)
{
thisasyncsocket(myport);
}
MyascncSocket::Myasncsocket(int myport)
{
port = myport;
}
|
|
|
|
|
I think you'd just declare another constructor for your myAsyncSocket class?
Since the class already has a Create[^] method, I guess you'd save the number for your own reference then create the socket using the specified port.
class myAsynchSocket : public CAsyncSocket
{
public:
myAsynchSocket(int portNum);
private:
int myPort;
};
myAsynchSocket::myAsynchSocket(int portNum)
{
myPort = portNum;
Create(myPort);
}
|
|
|
|