|
Try setting the DC's aligment mode with
SetTextAlign( dc, TA_BASELINE )
Hope this helps !
|
|
|
|
|
Thanks for the GREAT suggestion (I hadn't thought of that one), but unfortunately it causes the text to vanish if I have it anything but TA_TOP|TA_LEFT [The default from msdn]. Oh, well back to the drawing board.
|
|
|
|
|
Greetings all,
After many hours of sweat and tears I think I figured out a solution to my problem.
1.) First loop through all the fonts to find the largest font.
- Do a "GetTextExtent32()" to get the SIZE, and then do a "GetTextMetrics()".
SIZE MySize; TEXTMETRIC tm;
int nMaxAscent; int MaxLineHeight;
Now add the (MySize.cy + tm.tmDescent) together, and save them in a variable (MaxLineHeight).
Also save the tm.tmAscent in a variable (nMaxAscent).
2.) When you are drawing the font's segment, check to see if the size is less than the max font size.
- If it is smaller then figure out how much we need to offset the smaller font.
TEXTMETRIC CurrentAscent; // DO a "GetTextMetric" on your current font.
int nOffset = nMaxAscent - CurrentAscent;
Then use the offset with the rect's top.
Rect.top = Rect.top + nOffset;
3.) Finally add the descent the maxline height to the top of the rect to get the bottom.
rect.bottom = rect.top + nMaxLineHeight;
And now finally my text is lined up in a wonderful straight line!!!
It only took almost a whole day of work (and 4 mountain dews) to figure it out, SIGH!!!
Oh well, at least it works.
|
|
|
|
|
Lately my DS crashes consistently when I am closing the DS or randomly while working. The error messages are:
"The instruction at 0x77fca8ac referenced memory at 0x00000005. The memory could not be written."
After OK the above message the next one is :
"The instruction at 0x6c371351 referenced memory at 0x00000004. The memory could not be read."
I posted the addresses for example only. Anybody ran into this? I tried to reinstall VC++ (6.0) with no results, OS W2k.
Thanks
Mihail
|
|
|
|
|
Do you installed some new product lately?
I have the Visual Studio 6.0 working really fine in my W2K. I had no problems, never.....
I remember that I had these type of message in Visual Basic when I used the Formula one Grid....
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
Just XML Spy, but I had this problem before. Don't use the the Formula One Grid, I am using the Stingray Objective grid.
|
|
|
|
|
i would like to know if anybody has created an application which use ado method to catch excel database.
i'm new in visual c++ programming, so if you could help me
gerald
|
|
|
|
|
The easiest way would be to setup an "ODBC Data Source" using the control panel ODBC Data Sources app. Then you can use it the same way as with any other ODBC data source.
To see your tables in excel from the ODBC interface, you have to select the rows that make up the table and then use "Insert | Name | Define" to give a name for the table. The text in the first row would be identified as column names.
I hope this helps you. Please let me know if you face further problems.
--Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
What Thomas says is certain, I want to add that the name of the sheet is the name of the table.
If in the sheet the first row have not the name of the field, you can reference this in yourt querys with numbers. "Select 0,4,5 From Sheet01" where 0 is the field 0....
Best Regards and Good Luck!!!
Carlos Antollini.
|
|
|
|
|
Are you sure that ADO isn't better and more flexible than ODBC? But it's just a proposition, it's the first time i have to do this kind of job, so....
gerald
|
|
|
|
|
Instead of using the ODBC driver for ADO, you can also use the -
Microsoft.Jet.OLEDB.4.0 provider and use Engine Type as "Excel 8.0". There are examples in MSDN that does that, but they are mostly VB examples.
But, with ODBC driver, your code will be much easier as you can use "DSN=DataSource;" as the connect string for the ADO Recordset open.
Note: I have never used Excel through the Jet ADO driver. So I am not sure of the syntax.
Personally, I prefer using OLEDB over ADO in VC++. I use the OLEDB consumer templates. If you want to check this out you can look in MSDN for
CDataSource
CSession
CDynamicAccessor
classes.
-- Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
try this:
http://support.microsoft.com/support/kb/articles/Q278/9/73.ASP
|
|
|
|
|
Hi All,
I have a CMyListCtrl (derived from) CListCtrl on a CMyPropertyPage (derived from CPropertyPage).
In CMyListCtrl I try to handle several header control notifications:
ON_NOTIFY(HDN_BEGINTRACK, 0, OnHeaderBeginTrack)
ON_NOTIFY(HDN_ENDTRACK, 0, OnHeaderEndTrack)
ON_NOTIFY(HDN_BEGINDRAG, 0, OnHeaderBeginDrag)
ON_NOTIFY(HDN_ENDDRAG, 0, OnHeaderEndDrag)
ON_NOTIFY(HDN_DIVIDERDBLCLK, 0, OnHeaderDividerDoubleClick)
ON_NOTIFY(HDN_ITEMCHANGING, 0, OnHeaderItemChanging)
ON_NOTIFY(HDN_ITEMCLICK, 0, OnHeaderItemClick)
The problem is I get some of the notifications, but not others.
I get the BEGIN/END TRACK/DRAG notifications, but I do NOT get the DIVIDERDBLCLK, ITEMCHANGING, or ITEMCLICK notifications?
I can use ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnListColumnClick) in place of the HDN_ITEMCLICK notification, but I don't understand why I'm not getting the header notifications.
If I handle the HDN_DIVIDERDBLCLICK notification in CMyPropertyPage, I do get the notification, so it looks like the header control sends some of its notifications to the CListCtrl, and others to the CPropertyPage?
It also seems like by the time the HDN_DIVIDERDBLCLICK notification is received, the header (or listctrl) has already done the default resizing of the header columns, but that's what I wanted to customize.
Any ideas or suggestions?
Thanks - Sean McKinnon
mailto:sean.mckinnon@kvs.com
|
|
|
|
|
I've checked this with Spy++ on Win2000. My app wasn't UNICODE, but when I clicked on header, list control received HDN_ITEMCLICKW (not HDN_ITEMCLICKA mapped via #define to HDN_ITEMCLICK). It seems that this is the case with other notifications as well.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Yes!
That was it, thank you!
- Sean
|
|
|
|
|
Is it possible to hide a list control item with CListCtrl::SetItemState as described in the MSDN Library:
"An application might change other state bits to disable or hide the item, or to specify an overlay image or state image."
|
|
|
|
|
It looks like bug in the documentation. They only list the following item styles: LVIS_CUT, LVIS_DROPHILITED, LVIS_FOCUSED and LVIS_SELECTED. The closest thing to item hiding would be setting the state to LVIS_CUT - Windows shell uses this style to display file icon after 'Cut' command.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi
Ive a MSFLexgrid control which fetches data from a database.how do i print the data's from the control.
Im using VC++/MFC Framework for developing this application?
Your help will be appreciated.
|
|
|
|
|
i have a little problem in an application where i use ado method to catch value from excel.
So, i have created an dialog box with a button which could getting data from a selected called database. the first aim of this application is to read all the first field of the database and find the same value that the value given in the dialog box by the user.
When i try to run the application, I could push my button but I have the message box which appears with this message:"Database Error cannot update Database or object is read-only"
So, anybody could explain me what happen?
thanks
gerald
|
|
|
|
|
Hi all,
I want to create files of my own defined extension and also want to have icon for them of my choice(that will i made in VC++ resouce editor). How can i assign my own made icon to file. Plz tell me as early as possible if anyone know solution.
Regards
Abid
|
|
|
|
|
can i get a skeleton code for an application developed on Win CE.
This is basically to test the bluetooth device working.
N.BHARADWAJ
Software Engineer
MICROCON INTERNATIONAL LIMITED
BANGALORE.
|
|
|
|
|
I need the specification given to software developer to write driver for any device.
Like memory, I/O, IRQ, Registry and so.on.
kindly reply
N.BHARADWAJ
Software Engineer
MICROCON INTERNATIONAL LIMITED
BANGALORE.
|
|
|
|
|
Hi All,
I've just discovered I can handle the various kernel exceptiions, like 0xc0000005 : Access Violation by using:
catch (...) {
}
Is it common knowledge that this can be done? Why doesn't everyone handle GPFs etc like this (nicely)...
By the way, does the caught exception have a type?
nb
|
|
|
|
|
Answered my own question- you can only catch them with the ellipsis
if anyone's interested in this, check out _set_se_translator() in the MSDN
cheers
\
nb
|
|
|
|
|
Hi,
I'm creating an ActiveX control to be embedded into a web page. This control contains a child dialog with a number of controls in it. The problem is that certain key presses are not received by this child dialog, specifically, TAB, cursor keys and (importantly) Backspace.
I understand that certain key presses such as TAB and cursor keys require PreTranslateMessage to be overridden in the COleControl derived class. I have done this.
I also know that I should be calling LockInPlaceActive on the control when it is activated so that I can capture these WM_KEYDOWN messages, but when I debug this control when it is embedded into a web page (and viewed in Internet Explorer), LockInPlaceActive always returns FALSE.
Does Internet Explorer disallow in place active? Is there any way that pressing Backspace in a child Edit control of the ActiveX control will actually edit the text rather than returning to the previous web page?
Thanks in advance.
Derek Waters
|
|
|
|