|
It is well known that the common functions clrscr() and gotoxy() are not supported in Visual C++. But I presume that calling directly to DOS interruptions using in-line assembler would provide a convenient way of making this functions. Since I don't know Assembler programming, does anybody have these two function already made?
|
|
|
|
|
I think you'll bugcheck on 98 with an _asm int 21;
Here's some code that might help:
The clrscr can be had with
system("cls");
The more powerful way us to get a handle to the
console and use the console api calls.
The MS Knowledge base has a good article on
clearing the screen - Q99261 - first, you
need a handle though...
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hConsole, &csbi);
COORD coord;
coord.X = 0;
coord.Y = 0;
SetConsoleCursorPosition(hConsole, coord);
That should move the cursor to the top of the screen without clearing it. See Q99261 for the clear screen.
|
|
|
|
|
I would like to find a tutorial that teaches how to convert those many CWnd-derived Control Classes found in this website into ActiveX controls.
|
|
|
|
|
Does anyone here have an idea of how to do access database synchronization using only code (CDaoDatabase?)
|
|
|
|
|
Is there a way to define a makro like this:
#define NEW_VAR CString str__Line__
The compiler should make
out of:
void CMyClass::Test()
{
NEW_VAR
NEW_VAR
}
something like :
void CMyClass::Test()
{
CString str123
CString str124
}
out of it.
I dont care about the Lines.
I just want to define a marko witch declares a Variable. And I want to use it more then 1 time in a function.
Thank you...
|
|
|
|
|
Even if it could, how would you access the variables? By name? I don't believe, since you don't know their names.
This would be just good for objects like CWaitCursor or so, which has just a constructor and a destructor. But those objects, you don't need more than one per scope, do you?
So what should this be good for?
|
|
|
|
|
OK...I try to explain it:
We got an ErrorClass (EFErr).
We need our ErrorClass in nearly every function.
Usually we use it like that:
EFErr CTest::Tester(...)
{
EFErr oErr=Hallo(...); //Funktion Hallo returns a EFErr too
if (oErr) //Check if a error accours
{
return oErr; //return this error
}
}
I want to reduce the code with an Makro:
#define RET_FUNKTION(function) EFErr oErr=function;if (oErr){return oErr};
so I can do the same like above with:
RET_FUNKTION(Hallo(...))
...so long...
...but there is a problem:
I can use this makro just one time in my function. I cant do things like that:
EFErr CTest::Tester(...)
{
RET_FUNKTION(Hallo(...))
RET_FUNKTION(Hallo2(...))
}
because the Variable oErr is redifined the second time.
Of course, I can shorten the makro to:
#define RET_FUNKTION(function) oErr=function;if (oErr){return oErr};
but then I have to do it like that:
EFErr CTest::Tester(...)
{
EFErr oErr;
RET_FUNKTION(Hallo(...))
RET_FUNKTION(Hallo2(...))
}
If I could use the Line in the Variable name like:
#define RET_FUNKTION(function) EFErr oErr__Line__=function;if (oErrr__Line__){return oErrr__Line__};
it will work...
...I hope this discribes my problem
|
|
|
|
|
Just more scope
What I would do is to use two brackets {}:
#define RET_FUNKTION(function) { EFErr oErr=function;if (oErr){return oErr}; } .
then you have no problem, since each oErr variable lives in its own scope.
|
|
|
|
|
|
Does anyone have code that accesses SQL thru OLE-DB they can share. I'm not looking for basic stuff, what I need are solutions for sorting and filtering rowsets...
How about an efective framework for database applications using OLE-DB, does anyone have a good pattern they may share?
|
|
|
|
|
What is the most efficient way to convert CStringArray and
CStringList objects to an alloted character buffer (ie
TCHAR* pBuffer)?
Regards,
Kosi.
|
|
|
|
|
Check out my article CShellFileOp - Wrapper for SHFileOperation. I convert a CStringList (I think, maybe it's an array, I haven't looked at the code in a while) to a double-null-terminated TCHAR buffer.
I'm not guaranteeing that this is the most efficient, though. Just one way of doing it.
|
|
|
|
|
Where i can find a sample source code for displaying html in my IE CommBand ?
Regards, Solo.
|
|
|
|
|
I have code I can share with you that shows this. There is also an example on Codeguru.com, I believe. I'll try finding and cleaning up my code so that it may be of use to you.
I'll try to do this later today.
-Erik
|
|
|
|
|
Can u send me this code ?
My e-mail: solo@dore.miem.edu.ru
|
|
|
|
|
#include <stdio.h>
int i = 7;
//The above i can be accessed using the global namespace
//:: Operator
void main()
{
int i = 10;
{
int i = 15;
{
int i = 17;
printf("%d\n",i);
//How to Access The Remaining i's here in c and c++
}
}
}
//The above variables have to be defined at the above point
|
|
|
|
|
you can't. the global i hides all of the other i's.
use different names.
-c
|
|
|
|
|
In C you can only access the local i within your block of code (equal to 17).
In C++ you can access the local i AND the global i (equal to 7). To access the global i, you'd use the scope resolution operator ( :: ) like this:
printf("%d\n", ::i);
Regards,
Alvaro
|
|
|
|
|
Looking for a c based or at a gasp c++, but prefer c, code to implement a category data structure ie
struct tagCATEGORY {
TCHAR szCategory[CATEGORYSTRINGLEN];
WORD wCategory;
} CATEGORY, FAR * LPCATEGORY;
yada yada ... Any thoughs for implementation code to copy paste and amend, best sorting methods, how to do etc thanks in advance
Andrew
|
|
|
|
|
Does anyone know a way to have colored text for a simple HTML editor in Visual C++? I need it to be colors that can be changed by the user from an options dialog so there should be some easy way to change the colors from the code. The basic framework for my application is going to be the standard text editor from the MFC app wizzard. Can anyone help me? E-Mail me and maby I can explain my problem a little bit better.
Thanks alot,
Jeff
|
|
|
|
|
Check the crystal syntax coloring editor by Andrei for this,
located at
http://www.codeproject.com/editctrl/crysedit.asp
You may also check the codeguru site for a startup html
parser to go with it, may need some modifications...
http://codeguru.earthweb.com/mfc/comments/2006.shtml
Need more? get in touch with the others.
Regards,
Paul.
|
|
|
|
|
There is a very good Open Source project which do that and
many other interesting things:
Scintilla and SciTE by Neil Hodgson, Look at:
http://www.scintilla.org
Hope this help,
Jran-Claude
|
|
|
|
|
hi,
anyone have any example or could tell me on how to implement browser helper objects and connect it to a running instance of IE and then if any url is lik test:// it should cancel the url and notify the app any ideas?
|
|
|
|
|
I'm making a NT-service, monitoring printjobs.
I have a small NTSERVER-WIN98 network. My server acts as a printerserver.
My problem is to retrieve the number of pages in the printjobs.
When I print from NT-server I can get the number through GetJob(), but when I print from WIN98 I cannot retrieve the number of pages (I get '0' each time).
Can somebody please help my out.
|
|
|
|
|
I'm trying a work out how I might redirect the output from a console app to a windows text box in VC++. Similar to when you compile and the output of nmake is shown in a docked window.
Does anyone have any ideas? I thought about using CreatePipe() and it's associated functionality. Is this right?
Many thanks for any help
|
|
|
|