473,856 Members | 1,536 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 1386
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
3350
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
2345
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
2739
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
3110
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
1940
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
2968
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
4690
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
3478
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
1838
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
3380
by: nooneinparticular314159 | last post by:
Hello. If I declare the following: template<int a, int b, int SomeArray> class DoSomething{ public: .. .. ..
0
9766
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10700
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...
1
10797
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10391
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...
0
9536
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7098
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
5763
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...
2
4177
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3203
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.