|
No problem, I know I should probably RTFM but templates is a big subject. I think once i get rolling I'll probably start to pick up the things that are making this break.
Thanks
|
|
|
|
|
I had the same problems as you describe and ended up going back to VC6 because the effort to fix all the compiler errors was not worth it.
John
|
|
|
|
|
BOOL CDC::GetCharWidth( UINT nFirstChar, UINT nLastChar, LPINT lpBuffer ) const;
I found this function a little hard to understand, as stated by MSDN, this function takes 2 UINT's as the 1st and 2nd chars in a consecutive group of characters, the 3rd parameter is an array of int's which is retrieving char widths. This leads to my confusion, in practical, we often want to determine the width of a particular char or string, not something like 'A' to 'Z' or 'a' to 'z'. For example, if I want to know width of string "Hello Code project!" then what should I do? This string has length of 19, do I need to call GetCharWidth 19 times each time pass in something like "'H' to 'H'", "'e' to 'e'", "'l' to 'l'" and so forth?
I mean, why wasn't this function like this: int CDC::GetChatWidth(TCHAR ch) const or int CDC::GetCharWidth(LPCTSTR lpString) const , simply take a char or string and return its width? Sorry if this sounds like a stupid question, but I'm really confused.
|
|
|
|
|
=[ Abin ]= wrote:
int CDC::GetChatWidth(TCHAR ch) const
You can get this by passing in just the char you want, surely ? A helper function to do what you want would be easy to write, just write a CDCFacade class.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
There are some very good applications for GetCharWidth(), determining the display width of string is not one of them. Let's just say it is far more complicated than you want to know at this point in time.
If you need to know the display width and height of a string, use one of the text extent functions: GetTextExtent(), GetTabbedTextExtent(), etc...
Internaly the text extent functions may be calling GetCharWidth() to help in determining the size of the final bitmap image.
I have used GetCharWidth() in the past in order to create DOS style binary font bitmaps for Windows fonts (TT, etc...). That is only one of 2 situation that I found where this function is useful. Of cource if you could figure out what mathimatical algorythms are used to determine charater placement strings in Windows, then by all means write an acticle and let the rest of us know.
If you tried to use GetCharWidth() to determine the displayed legnth of a string, I'm here to tell you that it is not possible unless the font used is not variable spaced. If you dig into the subject you will find that you have to deal with thing like overhang, underhang, spacing between characters, and a whole host of other variables (depending on font type).
The short of it is that GetCharWidth() is only useful in a few specelized situation.
INTP
|
|
|
|
|
Thank you for the detailed explanation.
|
|
|
|
|
How can I prevent my app from being closed (Other than from the task manager)?
What messages can I trap to prevent it from closing?
|
|
|
|
|
OnClose ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I shouldve said it was an SDI app. On close wont work there will it?
|
|
|
|
|
Why not ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I have some code here that I have been playing with to implement a elevator's computer. I have everything kind of mapped out in my head how it's going to work but am having a problem with converting a char to an int. I would like to send the char c to the thread "move( )" and use it as an int. So bacically, How do I convert a char to an int using only djgpp compiler and multi-c operating system.
Here is what I am working with.
void move(char c)
{
}
void getFloor(void)
{
DWORD32 timeout;
short c;
for(;;)
{
BYTE8 floor;
SetCursorPosition(8,10);
while(!ScanCodeRdy())
MtCYield();
floor=GetScanCode();
if ( !(floor & 0x80) )
{
c=ScanCode2Ascii(floor);
PutString(" Floor ");
PutChar(c);
}
}
}
|
|
|
|
|
Conversion between int and char is implicit in C++, dunno about C. But surely a cast will do it ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
90% of the what is true in C++ is also true in C, minus class support. In other words, the conversion is implicit in C too. Take away class support and the ability to add member functions to structures and what you have is C with much better syntax checking.
INTP
|
|
|
|
|
what elevator company do u work for?
*makes a note not to ride in those elevatots*
"there is no spoon" biz stuff about me
|
|
|
|
|
After a lot of hard work and a lot of messing around i finally finished my Layered Service Provider. So i went to test it on another machine running Win98 (i'm running XP). But WHOA arghhhh its not working right!!! It just wont install the Service provider! I read everywhere on the web that LSP's work on win98 too as long as you have Winsock 2 installed. And that machine did! But sceptic as we are, we install the Winsock2 update again, wham error: something about an unsupported operating system version. But its Win98! So i tried it on ANOTHER win98 machine, same error. ???? I'm really confused. Can anyone tell me how to get an LSP to work on Win98??
Kuniva
--------------------------------------------
|
|
|
|
|
Hi. What I want to do is create an application (Doc/View app) that does this:
1) places a widget on the (Doc/View) drawing area
2) allows the user to drag the widget to another area on screen
3) when widget is double-clicked, a new "window" opens - could be a dialog, or another View window.
4) point-click to connect widgets with a line
I did a quick search in CodeProject and found the DDRmgr example,
Drag-Drop Manager for CObjects by Wes Rogers (http://www.codeproject.com/clipboard/ddmgr.asp?target=drag%7C%2Bdrop)
but want more/another example.
Can anyone help with this?
Thanks,
Johnny
|
|
|
|
|
I have a crude example (in Flash 6, 4.5kb) if want to see more details.
-- regards, Johnny
|
|
|
|
|
OK...here is my problem...
I have an mdi aplication vith a toolbar. The toolbar has 3 buttons. any of this 3 buttons open a different view window.
button 1 -> view hith a combobox
button 2 -> view with a editbow
button 3 -> view with a list control.
so far so good. My problem is that i must "erase" the close minimize and maximize buttons form the title bar and I don't know where to do it. I tried in CMDIChildFrm :: OnPreCreateWindow to modify the cs but I managed to do that only for my first window that I open. When I open the other 2 buttons they still have the max, min and close buttons.
Question is Where and how I must define the style for all 3 view windows so that when I create them they will be created without the min, max & close buttons.
sorry for my bad english
|
|
|
|
|
Good English, very good infact!
Set a pointer to the window (the button) GEtSafewh...
The show or hide them at will.
Best Wishes,
ez_way
|
|
|
|
|
In a dialog based program ,I have a default constructor like this:
CUpdateRcrd::CUpdateRcrd(CWnd* pParent /*=NULL*/)
: CDialog(CUpdateRcrd::IDD, pParent)
{
//{{AFX_DATA_INIT(CUpdateRcrd)
m_vtName = _T("");
m_vtPass = _T("");
m_vtUsername = _T("");
m_vtUrgent = _T("");
m_vtPhone = _T("");
//}}AFX_DATA_INIT
}
I wanna add and use my own constructor.A constructor that takes one integer argument.I add my own constructor via member function and made an instance of my object,using the new constructor.but the appliction crashed at run time.Can anyone help?It's a matter of life and death.
|
|
|
|
|
|
You could just add an interger argument to the origanal constructor thus:
CUpdateRcrd::CUpdateRcrd(CWnd* pParent /*=NULL*/, int n /*=0*/)
You could make a copy (cut & paste) of the origanal and use it as a bases for your new constructor.
You could pull out the intialization code from the origanal constructor and store it in a sperate member function that is call by all additional constructors that you create.
No matter how you go about it, what ever the origanaly constructor is doing you must do the same thing in any constructor you create. If you are not doing this then some thing is not being initialize to a known state durring construction and a what do you know it crashes.
INTP
|
|
|
|
|
Hi, im considering learning about writting apps for the palm os, and i have found tons of info, APIs, etc. but i cant seem to find exacly WHAT do i need to compile this kind of applications.
Can VC6 be used for this? or do i need to get (aka BUY) another IDE, compiler, etc.?
Thanks!
|
|
|
|
|
The best bet is to buy another IDE such as CodeWarrior or look for similiar IDEs in the GNU community.
I'm not familiar with the latest Palm OS (past ver 4.1), but the Palm OS is/was based upon the Motorola processor. The apps one writes and places on the Palm are embedded system applications.
If you are only writing Conduits (the apps that handle updating the Palm/PC during a HotSync), then VC++ IDE can do the job for you.
More info?
Johnny
|
|
|
|
|