473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Template Language: [!output .......]

Hello,

I want to add a date (ShortDateString) to a custom template-file (Class).
I use:

a.. [!output SAFE_NAMESPACE_NAME]
b.. [!output SAFE_CLASS_NAME]
c.. [!output SAFE_ITEM_NAME]
But I can't find anythig on a date (something like: [!output SHORTDATE_STRING])

TIA,

Michael
Nov 20 '05 #1
4 1361
Hi Michael,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to insert a shortdate
string into the template file.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think there is no such predefined symbol for shortdate string. We have to
do it ourself by add a symbol which represents the shortdate string into
the VCWizCtl Object.
For detailed information about the VCWizCtl Object, take a look at the
IVCWizCtrlUI interface.

We can use the AddSymbol Method of VCWizCtl Object to add the new added
symbol to the symbol table, so that when we render the Template file, the
symbols will be translated into the string it represent.

VCWizCtl Object
http://msdn.microsoft.com/library/de...us/vcext/html/
vxlrfVCWIZLibVCWizCtl.asp

Visual C++ Wizard Model
http://msdn.microsoft.com/library/de...us/vcext/html/
vcoriVisualCWizardModel.asp

The methods of the IVCWizCtrlUI.
http://msdn.microsoft.com/library/de...us/vcext/html/
vcoriVisualCWizardModel.asp

Here is some links about customized the Template.

Visual Studio Code Templates - Modifying Your Default Templates
http://dotnetjunkies.com/WebLog/bsbl...1/12/5519.aspx

Enterprise Templates: Building an Application Construction Kit in Visual
Studio .NET 2003
http://msdn.microsoft.com/library/de...us/dv_vstechar
t/html/vstchEnterpriseTemplatesBuildingApplicationConstru ctionKit.asp
e.g. we can change the template of console application.
usually the wizard for the console appliation is located in the path below.
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\

We need to change two file.
1. the js file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\Scripts\1033 \default.js
Add the code below at the beginning of the OnFinish function in the file.
var date;
var dateString;
date = new Date();
dateString = (date.getMonth() + 1) + "/";
dateString += date.getDate() + "/";
dateString += date.getYear();
wizard.AddSymbol("CURRENT_DATE", dateString);

2. The template file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\Templates\10 33\Module.vb
change the file as below.

Module [!output SAFE_ITEM_NAME]

Sub Main()
[!output CURRENT_DATE]
End Sub

End Module

After that if we create a new Console application, the module file in the
new added project will be below.
Module Module1

Sub Main()
4/15/2004
End Sub

End Module
[Note: My example is just for demo, I suggest you change according to your
request]
[And this will change the default behavor of VS.NET IDE and will easily
screw things up. So please DO make a backup before make any change to this
file.]

Please apply my suggestion above and let me know if it helps resolve your
problem.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #2
Thank you Peter, this is 100% what I needed
(....wizard.AddSymbol("CURRENT_DATE", dateString);).
(I already implemented it)

Kind regards,

Michael

""Peter Huang"" <v-******@online.microsoft.com> wrote in message
news:Qq**************@cpmsftngxa06.phx.gbl...
Hi Michael,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to insert a shortdate
string into the template file.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think there is no such predefined symbol for shortdate string. We have to do it ourself by add a symbol which represents the shortdate string into
the VCWizCtl Object.
For detailed information about the VCWizCtl Object, take a look at the
IVCWizCtrlUI interface.

We can use the AddSymbol Method of VCWizCtl Object to add the new added
symbol to the symbol table, so that when we render the Template file, the
symbols will be translated into the string it represent.

VCWizCtl Object
http://msdn.microsoft.com/library/de...us/vcext/html/ vxlrfVCWIZLibVCWizCtl.asp

Visual C++ Wizard Model
http://msdn.microsoft.com/library/de...us/vcext/html/ vcoriVisualCWizardModel.asp

The methods of the IVCWizCtrlUI.
http://msdn.microsoft.com/library/de...us/vcext/html/ vcoriVisualCWizardModel.asp

Here is some links about customized the Template.

Visual Studio Code Templates - Modifying Your Default Templates
http://dotnetjunkies.com/WebLog/bsbl...1/12/5519.aspx

Enterprise Templates: Building an Application Construction Kit in Visual
Studio .NET 2003
http://msdn.microsoft.com/library/de...us/dv_vstechar t/html/vstchEnterpriseTemplatesBuildingApplicationConstru ctionKit.asp
e.g. we can change the template of console application.
usually the wizard for the console appliation is located in the path below. C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\

We need to change two file.
1. the js file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\Scripts\1033 \default.js
Add the code below at the beginning of the OnFinish function in the file.
var date;
var dateString;
date = new Date();
dateString = (date.getMonth() + 1) + "/";
dateString += date.getDate() + "/";
dateString += date.getYear();
wizard.AddSymbol("CURRENT_DATE", dateString);

2. The template file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\Templates\10 33\Module.vb
change the file as below.

Module [!output SAFE_ITEM_NAME]

Sub Main()
[!output CURRENT_DATE]
End Sub

End Module

After that if we create a new Console application, the module file in the
new added project will be below.
Module Module1

Sub Main()
4/15/2004
End Sub

End Module
[Note: My example is just for demo, I suggest you change according to your
request]
[And this will change the default behavor of VS.NET IDE and will easily
screw things up. So please DO make a backup before make any change to this
file.]

Please apply my suggestion above and let me know if it helps resolve your
problem.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #3
Hi Michael,

I am glad that my suggestion will help you.

Have a nice day!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
"Peter Huang" wrote:
Hi Michael,

I am glad that my suggestion will help you.

Have a nice day!


Peter, first, thanks. This is ridiculously more difficult than it should be,
and the links you gave are extremely helpful.

One note about issues like the custom date string and so on... this is one
of the things which is VERY useful about having a scripting language in
there. A string can be created using JScript's own Date() function and then
even formatted with a great deal of precision.
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Oplec | last post by:
Hi, I'm learning C++ as a hobby using The C++ Programming Language : Special Edition by Bjarne Stroustrup. I'm working on chpater 13 exercises that deal with templates. Exercise 13.9 asks for me...
4
by: Thomi Richards | last post by:
Hi, I'm trying to create a simple stack class using C++ and templates. Everything works well and good if I amke the class totally inline. However, as soon as I try to seperate the class into a...
4
by: wkaras | last post by:
I would like to propose the following changes to the C++ Standard, the goal of which are to provide an improved ability to specify the constraints on type parameters to templates. Let me say from...
4
by: Dan Krantz | last post by:
I have the following template to ensure that a given number (val) falls into a range (between vmin & vmax): template<typename T> T ForceNumericRange( const T& val, const T& vmin, const T& vmax)...
35
by: Steven T. Hatton | last post by:
Perhaps I'm just a bit frustrated, and I will soon realize the clear truth of the matter, but right now I have some serious misgivings about the value of investing a lot of time and effort into...
45
by: charles.lobo | last post by:
Hi, I have recently begun using templates in C++ and have found it to be quite useful. However, hearing stories of code bloat and assorted problems I decided to write a couple of small programs...
9
by: vilarneto | last post by:
Hello everyone, Today I started to use template specializations in a project and suddenly faced a curious problem. Following is a complete example that shows the situation: ---------- ...
9
by: stephen.diverdi | last post by:
Can anyone lend a hand on getting this particular template specialization working? I've been trying to compile with g++ 4.1 and VS 2005. ...
1
by: WebCM | last post by:
I'm looking for a good idea or ready library for templates. HTML with PHP isn't the best solution (it's more difficult for end-users of CMS to edit them). Perhaps, everything I need is: -...
12
by: nooneinparticular314159 | last post by:
Hello. If I declare the following: template<int a, int b, int SomeArray> class DoSomething{ public: .. .. ..
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.