Writing own Code-Templates is pretty easy.
I have several Templates (for example: Dialog Procedure using Selection as Function-Name) etc.
DialogProc using selection:
BOOL CALLBACK %0 (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
-?
return (TRUE);
case WM_DESTROY:
case WM_CLOSE:
EndDialog(hDlg,0);
return (TRUE);
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDCANCEL:
EndDialog(hDlg,0);
return (TRUE);
case IDOK:
return (TRUE);
default:
break;
}
return (FALSE);
}
return (FALSE);
}
I'm lazy, you know...
switch using selection:
switch(%0)
{
case -?:
break;
default:
break;
}
Here's my "Semi-intelligent for-statement".
Did this to explore the possibilities with VAX's parser in AutoText-Templates.
Semi-intelligent for-statement:
for (%1 %2 = %3; %2 < %4; %2%5)
{
-?
}
Opens up a Dialog, asking for:
%1 : Type (e.g. int, UINT, you may leave it blank if you're using an already declared variable)
%2 : Variable (e.g. iIndex)
%3 : initial value of %2 (0 or whatever value you want to start with)
%4 : Maximum value to count to
%5 : Operation to be done (e.g. ++, -- or +=10, whatever)
You can let VAX do almost EVERYTHING for you by simply using Code-Templates.
The -? determins the caret-position after inserting the code...
%0 is the placeholder for your selection
%1 - %x will be asked by a Dialog-Window.
BTW, WTS: It would be cool if we could add Names for these Dialog-Windows.
Right now, when there's a %1, the Dialog-Window also asks for %1.
I'd like to do this:
for ( %1{Type of Variable} %2{Name of Variable} = %3{Initial Value of %2};...
You get the idea...
Is that possible? Enhancing the "Ask the User for %1-%x Values using given names from Template"...