|
Hi. This my first post here, so be gentle
I'm creating a level editor, in the vein of id Software's q3radiant, and I've hit a snag. I've been developing it for about 3 months, using MFC/C/C++, and haven't had the need to save any of the maps I've been making. Now I'm coming to the part where I have to be able to save and load my maps to progress. "All well and good," I thought. "I'm using the document/view architecture, it shouldn't be too much trouble." I was wrong, apparently.
I've created some window classes to provide the 2D and 3D functionality I need (they use OpenGL for rendering), and then used a couple of static CSplitterWnds to make the windows. This has worked perfectly up to now. There is a texture window (CTexWnd : CWnd) on the right, and then a nested CSplitterWnd on the right with three 2D windows (C2DWnd : CWnd) and a perspective window (C3DWnd : CWnd). I haven't used the view or document created by the app wizard (CMyEditorView and CMyEditorDoc, respectively), as the need hasn't arisen until now.
I've come to save my maps, but the Save and Save As menu items are greyed. The resource IDs (ID_FILE_SAVE and ID_FILE_SAVE_AS) are correct, but they're still unusable. I created a small test program, and dug around in MFC until I found out the problem: I wasn't creating a CMyEditorView, and therefore, the messages weren't being routed to my CMyEditorDoc. I created a CMyEditorView in place of one of 2D windows, and, lo and behold, the Save and Save As buttons were available. However, now I'm confused. How do I link the document to all of the windows, or none of them? How do I link it so that the document can be used to store my map, and save/load it? I have to keep using C2DWnd instead of CMyEditorView, but it would seem that's not an option. Is there any way I can get out of this sticky problem, and save/load my maps using the document? I think there's other modelling software which uses the SDI environment and splitter windows, but still uses the document/view architecture. Thanks in advance for any replies, and thanks for reading this rather large post, but I thought I'd probably better get in as much detail in possible
PS. I can post code and/or screenshots, if it's relevant...
Chris Mantle
|
|
|
|
|
Jeez, if you guys can't help me, I must be in trouble. Ah well, back to the drawing board...
|
|
|
|
|
I hjave a need to detect one of the following 3 states for a CD writer drive.
1. No media in the drive
2. Unformatted / Blank media in the drive
3. Media with a valid CDFS on it in the drive.
So far all of the IOCTL calls I have explored give me the same results from an empty drive as they do from one containing blank or unformatted media.
Any help gratefully received.
|
|
|
|
|
You should be able to extrapolate from this:
bool IsMediaPresent( void )
{
MCI_OPEN_PARMS mciOpen = {0};
MCI_STATUS_PARMS mciStatus = {0};
MCIERROR mciError;
mciOpen.lpstrDeviceType = "cdaudio";
mciError = mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_TYPE, (DWORD) ((LPVOID) &mciOpen));
if (0 == mciError)
{
mciStatus.dwItem = MCI_STATUS_MEDIA_PRESENT;
mciError = mciSendCommand(mciOpen.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM, (DWORD) ((LPVOID) &mciStatus));
mciError = mciSendCommand(mciOpen.wDeviceID, MCI_CLOSE, 0, NULL);
}
return (1 == mciStatus.dwReturn);
}
|
|
|
|
|
First of all many thanks for taking the time to provide an answer , it is much appreciated. The code fragment works in detecting an empty drive or a drive containing a formatted CD, however it returns exactly the same responses for a drive containing a blank unformatted CD as it does for an empty drive. This is the same problem I have experienced using the CD IOCTL calls from the DDK, they all tend to return 21 (device not ready). The application I am trying to write is a service that will kick off a third party app to write a CD overnight if there is valid media in the drive. I don't want to kick it off if there isn't because the app will sit there with a non displaying dialog waiting for a response.
|
|
|
|
|
I derived the tab control and attached two dialogs.a piece of code
and see the attached pic,where two dialog attached to the tab.
class CBaseTabCtrl : public CTabCtrl
{
// Construction
public:
CBaseTabCtrl(int nType = BTC_NONE);
CDialog *m_tabPages[2];
int m_tabCurrent;
int m_nNumberOfPages;
//Operation
public:
//tab
void Init();
void SetRectangle();
....
CBaseTabCtrl::CBaseTabCtrl(int nType)
{
m_tabPages[0]=new CCamera1CtrlDlg;//CCamera1CtrlDlg is the dialog (IDD_CAMERA1)'s wrapper class.
m_tabPages[1]=new CCamera2CtrlDlg;//CCamera2CtrlDlg is the dialog (IDD_CAMERA2)'s wrapper class.
}
CBaseTabCtrl::~CBaseTabCtrl()
{
delete m_tabPages[nCount];
}
void CBaseTabCtrl::Init()
{
m_tabCurrent=0;
m_tabPages[0]->Create(IDD_CAMERA1, this);
m_tabPages[1]->Create(IDD_CAMERA2, this);
m_tabPages[0]->ShowWindow(SW_SHOW);
m_tabPages[1]->ShowWindow(SW_HIDE);
SetRectangle();
}
in the parent dialog's Oninitdialog()
BOOL CTestDlg::OnInitDialog()
{
...
m_tabCtrl.InsertItem(0, "ÉãÏñ»ú1", 0);
m_tabCtrl.InsertItem(1, "ÉãÏñ»ú2", 1);
m_tabCtrl.Init();
...
}
so when I handle the clicked button 's message in test dialog(parent dialog),I want to send message to the the IDD_CAMERA1 dialog.so I can handle the defined my message in IDD_CAMERA1 dialog .
above,how to send user defined the message to the IDD_CAMERA1 dialog .
attached IMG (there is a link)
|
|
|
|
|
I had solved the problem use the code:
m_tabCtrl.m_tabPages[0]->SendMessage(WM_COMMAND,(WPARAM)IDC_MODLESSDIALOGBTN);
|
|
|
|
|
" Linking...
MAPI.lib : fatal error LNK1136: invalid or corrupt file
Error executing link.exe. "
this is the error which i get when executing a file that includes mapi.dll
kindly help me in debugging it!
ranjani
|
|
|
|
|
There's nothing to debug. The file has either a corrupt header, or has a zero size. It sounds like you need to reinstall VS, thus getting a non-corrupt copy of mapi.lib.
|
|
|
|
|
What version of Visual C++ are you using?
I thought MAPI required MAPI32.lib?
Isn't MAPI.lib a 16bit lib?
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
MAPI>lib is a 16 bit lib only
wat iam using is VC++ 6.0 version!
donno what the problem is!
does MAPI require MAPI32.libb??
ranjani
|
|
|
|
|
In my MAPI programs I link with MAPI32.lib not MAPI.lib
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
Hi
Anyone knows how i can change the color of the border of a group box?
Greetings
Jens
|
|
|
|
|
One solution is to derive a class from the group box control. Do custom drawing.
Kuphryn
|
|
|
|
|
i thought something like that
but i'm not that good at drawing things
any tutorials of it?
greetings
Jens
|
|
|
|
|
Look in CodeProject code section.
Kuphryn
|
|
|
|
|
It does not seem to be possible with CPen... anyone knows of an alternative? Could not find an article here with an alternative to CPen...
Any ideas?
Thanks
|
|
|
|
|
Will
int nWidth = 3;<br />
ExtCreatePen(..., PS_DOT, ..., nWidth, ...);
work?
|
|
|
|
|
It did the trick!
Thanks a lot! I had not RTFM for long and never realised that CPen had another constructor.
|
|
|
|
|
I learnt from a book how to create a database by creating a new wizard app SDI with ODBC support, but is there a way which i can incorporate a database into an already made SDI(without ODBC support)? coz i only realise i need a data base for my GUI after I did the SDI..thanx
|
|
|
|
|
first
#include "afxdb.h"
in your stdafx.h file
then simply add the CRecordSet Classes into your code with the ClassWizard
|
|
|
|
|
erm...I tried to add the CRecordSet classes but which base class should it b based on? Mi not veri familiar to c++ but need to do a project.
|
|
|
|
|
Hi all,
I want to write a serial and parallel device driver for Windows 2000. Does anyone of any good books on the market.
Thanks
Louis
|
|
|
|
|
I'll let you be the judge as to its goodness or relevance, but here is one:
http://www.flounder.com/books.htm#Developing%20Windows%20NT%204.0%20Device%20Drivers
|
|
|
|
|
I have an Icon resource containing a 16x16 icon and a 32x32 icon.
When I use :
<br />
DrawIconEx(dc, 0, 0, icon, 16, 16, 0, 0, DI_NORMAL);<br />
I always get the 32x32 version of the icon scaled into a size of 16x16, instead of getting the 16x16 version.
When I supply the same Icon to a CTreeCtrl's CImageList, it manages to display the correct icon (16x16) on the tree.
How can I force DrawIconEx or any other method to pull out the small version of the icon ?
Thanks
|
|
|
|