|
|
I am trying to implement a document/view application. I got the program to compile but it stalls when the line 'AddDocTemplate(pDocTemp);' is executed. I keep getting the 'Debug Assertion Failed' box. Below is a snippet of the InitInstance code. Thx
BOOL CApp::InitInstance(void) {
//register class and document
CSingleDocTemplate *pDocTemp;
pDocTemp = new CSingleDocTemplate(IDR_APP,//UINT nIDResource
RUNTIME_CLASS(CAppDoc),//CRuntimeClass* pDocClass
RUNTIME_CLASS(CMain),//CRuntimeClass* pFrameClass
RUNTIME_CLASS(CAppView));//CRuntimeClass* pViewClass
AddDocTemplate(pDocTemp);// !!!Problem here
//parse command line info
CCommandLineInfo cmd;
ParseCommandLine(cmd);
//dispatch command line info
if (!ProcessShellCommand(cmd))
return FALSE;
//show/update window
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
ralf.riedel@usm.edu
|
|
|
|
|
Which line of which module gives the ASSERT?
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi,
Does anyone know of a good FREE platform independant source
code control system that works with Visual C++?
I tried installing cygwin and its port of CVS
but Visual C++ projects seem to have a problem
co-existing with it.
Thanks
|
|
|
|
|
I haven't used it myself but you might want to give WinCVS a try.
Good luck!
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++
"I would be careful in separating your wierdness, a good quirky weirdness, from the disturbed wierdness of people who take pleasure from PVC sheep with fruit repositories."
- Paul Watson
|
|
|
|
|
Folks,
When I replace the background HBRUSH on a Window:
1) Am I expected to delete the OLD HBRUSH?
2) Expected to delete my NEW HBRUSH?
Or both?
Mike.
|
|
|
|
|
Restore the old one when done. Then, you can call DeleteObject() on both.
Jeremy L. Falcon
"You do not know the power of the dumb side."
<nobr>
Homepage : Sonork = 100.16311 Maybe my mangling might misguide malicious miscreants momentarily?
|
|
|
|
|
Hi,
I have a listbox which I automatically scroll down when I add new new lines (for a chat). Unfortunately, I want to avoid this autoscroll behaviour when the user decided to scroll up and look for older text. Because otherwise each new incoming text would anoyingly scroll to the end again.
Hmmm, my idea was to look on GetScrollPos() and do not autoscroll when the position is != the ending position. Is this a good idea, any other ideas?
Thx for help.
|
|
|
|
|
Deselect the autoscroll feature. When inserting a string, check first whether the cursor is at the bottom, and if so, do a SetCursel to the new line. Otherwise, do nothing.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Using the scroll bar doesnt change the cursor/caret.
Also my idea with GetScrollPos() doesn't work alone. I need to calculate the TopIndex + number of visible items to get the ending position - or more easy I think: I use ItemFromPoint() and compare it with GetCount()-1. Let me implement it...
Have a nice weekend.
|
|
|
|
|
here it is:
BOOL CListBoxChat::IsAutoScroll()
{
int nBottom = GetBottomIndex();
if(nBottom == LB_ERR) return FALSE;
return (GetBottomIndex() == GetCount()-1)?TRUE:FALSE;
}
int CListBoxChat::GetBottomIndex()
{
ASSERT(m_hWnd);
CRect rect;
GetClientRect(rect);
int nIndex = LOWORD(::SendMessage(m_hWnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(0, rect.bottom)));
if (nIndex == LOWORD(LB_ERR))
{
nIndex = LB_ERR;
}
return nIndex;
}
|
|
|
|
|
I vote that you give it a try. If it works then it is a good idea, if it doesn't work then it isn't.
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
Hi there ...
I wrote a structure like this:
struct MyObject
{
CDC dc;
CBitmap bmp;
short x, y;
};
In one of my functions i want to make a refrence parameter ...
I mean the function can chenge the value which got from parameter.
It is my function:
void CTileDlg::SwapTiles(MyObject &myObj)
{
int x, y;
short col, row;
x = myObj->nX;
y = myObj->nY;
col = myObj->nCol;
row = myObj->nRow;
myObj->nX = objNULL->nX;
myObj->nY = objNULL->nY;
myObj->nCol = objNULL->nCol;
myObj->nRow = objNULL->nRow;
objNULL->nX = x;
objNULL->nY = y;
objNULL->nCol = col;
objNULL->nRow = row;
}
I have to pass MyObject pointer object to that.
For example:
MyObject *mo;
SwapTiles(mp);
Could you tell me how can i make a right refrence function ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Don't pass a pointer. Just pass the struct variable normally. It gets passed by reference.
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
MyObject *mo;
SwapTiles(*mo); Ther's a typo in your sample code --I guess you refered to the same variable mo in both sentences.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have a dialog based MFC project. I have added a menu IDR_MAINFRAME to it, also I have filled up the Accelerator resources for IDR_MAINFRAME. But when the program is running, and the accelerator key is pressed (for example, Alt+F), nothing happens. But if I click on the corresponding menu item, the function would be called. Did I miss anything?
Thank you very much in advance!
|
|
|
|
|
Nish explains it all here.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you, Joaquín and Nish. I've got the accelerator keys.
Thank you so much!
|
|
|
|
|
lucy wrote:
Thank you, Joaquín and Nish
Eight roses
4 for Joaquín and 4 for me
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
4 for Joaquín and 4 for me
It'd be nice if there was a feature at CP which allowed people to collect roses, so that later it could be consulted how many roses everybody has. Do we lobby for it?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
It'd be nice if there was a feature at CP which allowed people to collect roses, so that later it could be consulted how many roses everybody h
Good idea Joaq. Roses for everyone
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
Screw roses!!!!
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
|
Maybe someone could just make sure that I am clear on IJW. Microsoft says that it simply allows a user to make pure unmannaged API calls from within ? Managed C++ ? whereas a VB or C# developer must use the DLLImport PInvoke method? Is this pretty much all this means concerning IJW/It Just Works. I must add, what a naming scheme done by Microsoft, I think they are running out of acronyms.
Nick Parker
|
|
|
|
|
You get to do your own marshalling. And it's more natural than P/Invoke. And P/Invoke is ugly.
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|