|
Thanks for that.
I don't think it applies in this case though, as I'm consistently using FormatRange to get the next character (ie starting position), and I'm getting the same values for both preview and print modes. However, it does give me a few ideas which I'll try later; if it works, I can feel an article approaching.
If only MS had documented this better, it would be far simpler.
Steve S
[This signature space available for rent]
|
|
|
|
|
I've had problems with print previews in the past. Mostly what I've seen are roundoff errors in line spacing between the printed version and the screen version. Tweaking the font values for the screen version did the trick.
Software Zen: delete this;
|
|
|
|
|
Yes, me too, been there, done that, bought the T-shirt...
I learned from experience that a more reliable way when using MFC without wanting to break absolutely everything was;
In OnPrint, check if we're previewing; if so, create a printer-page sized bitmap, and a memory dc with it selected, and use this for output (I do this by having a RealPrint(CDC*, CPrintInfo*) function which does only the output), otherwise used the passed dc for RealPrint.
On return from that, if we're previewing, blit the memory dc to the passed dc, then cleanup.
Gives much better results, IME.
My problem is subtly different, in that it would consistently not print the last line, and since the measuring & rendering was being done by a control, I didn't really want to have to write an RTF interpretation and layout engine.
However, thanks to Miguel, who put me on the right track. It turned out that I was clearing the control's cache using FormatRange(NULL,FALSE) in between calls to the real FormatRange(), so I was getting inconsistent numbers back.
Now fixed.
Steve S
[This signature space available for rent]
|
|
|
|
|
how to disable the maximize in win32 application.
IAM USING createwindow function.
how to disble it.
|
|
|
|
|
If you simply want to get rid of the maximize box and prevent it that way, you just need to make sure that the WS_MAXIMIZEBOX style is NOT set for your window when you create it.
If you want to prevent it programatically you will need to handle the WM_SYSCOMMAND message and look for the SC_MAXIMIZE code.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
no i try to use ~ws_maximize but i dont know how to use it correctly.
~ws_maximize & WS_VISIBLE|WS_CHILD like that
Is it correct or not.
|
|
|
|
|
Hey, I plan to have a window that has like a list on the left to select items, and when selected the rightView changes, i've got the splitter happening and should be able to put a listview in the left. But I was wondering whats the best approach for havn't different pages in the right view? Like one would be lots of edit boxs and labels, and another would be text area or a listView. Whats the best way? Just having the rightview with are the member varibles and cahanging which ones in view?
I'm really just looking for a push in the right direction, maybe a tutorial, example or just what classes I should be reading about.
thanks,
Luke.
|
|
|
|
|
You may inherit your right view from CFormView and place there whatever you want.
if you want more than 1 pages on the right, you may use some tab controls like CXTabCtrl (http://www.codeproject.com/tabctrl/cxtabcontrol.asp).
I've used it it my project once.
Dmitry Timin
|
|
|
|
|
can u use HRESULT_CODE in VC's tool "Error Lookup"?
norm
|
|
|
|
|
Yes. The ErrLook.Exe program is a simple little wrapper around the FormatMessage() API function. As a result, any error code that it can recognize, the ErrLook program can display. Note that not all HRESULT 's have messages, which is why some of them don't display anything.
Software Zen: delete this;
|
|
|
|
|
hi, writing a win32 console app that doesnt support MFC (besides CDBException is for ODBC ..)
i opened a recordset and since the open method doesnt return a HRESULT, i need to use try-catch mechanism.
but how?
try
{
pRs->Open(....);
}
catch( what?)
{
}
Reference:
recordset.Open Source, ActiveConnection, CursorType, LockType, Options
(Note: No return value)
thanks gurus!
norm
|
|
|
|
|
if you catch (...), you'll catch all exceptions. There is a com_exception, or similar, but I forget exactly what it's called.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
just found out...
try
{
pRs->Open(vNull, vNull, adOpenForwardOnly, adLockReadOnly, adCmdUnknown);
}
catch(_com_error &e)
{
//Additional error handling here.
cout << "ERROR: Failed to open recordset." << endl;
cout << "ERROR msg: " << e.ErrorMessage() << endl;
}
But the error msg is soooo vague:
Unknown error 0x800A0E79
I'm banging my head against my cactus but apparently it doesnt help
norm
|
|
|
|
|
In the tools menu of VC is an error number checker. Put this number into it and it will pop up a dialog that says 'error message not found'. Or, 1 in 1,000 times, it knows what this HRESULT means, and then it tells you
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
tried, it says cant find the message ("Message not found") with "0x800A0e79"..
the tool is called "Error Lookup"
catch(_com_error &e)
{
//Additional error handling here.
cout << "ERROR: Failed to open recordset." << endl;
cout << "ERROR: e.ErrorMessage(): " << e.ErrorMessage() << endl;
hr = e.Error();
cout << "ERROR: HRESULT_CODE( e.Error() ): " << HRESULT_CODE(hr) << endl;
}
But if Error Lookup HRESULT_CODE(hr)==3705 gives the following msg "Bad or missing LAN Manager root directory." --- this doesnt make a lot of sense coz it's a local SQL server and previous statements all executed with good HRESULT==S_OK
norm
|
|
|
|
|
sorry, for error = 3705, Error Lookup yeilds "Message Not Found"
oops
norm
|
|
|
|
|
how can u enumerate tables given a database?
btw, we use ADO for database access. and we use SQL server.
thanks!
norm
|
|
|
|
|
Read my article called MSDEGUI - the queries I use there should work for you. It's in the new list on the main page.
No, I don't remember them, or I'd just tell you
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
just scan yr article briefly. isnt it for .NET?
anyway, i'm building all my code with VC6 - lots of anti microsoft types here in this company.
anyway, i am thinking, perhaps I can read MyDB.Tables.sysobjects
there're three columns of interests:
a. "names" -- object name: a simple string
b. "id" -- object id: just a simple integer
c. "xtype" and code as follows:
Object type. Can be one of these object types:
C = CHECK constraint
D = Default or DEFAULT constraint
F = FOREIGN KEY constraint
L = Log
FN = Scalar function
IF = Inlined table-function
P = Stored procedure
PK = PRIMARY KEY constraint (type is K)
RF = Replication filter stored procedure
S = System table
TF = Table function
TR = Trigger
U = User table
UQ = UNIQUE constraint (type is K)
V = View
X = Extended stored procedure
So, I will just count and retrieve an array of names (names - column one of sysobjects table) for all entries where xtype==U
norm
|
|
|
|
|
norm wrote:
just scan yr article briefly. isnt it for .NET?
Yes, so ? The query remains the same, all that changes is the layer that is talking to SQL Server.
norm wrote:
anyway, i'm building all my code with VC6 - lots of anti microsoft types here in this company.
Has no-one told them it comes from Microsoft ? :P
norm wrote:
anyway, i am thinking, perhaps I can read MyDB.Tables.sysobjects
I suspect that is exactly what I did in the article I pointed you to.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
thanks chris. and i hope that there'll be a day when it's no longer hip just being an anti microsoft. it's so stupid.
norm
|
|
|
|
|
If that day comes, it will be the day after Solaris penetrates 90% of the market.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
just remember in addition to cursor type, u can also specify whether you want server side cursor or client side cursor isnt it?
can u tell me where I should read up in this regard?
norm
|
|
|
|
|
Dunno, a book on ADO ? O'Reilley have a good one, from memory.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Simple solution - use OpenSchema method of ADO Connection object:
pConn->OpenSchema(adSchemaTables,vParams)
where vParams is a Safearray containing the following null, schema_name, null, null. This then returns a recordset which contains all of the tables in the schema. To enumerate the fields of a table, use similar:
m_pConn->OpenSchema(adSchemaColumns, vParams)
where vParams contains null, schema_name, table_name, null. Again returns recordset that can be used to get all sorts of information.
If you need a fuller example, fell free to e-mail me. vParams cna be used to control the operation in a much more detailed way than here, but this provides basic naming information.Also, has the advantage that will work with any DB type (SQLServer, Oracle, Access etc).
Hope it helps
|
|
|
|
|