|
Functionally, there is little difference between:
main ()
{
CMine theMines [384];
}
and
main ()
{
CMine *ptheMines = new CMine [theNumberINeed];
... do stuff ...
delete [] ptheMines;
}
Don't sweat creating an array of the specific number of mines you need after you determine the count.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
The problem is I don't know the number of "mines" nor does the user. It's desgined that way you just add mines whenever and wherever you like at run time, it doesn't ask you for the number of "mines" you're going to use.
I used your solution for the game itself when the number is set after reading the level data from a file.
The editor however is a bit different.
Thanks anyway.
Isaac Sasson,
Small time programmer - complainer at large.
Sonork ID 100.13704
|
|
|
|
|
Hello friends !
How are you ?
I need a small help . Please !
Well, I see that CFile::Open with CFile::modeCreate|CFile::modeWrite
When I want to write into the file if it exist and if not to create it works excellent in win98
but on win2000 and XP it success only to create the file if it was not ,and when the file (.dat) already exist it doesn't success to perform modeWrite and should have first to do : CFile::remove()
my question :
1. Why ?
2. How could to do it at the best and elegant way ?
3. Are there a function to know if a specific file exist or not ? which ?
thanks in advance
|
|
|
|
|
mimi wrote:
Are there a function to know if a specific file exist or not ? which ?
Check:CFileFind
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
I think I found the answer to my second question
perhaps I need to add CFile::modeNoTruncate
|
|
|
|
|
Hello people.
I'm trying to get a CFormView derived class inside of a dialog. Why? well, i want a small area of my dialog to be kind of a sub dialog, with dynamically created controls in it. CFormView is a nice way to go, cos then i get scroll functionality on this little pane.
Anyway. Trying to add the view like this:
CRect rect(10, 10, 200, 200);
CRuntimeClass* pClass = RUNTIME_CLASS(CMyFormView);
pView = (CMyFormView*)pClass->CreateObject();
pView->Create(NULL, NULL, WS_CHILD, rect, this, AFX_IDW_PANE_FIRST, NULL);
pView->MoveWindow(rect);
pView->ShowWindow(SW_SHOW);
This doesn't work. The compiler generates an error on the pView->Create() line. This is because the Create() member (which comes from the base class) is protected:. but I don't understand why it's protected! it's not in CView, and not in CScrollView.
So what I tried next, was adding a virtual function, Create() to the CMyFormView class. the supplied virtual function calls the base class implementation, using the parameters passed in. ie:
BOOL CMyFormView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
This seemed a good idea, because the virtual function is allowed to call the protected base class member. However, running the code causes an assert, in the base class create... ie CFormView::Create()...
if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
{
ASSERT(FALSE);
Something's wrong with the dialog template name. But I thought this was handled by the framework on my behalf? I specified a dialog resource when I created the class, and the enum IDD in the class declaration of my dirived class reflects this. Any clues as to how to get a working CFormView inside a dialog???
Your help will earn you a beer!!!
Thanks
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Immediately after posting that last message, I realised i'd used a regular dialog box template, not a IDD_FORMVIEW type template.
Oh dear, i think it's time to get some sleep.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I have problem with style report in the concrete with resizeing columns. I wrote code to autoresize(as resizeing column in Outlook) column but problem is while users changeing width of App (for example CListView in SDI app). During resizeing (because width of column is not changeing at once) users can see horz. scrollbar. Present MS-Outlook - here is same case.
Can I set width of column at once ? Currently I useing function SetItem().
My Code :
HRESULT CDodomuHeaderCtrl::OnLayout(WPARAM wparam,LPARAM lparam){
if (!m_bNowResizeing){
AutoSizeItems();
LPHDLAYOUT lay = (LPHDLAYOUT)lparam;
HRESULT lResult = CHeaderCtrl::DefWindowProc(HDM_LAYOUT, 0, lparam);
return lResult;
}
else {
return NULL;
}
}
void AutoSizeItem(){
... compute new width
m_bNowResizeing = true;
for(....){ // (remark 1)
HDITEM item;
... fill struct
SetItem(i,&item);
}
m_bNowResizeing = false;
}
-----
remark 1. :
Here is greatest problem : If users decrease width of ListCtrl will in moment width of all column >> ( ) then client area and Windows (CListCtrl) show horz. scrollbar.
Please ... Can you help me ?
Thank VERY MUCH !!!!
Wizard
|
|
|
|
|
Haven't tried it myself, but maybe you can use WM_SETREDRAW to disable automatic redrawing while the resizing is in progress:
void AutoSizeItem(){
... compute new width
SendMessage(WM_SETREDRAW,(WPARAM)FALSE);
for(....){
HDITEM item;
... fill struct
SetItem(i,&item);
}
SendMessage(WM_SETREDRAW,(WPARAM)TRUE);
} Let us know if that worked! Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
))
Thank you for !!!
Wiizi
|
|
|
|
|
Hi
I have a property sheet , within that we have a property page
i want to change the default size of the page
OnInitDialog of page is never called as we just add pages to the sheet
How do we size the page by default ??
parag
|
|
|
|
|
By default OnInitDialog is not called when you add a property page to a sheet, but rather the first time the property page is displayed. You can force OnInitDialog to be called when the property sheet is created by setting the flag PSP_PREMATURE in the dwFlags member of the PROPSHEETPAGE structure associated to a property page --note however that this capability is only supported starting from version 4.71 of the common controls library.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
All,
Forgive this dumb-assed question...
I want to implement and owner-drawn radio button. If I add a radio button in dialog editor, it's resource id never appears in the member variables tab in ClassWizard.
Why not? Surely I don't have to CMyRButton::Create() on them? there must be a way to use the dialog editor?
Thanks
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
You mean you put radio button in dialog and check owner draw check box?
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
You have to give all radio controls a unique ID... I think thats the problem... because it's the same thing with ALL static text controls. They have ID IDC_STATIC (I think) and if you change it to IDC_STATIC1 then it will appear in the CW.
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
I tried this, having had the same problem with static's in the past. No luck though... they still don't appear.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I tried it and no probs at all.
If you have three radio buttons then check the "group" setting for the first box. Only then will it come in CW
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Does anyone know if wizards are supported in WinCe? I am attempting to create on my device runing WinCe 3.0 and I am getting an error of SetWizardMode not a member of CWizardSheet, which is my derived class from CPropertySheet.
Just wondering if they are supported or not.
Thanks,
-Eric
Disregard this, after looking in the documentation it clearly states that wizards are not supported in wince.
|
|
|
|
|
If I create an MDI application using visual studio, how do I make an openGL child window for the application?
|
|
|
|
|
Hi !
I'm trying to subclass the control 'CListCtrl'. I now have a new class, derived from CListCtrl and I'm trying to find a way to draw specific parts of the control by myself, but I don't really know where to start.
I read articles talking about 'ownerdraw', but it seems it doesn't work the same with sublassed controls and ownerdrawed controls.
Any help will be greatly appreciated !
Jerome
|
|
|
|
|
You can check CListCtrls in CP ,look in source code of them and see DrawItem
function of them
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Look at XListCtrl:
http://www.codeproject.com/listctrl/XListCtrl.asp
|
|
|
|
|
I don't think deriving a class is quite sub-classing...i dunno i could be wrong.
Owner drawn list controls is alot of work, I would personally suggest using CustomDraw instead...this way you only draw the parts you want and let windows draw the rest.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
This is for you
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
hey guys and girls, sorry if this has been asked before but i couldn't find much on it, is there a quick and easy way show a open dialog box and get the filename they select?
thanks for any help
m.
|
|
|
|