473,804 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hello,

I want to add a date (ShortDateStrin g) 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_STRIN G])

TIA,

Michael
Nov 20 '05 #1
4 1381
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/
vxlrfVCWIZLibVC WizCtl.asp

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

The methods of the IVCWizCtrlUI.
http://msdn.microsoft.com/library/de...us/vcext/html/
vcoriVisualCWiz ardModel.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/vstchEnterprise TemplatesBuildi ngApplicationCo nstructionKit.a sp
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\VBWiza rds\ConsoleAppl ication\

We need to change two file.
1. the js file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWiza rds\ConsoleAppl ication\Scripts \1033\default.j s
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.AddSymbo l("CURRENT_DATE ", dateString);

2. The template file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWiza rds\ConsoleAppl ication\Templat es\1033\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.Add Symbol("CURRENT _DATE", dateString);).
(I already implemented it)

Kind regards,

Michael

""Peter Huang"" <v-******@online.m icrosoft.com> wrote in message
news:Qq******** ******@cpmsftng xa06.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/ vxlrfVCWIZLibVC WizCtl.asp

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

The methods of the IVCWizCtrlUI.
http://msdn.microsoft.com/library/de...us/vcext/html/ vcoriVisualCWiz ardModel.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/vstchEnterprise TemplatesBuildi ngApplicationCo nstructionKit.a sp
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\VBWiza rds\ConsoleAppl ication\

We need to change two file.
1. the js file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWiza rds\ConsoleAppl ication\Scripts \1033\default.j s
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.AddSymbo l("CURRENT_DATE ", dateString);

2. The template file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWiza rds\ConsoleAppl ication\Templat es\1033\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
3347
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 to turn a previously made String class that deals with char's into a templated String class that uses the template parameter C instead of char. I thought it would be fairly simple to do this exercise, but I encoutered many errors for my...
4
2343
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 .h and a .cpp file, gcc throws some strange linking errors. Compiling like this:
4
2737
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 the start that my knowledge of compiler implementation is very limited. Therefore, my suggestions may have to be rejected because they are difficult or impossible to implement. The proposal is based on the concept of "type similarity". Type...
4
3105
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) { T retVal = val; if ( retVal < vmin ) retVal = vmin;
35
1936
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 template programming. I just finished reading the first 12 chapters of _C++ Templates: The Complete Guide_. One thing that struck me as I read these chapters is how much I didn't know about C++. I _know_ the core language specification is...
45
2947
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 to check. What I expected was that there would be minor code bloat and some speed improvement when using templates. However... I wrote a basic list container (using templates), and a list container (using virtual derived classes). I also tried...
9
4688
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: ---------- class A { };
9
3474
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. //------------------------------------------------------------------ // my regular glass class A { }; // my templated class
1
1835
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: - variables - e.g. {var} - sections or conditions (some elements won't be printed out) - loops or selecting fragments* - cache (recommended for speed) The template system must be fast and efficient. Most probably I will create own library for CMS...
12
3375
by: nooneinparticular314159 | last post by:
Hello. If I declare the following: template<int a, int b, int SomeArray> class DoSomething{ public: .. .. ..
0
10564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.