|
thank you agan.
i decided not to detect if it is unicode programmatically, but still a have a small problem left - when i display unicode string there is some garbage at the beginning of the text (1-2 bytes, "FF FE" usually), any idea how to avoid it?
may be i should start reading the file with StreamIn from the first ASCII code ?
|
|
|
|
|
How can i save save a text string with formatting to a tga file using GDI??
Rashid
It is necessary once in one's life to put every thing in doubt, so far as possible, in order to reach the truth. DesCartes
|
|
|
|
|
You can't save a TGA file using GDI, if you can't use GDI+, you need to use another library like Paintlib.
To save the string, you need to draw it onto the bitmap.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I used a program that accesses the internet form a book called "Sams teach your self Visaul C++ 6
Online in Web time" ( isbn 067231668) The program is at page 496. I also used the sample program off the CD rom and get the same result. Every time I use the program I get "URL Does not use a Recognized protocol" Where do I go from here to solve this problem?
Thank you,
doug@evansville.net
|
|
|
|
|
Perhaps you're using a misspelled protocol, eg: htpt://foo.com ?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
1.These two are supposed to take int args: Yet I see them being used a as isalpha('t') etc, i.e we are giving it a char arg. Why is that?
2.I did:
char r[256] ;
int t;
cout << " enter string ";
char c = cin.peek();
cin >> r;
while (c != '\n')
{
c = cin.peek();
if (isalpha(c))cin >> r;
}
cout << " tr" << r << endl;
}
but when I put in 'abc%def' i got back the identical thing, not 'abcdef' which is what I expected...
3.Also I wanted to weed out spl chars using isalnum so that an input like
abd$ef would get fed in and come out like abdef:
char s[256];
cin >>s;
but isalnum wont work either...
thanks,
ns
|
|
|
|
|
nss wrote:
These two are supposed to take int args: Yet I see them being used a as isalpha('t')
The original C library has some, shall we say, "interesting" designs. One of them being that the character-oriented functions (most notably getchar() ) actually operate on int s. This is because of EOF , which is a special value that cannot be a legal char value. So the parameter type is something that can hold all legal char values, plus EOF , and they chose int .
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
You cannot truly appreciate Dilbert unless you've read it in the original Klingon.
|
|
|
|
|
As an answer to the first reply:
I wouldn't say 'interesting'. I find it extremely useful that I can use both character symbols and integers to a character stream. Using an integer variable with a character conversion gives me access to symbols that are not normally available in the C/C++ coding syntax, such as scandinavian characters.
Now, for the other questions. Firstly, you should consider using some other stream input function. Read the entire input string in first, then go through the string, removing all invalid characters. The problem with your function above is that when you peek the character, and then test it in against the alphanumeric conversion, you don't explicitly convert the character into an integer. Add an (int) conversion operator before c . This might solve the problem, but an even better implementation is to read the entire string first.
What happens now is that you peek the character, and if it is alphanumeric, it is read into the input stream. If it is not alphanumeric, the character is left into the input stream, and you peek for the next character. As it happens now, the next character is considered alphanumeric, and the cin >> operation executes, and it actually reads everything from the input stream into the buffer, because r has lots of space available.
Here is an alternative implementation that is a bit closer on what you are trying to accomplish:
char buffer[256];
char c;
int nIndex = 0;<DIV>
cout << "Enter string: ";<DIV>
while (c != '\n')
{
cin >> c;
if ( isalpha( (int)c ) )
{
buffer[nIndex] = c;
nIndex++;
}
} Not sure if that will work, but test it out & debug if needed.. But you should get the big picture
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
|
i want to create a window that when the application or dialog is deactivated
or when mouse is clicked ont over of menu rect this window automatically
close.
thanks
|
|
|
|
|
you need to add a handler for WM_KILLFOCUS event and then post WM_QUIT message to your application.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
i am making a application which takes input from serial port and stores it in access database, Now i have been asked whether its possible to give user option to choose database to feed data into (through FILE->Open)
Also if it is possible to create a new database ( new .mdb file )in File->new
This is my first professional project and i dont have any other technical inputs except this site. I want to know whether its allowed/possible ( copyright issues ?) to create file in Ms access format ? and if yes how ? which classes will be useful to me ?
Heuriskeinner
|
|
|
|
|
heuriskeinner wrote:
if it is possible to create a new database ( new .mdb file )in File->new
yes it is possible, you need to use the appropriate sql command i.e "Create database..." to create a new database.
heuriskeinner wrote:
which classes will be useful to me ?
CDaoDatabase and its supporting classes will be usefull for you.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
hi,
do someone know witch DLL file can contains all nio functions?
like this one: int _kbhit( void ); //Checks the console for keyboard input.
i want to import this function in my c# application.
thank u in advance!
|
|
|
|
|
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
anyways i belive in C# there must be something similar to kbhit.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
hi, thank u for ur replay.
i've found this in msvcr71.dll too.
i do not think so.
everything u have in c# is Console class.
best regards!
|
|
|
|
|
oOomen wrote:
i've found this in msvcr71.dll too
you will need msvcr71.lib to use that dll.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Mr.Prakash wrote:
you will need msvcr71.lib to use that dll.
mMmm...
i just know this way!
<br />
[System.Runtime.InteropServices.DllImport("msvcr71.dll")]<br />
static extern int _kbhit();<br />
<br />
public bool KeyboardHit<br />
{<br />
get<br />
{<br />
return System.Convert.ToBoolean(_kbhit());<br />
}<br />
}<br />
|
|
|
|
|
Oh ok, you know the best how to import it in the C# application, coz i dont know anything about C# atleast for now.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hello all,
I'm presently learning how to use my own message handlers in my MFC application. I read this article: Windows Message Handling - Part 2 here: http://www.codeproject.com/dialog/messagehandling2.asp.
I have a problem with one line of code; when I need to get the CWnd* to send the message.
In my case, I want to send the message to my main view based on CFormView when I'm in another dialog or class.
Here's how I was trying to do it:
pMyMainView = CWnd::FindWindow(_T("CMyMainView"),NULL);
pMyMainView->SendMessage(WM_MYMESSAGE,0,0);
But FindWindow don't find my CMyMainView, so I can't send the message.
I tried "this->SendMessage(WM_MYMESSAGE,0,0);" in my CMyMainView.cpp to verify my message handler and it's working.
It must be so simple! But I started coding in C++ and MFC only 1 month ago.
Thanks,
Dave
|
|
|
|
|
I'm not sure what you mean by "my main view". To get the application's main window, use AfxGetMainWnd() . To get the dialog's parent window, use GetParent() . Hope this helps.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thank You Ravi, I knew it was simple, but...! hehe It worked with GetParent();
|
|
|
|
|
Hi,
I have an existing dialog and I add a tab control from the resource editor. I call the CTabCtrl::InsertItem() function and can add tabs to the control but I cannot put anything in them. I can also create a property sheet and add property pages but my property sheet has an OK, Cancel, Apply and Help button which I don't want. What I really want is to create my tab control and add my property pages to the tab control but I do not know any way to associate property page with tab control.
Please help.
|
|
|
|
|
Why do you want to add propertygpages to the tabcontrol, you will still get the same output as in propertysheet.
if you want to do something to the tab control, then you can get the handle of the tabcontrol that the property sheet is using, by calling gettabcontrol() in propertysheet.
check this out and then deside wheather this is good enough.
If you want your tabcontrol to work then you can simple subclasswindow the default tabcontrol to ur tabcontrol.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
A tab control is not a property sheet. A tab control is only the "tabs" part of a property sheet. There are couple of things you can do:- Create child window dialogs for every page. Create a custom tab control that displays a specific child window in response to a tab selection. This isn't hard but is non-trivial. I'll post an article that has a canned class that you can use, soon.
- Use a modeless CPropertySheet. See this[^] MSDN article for instructions.
Hope this helps.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|