|
here is the code i have written for this
CString strText = "some -text";
printf("%s",(LPCTSTR)strText);
int nLen = strText.GetLength();
int nPos = strText.Find('-');
if ((nPos>=1) && ((nPos+2)<nLen))
{
char chRight = strText.GetAt(nPos+1);
char chLeft = strText.GetAt(nPos-1);
if (chRight != ' ')
strText.Insert(nPos+1,' ');
if (chLeft != ' ')
strText.Insert(nPos,' ');
printf("\n%s",(LPCTSTR)strText);
}
else
{
printf("invalid string to modify");
}
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Patte
-- modified at 0:10 Wednesday 12th July, 2006
|
|
|
|
|
Hi,
This will help you
CString csText = "some-text";<br />
int nIndx = csText.Find( "-" );<br />
if( csText[nIndx-1] != ' ')<br />
{<br />
csText.Insert( nIndx, ' ' );<br />
++nIndx;<br />
}<br />
if( csText[nIndx+1] != ' ')<br />
{<br />
csText.Insert( nIndx+1, ' ' );<br />
}<br />
"Dream bigger...Do bigger...Expect smaller"
aji
|
|
|
|
|
Hey there,
thanks for ur suggestion and help.
If you must use On_rx(), you can check how much time elapsed since last On_send() call without using timer.
How do I do this?....Can you show me the code?
Jun wrote:
I'm not going to check the details of your code. Rather, I'll treat it as pseudo code.
First, be careful with OnTimer() and On_rx() logic, which could be conflicting. If you use timer, you should check whether your received the feedback inside OnTimer(), not On_rx(). If you must use On_rx(), you can check how much time elapsed since last On_send() call without using timer. OnTimer() and On_rx() complicate things unnecessarily.
Second, the blocks {} you used in the segment are incorrect:
thathvamsi wrote:
On_rx(wparam,lparam)
{
//checks for packet received
//if no packet received from serial device, then
{
//check for timer
//while(timer has elapsed)
OnTimer()
{
//resend the packet to MPU
post_message(WM_RESEND,null)
}
}
}
Best,
Jun
|
|
|
|
|
Win32 function GetTickCount() returns the time elapsed in milliseconds since the system started. Call it in two place and substract to get the time interval you want.
Best,
Jun
|
|
|
|
|
May someone help me to solve this problem.. plzzzzzzz
PROBLEM STATEMENT:
You are experiencing problems with getting Front Page 98’s hover buttons to function. You are supposed to solve this problem in a very short time. Think about the possible ways that you can do to solve this problem very quickly.
Applet codes of your web page is as follow:
<big><code><applet code="fphover.class" codebase="./" width="120" height="24">
<param name="color" value="#000080">
<param name="hovercolor" value="#0000FF">
<param name="textcolor" value="#FFFFFF">
<param name="text" value="C Programming">
<param name="effect" value="glow">
<param name="url" valuetype="ref" value="http://metalab.uniten.edu.my/~azhana/indexCProg.html">
</applet></code></big>
nothing
|
|
|
|
|
Again ?!%!%!
didn't you post this in every boards on CP ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
How much are you offering?
Objects in mirror are closer than they appear
|
|
|
|
|
You mean what grade will you get?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
Never mind. I was just being facetious.
Objects in mirror are closer than they appear
|
|
|
|
|
Me too
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
If you're taking a class on Front Page 98 (or any version), then I'd ask the school for my money back!
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Howdy out there...
For use as inter-thread locks -- are mutex's better than critical sections?
They both seem to work just fine...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Each has its own pros & cons. It all depends on your requirement and situation.
Best,
Jun
|
|
|
|
|
critical section better
Kuphryn
|
|
|
|
|
Critical section is a little faster as it does not require a context switch to kernal mode. Mutexes have the advantage that they can be named and shared between processes.
Objects in mirror are closer than they appear
|
|
|
|
|
Peter Weyzen wrote:
Howdy out there...
For use as inter-thread locks -- are mutex's better than critical sections?
If Under Same Process Critical Section would be better otherwise Mutex!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I have a probelm with the help file of my project. I have a user interface. if the user focus on the control ( such as button, editbox, combobox, etc...) and press F1, i need to display the help file for the focussed control. I created the help file and linked everything. But now the problem is, if i focus on edit control and press F1, help file open and minimized to taskbar. But for other control, it opens in the maximized window. I use the same function to display the help file for all control.
Can anyone please help me in this to make the minimized help window in taskbar to a maximized window in the display?
Thanks in advanve.
Regards,
Ram
|
|
|
|
|
Use spy++ to look at what messages are sent to the controls and the help window when you press F1. You should be able to see what the difference is and code around it
Objects in mirror are closer than they appear
|
|
|
|
|
Does anyone know how to set the keepAliveTime on a per (tcp) socket basis? I know you can change the system wide value by changing the registry key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters, but I thought I read somewhere that you can change it on a per-socket basis on Windows 2000 and later ... but I just can't find any examples anywhere...
cheers,
Neil
|
|
|
|
|
I don't believe it can be changed per-socket, only per-process, and it's likely not what you want to do anyways.
See: http://tangentsoft.net/wskfaq/newbie.html[^] 2.13.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
There is none per socket, you probably want to implement an application specific keep-alive mechanism (e.g. for a faster detection time of dead connections). I can recommend reading the book "Effective TCP/IP Programming" from Jon Snader.
|
|
|
|
|
Hi. I tried to detect all running user applications (no all processes) and close them all. Obviously this is a usual function that has been existing in many programs.
I used the ::EnumWindows API to enumerate all the windows. There are a lot of irrelevant result so I have to use some filters. One of them is to filter out the invisible windows.
But unfortunately this filter also filters out the applications that was minimized in to a tray icon. But if I turn off this filter, a lot of irrelevant system processes and other hidden windows will get through as well. I have no way to tell which one among them is user application, which one is not.
I noticed that the taskmgr program in windows has the same problem. It doesn't display the tray icon programs. Instead, it only displays their processes in the processes list.
I have imagined that if there is API to enumerate the applications that has a tray icon, it would solve my problem. Or maybe there is a better way to get the list of user applications rather than using ::EnumWindows, but I have no clue about it.
So anyone of you has a thought?
Thanks very much!
|
|
|
|
|
Just a guess, but take a look at EnumProcesses and/or CreateToolhelp32Snapshot . According to MSDN these functions can be used to list all processes running on the system.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hey I'm a rookie and I want to get familiar with WFC libary.
I have problems in installing (using) this libary. I followed all the steps from the Tehnical Notes but I can't get it to run. I get this message error:
----------------------------------------------------------------------
WARNING! You are compiling for a version of NT before 4.0, you may have problems in the RAS stuff.
You will probably have problems in the RAS stuff.
Don't be suprised is TryEnterCriticalSection fails too.
To get rid of this warning, add WINVER=0x401 to the Preprocessor definitions in the project settings.
Using MFC in a Shared DLL.
Linking with DebugBuildOfWFC.lib
Linking...
LINK : fatal error LNK1104: cannot open file "DebugBuildOfWFC.lib"
Error executing link.exe.
Creating browse info file...
dummy.exe - 1 error(s), 0 warning(s)
-----------------------------------------------------------------------
The code that generates this error is:
-----------------------------------------------------------------------
#include <wfc.h>
#pragma hdrstop
int _tmain( void )
{
CString version_string;
wfc_get_operating_system_version_string( version_string );
_tprintf( TEXT( "%s" ), (LPCTSTR) version_string );
return 0;
}
-----------------------------------------------------------------------
I maneged to built the WFC.lib, but I can't use it. I would really need some
help or suggestions. I can't go on without this. Thanks.
|
|
|
|
|
Star_dust wrote: LINK : fatal error LNK1104: cannot open file "DebugBuildOfWFC.lib"
I've never used WFC before but from the error message, build the debug build of the WFC library. Make sure it's named DebugBuildOfWFC.lib and make sure that the linker can find it on one of the paths.
|
|
|
|