|
Thanks! Here was example:
* STRTOK.C: In this program, a loop uses strtok
* to print all the tokens (separated by commas
* or blanks) in the string named "string".
*/
#include <string.h>
#include <stdio.h>
char string[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;
void main( void )
{
printf( "%s\n\nTokens:\n", string );
/* Establish string and get the first token: */
token = strtok( string, seps );
while( token != NULL )
{
/* While there are tokens in "string" */
printf( " %s\n", token );
/* Get next token: */
token = strtok( NULL, seps );
}
}
Output
A string of ,,tokens
and some more tokens
Tokens:
A
string
of
tokens
and
some
more
tokens
|
|
|
|
|
Who can point me to sample or article about using LPSECURITY_ATTRIBUTES in AfxBeginThread function?
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
What's the difference between COM and COM+?
If I create a COM DLL using VS.NET on XP, does this automatically mean it's a COM+ component?
Regards
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
|
Thanks Michael
So basically COM+ is COM plus some extra stuff
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Some problems on VC++ activex:
i try to add-in a telephony class from the below directory
Components and controls gallery->Registered Active X
control->Telephony class
Xtel.dll
but when i try to execute the application,it show application error:
[The instruction at "0x676c49ee" referenced memory at "0x00000008".The
memory could not be "read".]
and when i try to debug it,it show
676C49EE call dword ptr [ecx+8]
Do anyone have any idea what happen on it?
thanks...
|
|
|
|
|
Dear all,
In a dialog-based application, I have a main window. I want set it
with a changable size of the window as usually used window's application.
How to maximize, minimize or freely change the size of the window in
a dialog based application?
Thanks in advance!
xyz
|
|
|
|
|
Change the window styles.
First, in order to be able to resize the dialog you will want to remove the WS_DLGFRAME style from the dialog and replace it with a WS_THICKFRAME style.
In order to be able to maximize the dialog you will want to add the WS_MAXIMIZEBOX style to the dialog.
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!
|
|
|
|
|
And you can do all that in the Dialog editor.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi!
I have a preview control which draws metafiles. How can I draw metafile, but with colors which have been defined in my application?
Thanks for help!
|
|
|
|
|
I have got an anwser...
Enumerate metafile, and just before PlayMetaFileRecord() select desired pen.
|
|
|
|
|
Hi,
I have created a win32 Dll in Visual C++ .Net. I tried to call the functions from the dll from another VC++ .Net Win32 Application project. I have used the Load library method to load the dll and its functions. In the first function call from the dll it gives the following error
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
I tried with differenct calling conventions __stdcall and __cdecl. I have tried the same project with the static library. It's working fine.
What i have to do to avoid this error?.
Thanks in advance.
Regards,
RajaSingh R.
|
|
|
|
|
After your call to LoadLibarary are you calling GetProcAddress to get the pointer to the function in the DLL?
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!
|
|
|
|
|
Yes I have used the GetProcAddress and get the pointers for the functions and used these pointers for calling the functions. I followed this procedure correctly.
|
|
|
|
|
This may sound like a stupid question, but are you trying to call a non-static member function directly (read: without using an instance of the containing class)? I only ask because I have seen someone try somethig like that before, and of course, it does not work correctly.
The error you are seeing I have encountered only when there was a calling convention mixup, or the function pointer was typedef ed incorrectly. For example, if the function in the DLL expects 4 parameters, but my function pointer is typedef ed to take only 3.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
G'Day All,
I have created a Dialog application that will manipulate some excel spreadsheets. In my OnInitDialog function (I am using MFC) I perform a test to see if excel is currently running. If it is running I display an interim modeless dialog that politely informs the user to shut excel and waits for them to do so (done with a call to WaitForSingleObject if that is relevant). This is all fine. Once excel is closed then I close this interim dialog and my OnInitDialog function completes and my 'real' dialog is displayed. However my problem is that when my 'real' dialog is displayed it is done so without the focus - it is not the currently active window. I have tried numerous things such as SetActiveWindow(), BringWindowToTop() etc without success. I was wondering if anyone could suggest a way of having my 'real' dialog start with the focus as it normally would if I wasn't mucking around with other windows whilst it was starting.
Much Thanks In Advance
Richard.
|
|
|
|
|
Did you try SetForegroundWindow?
Use in together with SetActiveWindow.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
No, not until 30 seconds after you suggested it Nish
I missed that one. It now works like a charm. Thanks Nish problem solved!
Richard.
|
|
|
|
|
I am coding a networked game in VC++6, and I need to send data and access functions between a server and a client. How do I do this with CSockets?
|
|
|
|
|
Are you comforable with sending raw data across the network with CSockets?
You could use COM and MIDL, then the compiler will generate the proxy stub code for you to make the RPC calls,
or if you want to do it by hand:
What you will need to do is package up the function that you would like to be called into a packet to be sent to the client. You could create a table of functions and each function would be represented by an index.
So in your RPC data packet that you send across, you would reference your RPC function by its index, then you would add the data to be called for its parameters.
On the client side when this data packet is processed, your decode function would look up the RPC id in your table and call the function.
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!
|
|
|
|
|
or, alternatively, use CSocketFile and "serialize" your data across the wire, deserializing it on the receiving end.
|
|
|
|
|
Can anyone provide me information on how to render the font in a dialog edit box in a fixed pitch format as opposed to the normal way that the font normally displays. For example the normal Dialog font is MS San Serif and this is a font with variable width characters and is normally rendered in a variable pitch manner. I need to render the font in a fixed pitch format so that columns of text in edit boxes stacked above one another will line up vertically. I have tried using the Trur Type Courier font....That works until one switches the dialog font to unicode in order to support Japanese, Chinese, Arabic, etc. ANy help out there?
|
|
|
|
|
I dont think you can do that.
But what I would suggest is go for GetTextExtent
and test the width and keep adding spaces until
you get enough for the column width you want to
have.
|
|
|
|
|
Thanks Prem.....But I need individual character columns to line up vertically just as they would with a fixed pitch font.
|
|
|
|
|
I think in order to do this with a TTF that is not mono-spaced you will need to create an owner-drawn version of the edit control.
When you draw the characters, you will first need to scan the font that you are creating and determine the width of the largest character in the font. You can use a function like GetCharWidth32 .
Then when you paint your characters into the edit control, the column width will be at least the width that you calculated for the widest character. You will need to paint one character at a time, one character per column.
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!
|
|
|
|