|
I just need the functionality of notepad. I'll try and add a second dialog to my app, but I've never done anything like that before, anyone know of any good step by step tutorials? I recent bought the book "Programming Windows with MFC" by Jeff Prosise, but I'm still having difficultly.
|
|
|
|
|
I am attempting to reindex my recordset. To do that, I'm issuing a pSet->m_strSort = "[Field]" command followed by a pSet->Requery() command. The requery command brings up a "Too few parameters. Expected (1)" error message. Does anyone know how that message may come about and the workaround for it? Thx,
Ralf.
|
|
|
|
|
It usually means you have something wrong in your query string. More than likely, you have mispelled a column name in your sort string.
Tony Fontenot
I love deadlines. I like the whooshing sound they make as they fly by.
-Douglas Adams
|
|
|
|
|
This usually happens as a result of an error in your DoFieldExchange function. As an example, if you're using parameters then m_nParams needs to be set to the correct number.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
I am ALMOST 100% sure that I used to be able to do this, but for quite some time now, if a variable is declared as static, I cannot view it in the watch window while debugging using VC6.
For example, in the following function:
void someclass::somefunc()
{
static BOOL beenhere = FALSE;
if (!beenhere) {
beenhere = TRUE;
}
}
While stepping through the program in debug mode, I cannot watch beenhere. I can watch any of the other variables, so long as they're not static.
Anyone else seen this? I don't use static variables very often, but it is very irritating in a few cases.
|
|
|
|
|
just move that static variable to your class and make it not static
|
|
|
|
|
Marissa182 wrote:
just move that static variable to your class and make it not static
That is the way I normally like to make things. But there are certain instances when a static variable is what seems to make the most sense.
Even so, though, it seems like a silly restriction to not be able to watch static variables. Has anyone else run into this, or is there something odd wrong with my installation?
|
|
|
|
|
Print in VC6 ?
I used ODBC (CDatabase,CRecordset) to open "Product" table in my database file >> and I want to print this table >>
Is there a way to print easily ?
and a question
these declarations are different ?
1) CMyClass o1,o2,o3;
2) CMyClass *p1,*p2,*p3;
which decleration is flexibler (fast run and use less memory)
when I should use a object like *p1 or o1
thank you very much
|
|
|
|
|
second point first...
2) only declares pointers to objects ... not objects themselves (just in case u didnt realise that) ... pointers to objects take less memory than the objects themselves but since the objects have to exist to get a pointer to them u actually have the object size + pointer size if u store a pointer to the objects ... i guess it depends on what u need to do with the objects and how u want to do it
printing in mfc (since ur using crecordset etc) is a tricky thing to get right ... there are lots of articles here on cp ... check out the 'printing' section
"there is no spoon" biz stuff about me
|
|
|
|
|
Hi all
This is all plain vanilla C. So no wise ass C++ answers. Thanx.
typedef bool (*HANDLER)(void*,...);
Now is it possible to assign a "templated" function? Eg
bool expect(const char* str);
HANDLER HAHA = expect("HAHA");
What other options can I exercise? IOW I need to pass a pointer to a templated function pointer? But how?
CHeers
leppie::AllocCPArticle(Generic DFA State Machine for .NET);
|
|
|
|
|
|
Could someone EXPLAIN what the : operator is designed to do. The line of code I'm looking at is...
m_nBmihAlloc = ((hGlobal == NULL) ? crtAlloc : heapAlloc);
The specifics of this code shouldn't be important. I just want to know what the : is for.
Thanks to whomever can help.
JD
|
|
|
|
|
The operator is actually ? : , it's the only trinary (three-argument) operator in the C/C++ language. If the test before ? evaluates to true , the value of the statement is the expression on the left of : , if the test is false the value is on the right of : . The example code could also be written as:
if (hGlobal == NULL) {
m_nBmihAlloc = crtAlloc;
} else {
m_nBmihAlloc = heapAlloc;
}
|
|
|
|
|
|
Michael Dunn wrote:
Thank you for using the correct word "trinary".
(instead of the popular but incorrect "ternary")
I take it you remember the debate on here about 5-6 months ago about this?
-Nick Parker
|
|
|
|
|
|
Does anyone know why there would be a problem using this on seemingly ONLY some XP systems? I guess it doesn't allocate the memory, and it returns NULL when I use it in:
LPVOID pData = CoTaskMemAlloc(BufferSize);
TRY
{
RegQueryValueEx(Sub3,"OBJECTS",NULL,&RegistrySize,(BYTE*)pData,&BufferSize);
}
CATCH(CException,e)
{
#ifdef _DEBUG
MessageBoxes(3);//this is an error/exit function
RegCloseKey(Sub3);
#endif
}
END_CATCH
In order to set the right size to BufferSize, I call it with NULL in place of the pData first. Is there a better way to do this, or a different function that works with XP consistently, or am I doing something wrong?
halblonious
|
|
|
|
|
It's either I or the debugger, because it's showing me for the statements:
int diff = len - flxCnt;
int GHCapturePt = len - diff;
=============================
len = 5 (which is true)
flxCnt = 3 (which is true)
diff = 2 (which is very true)
==============================
However, it's showing me that:
GHCapturePt = -858993460 (which is very wrong)
==============================
All the variables are defined as 'int', and the program compiles and links fine (no errors and no warnings). Later on in the program when 'GHCapturePt' is tested for equality with 'flxCnt', the condition failed, which is why I went into debugger to see what's going on.
Can anyone say why the debugger is showing this strange result? Thanks!
William
Fortes in fide et opere!
|
|
|
|
|
Check source code and see if the program assigns GHCapturePt to something different. I suspect that the program assigns GHCapturePt to something that does not exist such as a deleted pointer to the address of some value.
Kuphryn
|
|
|
|
|
Good point!
However, the debugger is showing the value of GHCapturePt right at that point before it does anything, or have anything done to it. IOW, GHCapturePt has not yet gone into action. Right exactly where the statement appears, is where the debugger is showing the value of GHCapturePt.
William
Fortes in fide et opere!
|
|
|
|
|
Add a breakpoint after that line and check the value of GHCapturePt. Another way to test it is to use a temporary CString object and show a message box with the actual value in string.
Kuphryn
|
|
|
|
|
Thanks!
When a breakpoint was added after the line that GHCapturePt appeared, the debugger showed the correct value!! This has been verified using real figures and real values also.
From here on, it's a matter of walking through the logic of the program to find out where the wrong turn was made, or the wrong value was used.
Thanks. I feel I have enough clues to find the source of the error.
William
Fortes in fide et opere!
|
|
|
|
|
sure ur not over-writing memory somewhere and using junk values stored there?
"there is no spoon" biz stuff about me
|
|
|
|
|
Thanks for replying.
No, to answer your question, but right now I believe I have things under control.
I just needed to set a breakpoint after the line where the variable was defined for debugger to show the correct value it contained.
Before, I was setting the breakpoint at the line of definition, thinking the result of the operation would be assigned to the variable, and is what I would be seeing. (Debugger doesn't seem to work that way.)
William
Fortes in fide et opere!
|
|
|
|
|
WREY wrote:
I just needed to set a breakpoint after the line where the variable was defined for debugger to show the correct value it contained.
Isn't that blatantly obvious?
WREY wrote:
at the line of definition
That means you would be breaking BEFORE the line of code is executed. So, obviously the variable would not show the correct value.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
|
|
|
|