|
Thanks for u r Reply .....
its good to see u that we r thinking same way...!!
For Only Number- parsing last time I have written , that I have written various Regular-Expression (RE) to parse the given length number in case statment !!! ( one of Example of RE for stringlen(8) I have given last time )
In Last Reply I have asked a'bt how to tekal words like : "this Month" , "this year", "Next Month","Next Year", "Previous Month", "Previous Year", Etc...
Currently I m thinking in a way that, I m Extracting DAY,MONTH,YEAR from the given pattern and then I search for words (this, next, Previous)tide with DAY,MONTH,YEAR word and then from Current system date Extratcion of current DAY, MONTH , YEAR......I m incrementing (+1) or decremanting (-1) by one to corresponding DAY,MONTH,YEAR variable . But,conflict for "next " phares is when we r in Decemeber and "next month " phares occurs then we increment Year and set month to January ......similar problem for "Previous" phares at January month ...? (( ........
Is It I m going right way in my path ? or .....any other good Idea ??
wait for u positive reply and then start implementing this Idea.....
Cheers ,
Rajan Kapadia
|
|
|
|
|
Rajan Kapadia wrote:
I m incrementing (+1) or decremanting (-1) by one to corresponding DAY,MONTH,YEAR variable . But,conflict for "next " phares is when we r in Decemeber and "next month " phares occurs then we increment Year and set month to January ......similar problem for "Previous" phares at January month ...? ........
Is It I m going right way in my path ? or .....any other good Idea ??
This is how I did it some eleven years ago. But since MFC has four date-related classes (I'm not sure if STL does or not), I would use them instead. There's no need to reinvent the wheel.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
This is how I did it some eleven years ago. But since MFC has four date-related classes (I'm not sure if STL does or not), I would use them instead. There's no need to reinvent the wheel.
I m not Understanding ..? can u Explain me in Deep??
As Mention preiously that how i can code perticular Pattern like this :::
" Next year 10th of January " ------> "Next Year [Day](th)* (of) [Month]" (I m parsing using this rule) and initilize the DataTime strucure with parsed Day,Month and missing term Year with Current System Year with (+/-) corresponding to words like " previous, next, this" phrases.
Replacement pattern is : [Month] [Day], [CurrentSystemYear]
can I stic to this type of staic parsing ?
Is it write way to do it ?
Waits for u r reply!!
Cheers,
Rajan Kapadia
|
|
|
|
|
Rajan Kapadia wrote:
I m not Understanding ..? can u Explain me in Deep??
Instead of doing this:
void IncrementDay( int &nMonth, int &nDay, int &nYear )
{
nDay++;
if (nDay > DaysInMonth(nMonth, nYear))
{
nDay = 1;
nMonth++;
if (nMonth > 12)
{
nMonth = 1;
nYear++;
}
}
} Do something like this instead:
CTime today = CTime::GetCurrentTime();
CTimeSpan oneDay(1, 0, 0, 0);
CTime tomorrow = today + oneDay;
CTime yesterday = today - oneDay; Simpler?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
this one is simpler ....but how to takel with Month & Year ....increment ....No constructor for which give us month and year initilization.( we can't sent timeticks also ....i.e 30|31 * oneDaytime or 365|366 * onedaytime )
How i can Do increment & decremant Month & Year Now from U r Way ! U make me more confuse by giveing this idea!
also, how u think a'bt my Search-Replace Rule Idea ?
Wait for u r reply here !!
Cheers ,
Rajan Kapadia
|
|
|
|
|
Rajan Kapadia wrote:
How i can Do increment & decremant Month...
By knowing how many days are in each month. If today is July 27th, 2005 and I wanted to advance one month, use:
CTime today = CTime::GetCurrentTime();<br />
CTimeSpan oneMonth(31, 0, 0, 0);<br />
CTime nextMonth = today + oneMonth;
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi all,
I have a program that contains a Server and a Client app.
I want my server app to this:
When I installed my server app it would automatically install the client app
on the all computers in the network.
I mean:
Installing a file on a computer in a network without having a client program!
It's very important,
Cheers,
Thanks,
MILAD.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
So the server will contain the client app, and will farm it out to all clients on it's network ? Sounds very viral to me. Can you be sure that your server will have the right to perform this action on all clients ? The easiest way would be to copy an installer onto the client machine, and put it's path in the runonce registry key so it installs on the next startup.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
So the server will contain the client app, and will farm it out to all clients on it's network ?
Yes I want to do this.
Christian Graus wrote:
Sounds very viral to me
No , of course not.My program Is a Network Manager that manages the local network.
Christian Graus wrote:
The easiest way would be to copy an installer onto the client machine, and put it's path in the runonce registry key so it installs on the next startup.
Exactly, But,
How to do this?
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
I believe the CopyFile APIs will take network paths.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
So the server will contain the client app, and will farm it out to all clients on it's network ?
Yes I want to do this.
Christian Graus wrote:
Sounds very viral to me
No , of course not.My program Is a Network Manager that manages the local network.
Christian Graus wrote:
The easiest way would be to copy an installer onto the client machine, and put it's path in the runonce registry key so it installs on the next startup.
Exactly, But,
How to do this?
Thanks,
MILAD.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
hum, are you programming a "trojan-like" ???
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi and thanks for your reply,
I don't want to use this code for a Virus or something like that,
I want ir for my program that called Network Manager and I want this program to
Install the client program Automatically on other computers,
Please help me on this,
Very Importent,
Thanks,
MILAD.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
If you have administrative rights on the machines in the network, you can copy files to them using their administrative shares. If the machine name is "MachineX ", for example, the C: drive on that machine may be accessed using "\\MachineX\C$ ". Note that the administrative shares aren't normally visible in Windows Explorer. This lets you copy an application to each machine in the network. This lets the server put the client application (or at least an installer for it) onto each client.
The other part of the problem is getting each client to run the client application or the installer. There are several possibilities here.
1. You can access the client machine's registry remotely. Use the RegConnectRegistry function to connect to the client's registry, and then create a 'RunOnce' key that will run your application/installer on the next restart. You could conceivably even force the client machine to restart using the InitiateSystemShutdown function.
2. You can use the task scheduler service to create a job on the client machine. The job would run the application.
3. Create your own service that runs the application. Your server can install, start, and stop the service using the service control manager functions.
Software Zen: delete this;
|
|
|
|
|
Hello,
What is the use of the keyword __declspec in C++?
Can u please give an example?
Thnks in Advance
ShijuCK
|
|
|
|
|
According to google[^], it specifies[^] storage class information.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Respected All
I have a problem in ListBox
"I have a few bitmaps name in a list box now i want that when i select a name of any bitmap in this listbox i get the name(which is in string form) of the selected bitmap becasue i need to pick the name of the selected bitmap,
Hope + response
david
|
|
|
|
|
GetWindowText will give you the text of the selected string.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, for the configuration setting of my application (where i store them all in a global object), i let the user change the setting through a tree property page.
however, i am facing some problem with the UpdateData. This is because UpdateData actually first save, then validate the data. However, this behavior is a bit dangerous for my case.
I associate my configuaration setting directly to the controls of the property page.
Assume
1. User enter invalid data.
2. User click apply.
3. UpdateData called. A warning box come out to tell the user that the value is not valid.
4. User re-enter valid data.
5. User click apply.
6. Everything just work fine
However, problem comes here.
1. User enter invalid data.
2. User click apply.
3. UpdateData called. A warning box come out to tell the user that the value is not valid.
4. User immediately close the property page dialog box.
This time, the invalid data had been written to the global object although user had once be warned about the invalid data.
Is there any way I can first validate the control data, before the control data written in the variable?
Thank you very much!
|
|
|
|
|
yccheok wrote:
Is there any way I can first validate the control data, before the control data written in the variable?
I'd have assumed for starters that your dialog close method would only work if valid data was entered. The way I'd handle this is, if the data is not valid, change the focus to the textbox that is invalid, and check validity when the textbox loses focus.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The problem is, the user still can close the dialog by the X button or escape key. Look like I should have a trap in closing message handler......
|
|
|
|
|
|
Yes.
A typical DoDataExchange is a bunch of DDX_??? and DDV_??? calls.
If you place an if block ahead of all these and check pDX->m_bSaveAndValidate to be true, you can do any checking you want to prior to the 'collection' of the data from the control's back into your member variables. If you don't like something, then you can call pDX->Fail()
The UpdateData is not supposed to be called if the user 'cancels' the dialog box, but it will be called if they press OK. You can then handle the validation in the DoDataExchange. If the DoDataExchange fails, then the dialog will not exit with the OK button.
You can also write your own DDV_ routines and then use them within your project. I have written all sorts of different ones to verify files exist, folders exist, numbers within a certain range, strings don't contains certain characters, etc. They work great. Just use the ones within the MFC source code as a starting point to guide you on creating your own.
|
|
|
|
|
I write a class by C++, in this class use string. For exsample:
#include "string"
using namespace std;
int exsample{}
{
string strTest;
......
}
I compile by Visual C++.NET. I get a lot of errors:
(Compile by Visual C++ 6, no Errors)
Compiling...
wmutility.cpp
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(862) : error C2143: syntax error : missing ';' before '<'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(935) : see reference to class template instantiation 'std::istreambuf_iterator<_Elem,_Traits>' being compiled
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(862) : error C2238: unexpected token(s) preceding ';'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(863) : error C2143: syntax error : missing ';' before '<'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(863) : error C2238: unexpected token(s) preceding ';'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(866) : error C2143: syntax error : missing ')' before '*'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(866) : error C2143: syntax error : missing ';' before '*'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(866) : error C2864: '_Sb' : only const static integral data members can be initialized inside a class or struct
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(866) : error C2501: 'std::istreambuf_iterator<_Elem,_Traits>::_Sb' : missing storage-class or type specifiers
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(866) : error C2143: syntax error : missing ';' before 'throw'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(866) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(871) : error C2143: syntax error : missing ')' before '&'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(871) : error C2143: syntax error : missing ';' before '&'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(871) : error C2059: syntax error : ')'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\XUTILITY(871) : error C2143: syntax error : missing ';' before 'throw'
Please help me this problemp.
Thank you very much!
|
|
|
|
|
Best guess - your code is not standards compliant, but VC6 allowed it, in error. You're saying all you need to do is include the string class and these errors occur ?
EDIT
Apparently, if your file is named .c, instead of .cpp, you can get this error because the compiler will assume it's c and not C++.
/EDIT
EDIT3
#include "string" is wrong. It's #include<string>
/EDIT3
Christian Graus - Microsoft MVP - C++
|
|
|
|
|