Visual Studio 2010, Texteingabe "automatisieren"...
-
Hallo Forum,
ich möchte das Programm sysmets1 aus dem Buch "Windows Programmierung" von C. Petzold mehr oder weniger abtippen (ja, ich weiss, man kann es herunterladen, ich möchte es eben abtippen).
Dieses Programm benutzt die Funktion GetSystemMetrics(), um alle möglichen Systemparameter auszugeben. Siehe http://msdn.microsoft.com/en-us/library/ms724385(v=vs.85).aspx , dort gibt es eine Tabelle, ich habe den Inhalt der Tabelle kopiert und möchte das Ganze in einem Array stehen haben, ungefähr so:struct { int iIndex; TCHAR *szLabel; TCHAR *szDesc; } sysmetrics[] = { { SM_ARRANGE, TEXT("SM_ARRANGE"), TEXT("Bla bla") }, ... };
Wie würde man jetzt mit Visual Studio 2010 Express Edition den aus der MSDN kopierten Inhalt der Tabelle in die sysmetric[] Tabellenform bringen, möglichst einfach... Kann man die Schritte irgendwie "automatisieren"... mit gVim würde ich jetzt z.B. hingehen und den Text erstmal in die Form bringen
SM_BLABLA Bla bla
das würde vielleicht etwas Zeit kosten, aber dann würde ich die Schritte, die sich wiederholen, auf eine Taste "mappen" und für jede Zeile halbautomatisch
{ SM_BLABLA, TEXT("SM_BLABLA"), TEXT("Bla bla") },
generieren, das würde dann schnell gehen.
Frage jetzt einfach mal die Leute, die VS2010 benutzen, wie würdet ihr es in diesem Fall machen?
-
Was mir auf Anhieb einfallen würde:
#define METRIK(X,K) { X, TEXT(#X), TEXT(#K) } metrics sysmetric[] = { METRIK(SM_ARRANGE, Bla Bla), ... }
-
Ich habe es jetzt in der Zwischenzeit mit gVim so gemacht:
struct { int iIndex; TCHAR *szLabel; TCHAR *szDesc; } sysmetrics[] = { { SM_ARRANGE, TEXT("SM_ARRANGE"), TEXT("The flags that specify how the system arranged minimized windows") }, { SM_CLEANBOOT, TEXT("SM_CLEANBOOT"), TEXT("The value that specifies how the system is started: ") }, { SM_CMONITORS, TEXT("SM_CMONITORS"), TEXT("The number of display monitors on a desktop") }, { SM_CMOUSEBUTTONS, TEXT("SM_CMOUSEBUTTONS"), TEXT("The number of buttons on a mouse, or zero if no mouse is installed") }, { SM_CXBORDER, TEXT("SM_CXBORDER"), TEXT("The width of a window border") }, { SM_CXCURSOR, TEXT("SM_CXCURSOR"), TEXT("The width of a cursor") }, { SM_CXDLGFRAME, TEXT("SM_CXDLGFRAME"), TEXT("This value is the same as SM_CXFIXEDFRAME") }, { SM_CXDOUBLECLK, TEXT("SM_CXDOUBLECLK"), TEXT("The width of the rectangle around the location of a first click in a double-click sequence") }, { SM_CXDRAG, TEXT("SM_CXDRAG"), TEXT("The number of pixels on either side of a mouse-down point before a drag operation begins") }, { SM_CXEDGE, TEXT("SM_CXEDGE"), TEXT("The width of a 3-D border") }, { SM_CXFIXEDFRAME, TEXT("SM_CXFIXEDFRAME"), TEXT("The thickness of the frame around the perimeter of a window that has a caption but is not sizable") }, { SM_CXFOCUSBORDER, TEXT("SM_CXFOCUSBORDER"), TEXT("The width of the left and right edges of the focus rectangle that the DrawFocusRect draws") }, { SM_CXFRAME, TEXT("SM_CXFRAME"), TEXT("This value is the same as SM_CXSIZEFRAME") }, { SM_CXFULLSCREEN, TEXT("SM_CXFULLSCREEN"), TEXT("The width of the client area for a full-screen window on the primary display monitor") }, { SM_CXHSCROLL, TEXT("SM_CXHSCROLL"), TEXT("The width of the arrow bitmap on a horizontal scroll bar") }, { SM_CXHTHUMB, TEXT("SM_CXHTHUMB"), TEXT("The width of the thumb box in a horizontal scroll bar") }, { SM_CXICON, TEXT("SM_CXICON"), TEXT("The default width of an icon") }, { SM_CXICONSPACING, TEXT("SM_CXICONSPACING"), TEXT("The width of a grid cell for items in large icon view") }, { SM_CXMAXIMIZED, TEXT("SM_CXMAXIMIZED"), TEXT("The default width") }, { SM_CXMAXTRACK, TEXT("SM_CXMAXTRACK"), TEXT("The default maximum width of a window that has a caption and sizing borders") }, { SM_CXMENUCHECK, TEXT("SM_CXMENUCHECK"), TEXT("The width of the default menu check-mark bitmap") }, { SM_CXMENUSIZE, TEXT("SM_CXMENUSIZE"), TEXT("The width of menu bar buttons in pixels") }, { SM_CXMIN, TEXT("SM_CXMIN"), TEXT("The minimum width of a window") }, { SM_CXMINIMIZED, TEXT("SM_CXMINIMIZED"), TEXT("The width of a minimized window") }, { SM_CXMINSPACING, TEXT("SM_CXMINSPACING"), TEXT("The width of a grid cell for a minimized window") }, { SM_CXMINTRACK, TEXT("SM_CXMINTRACK"), TEXT("The minimum tracking width of a window") }, { SM_CXPADDEDBORDER, TEXT("SM_CXPADDEDBORDER"), TEXT("The amount of border padding for captioned windows") }, { SM_CXSCREEN, TEXT("SM_CXSCREEN"), TEXT("The width of the screen of the primary display monitor") }, { SM_CXSIZE, TEXT("SM_CXSIZE"), TEXT("The width of a button in a window caption or title bar") }, { SM_CXSIZEFRAME, TEXT("SM_CXSIZEFRAME"), TEXT("The thickness of the sizing border around the perimeter of a window that can be resized") }, { SM_CXSMICON, TEXT("SM_CXSMICON"), TEXT("The recommended width of a small icon") }, { SM_CXSMSIZE, TEXT("SM_CXSMSIZE"), TEXT("The width of small caption buttons") }, { SM_CXVIRTUALSCREEN, TEXT("SM_CXVIRTUALSCREEN"), TEXT("The width of the virtual screen") }, { SM_CXVSCROLL, TEXT("SM_CXVSCROLL"), TEXT("The width of a vertical scroll bar") }, { SM_CYBORDER, TEXT("SM_CYBORDER"), TEXT("The height of a window border") }, { SM_CYCAPTION, TEXT("SM_CYCAPTION"), TEXT("The height of a caption area") }, { SM_CYCURSOR, TEXT("SM_CYCURSOR"), TEXT("The height of a cursor") }, { SM_CYDLGFRAME, TEXT("SM_CYDLGFRAME"), TEXT("This value is the same as SM_CYFIXEDFRAME") }, { SM_CYDOUBLECLK, TEXT("SM_CYDOUBLECLK"), TEXT("The height of the rectangle around the location of a first click in a double-click sequence") }, { SM_CYDRAG, TEXT("SM_CYDRAG"), TEXT("The number of pixels above and below a mouse-down point before a drag operation begins") }, { SM_CYEDGE, TEXT("SM_CYEDGE"), TEXT("The height of a 3-D border") }, { SM_CYFIXEDFRAME, TEXT("SM_CYFIXEDFRAME"), TEXT("The thickness of the frame around the perimeter of a window that has a caption but is not sizable") }, { SM_CYFOCUSBORDER, TEXT("SM_CYFOCUSBORDER"), TEXT("The height of the top and bottom edges of the focus rectangle drawn by DrawFocusRect") }, { SM_CYFRAME, TEXT("SM_CYFRAME"), TEXT("This value is the same as SM_CYSIZEFRAME") }, { SM_CYFULLSCREEN, TEXT("SM_CYFULLSCREEN"), TEXT("The height of the client area for a full-screen window on the primary display monitor") }, { SM_CYHSCROLL, TEXT("SM_CYHSCROLL"), TEXT("The height of a horizontal scroll bar") }, { SM_CYICON, TEXT("SM_CYICON"), TEXT("The default height of an icon") }, { SM_CYICONSPACING, TEXT("SM_CYICONSPACING"), TEXT("The height of a grid cell for items in large icon view") }, { SM_CYKANJIWINDOW, TEXT("SM_CYKANJIWINDOW"), TEXT("For double byte character set versions of the system in pixels") }, { SM_CYMAXIMIZED, TEXT("SM_CYMAXIMIZED"), TEXT("The default height") }, { SM_CYMAXTRACK, TEXT("SM_CYMAXTRACK"), TEXT("The default maximum height of a window that has a caption and sizing borders") }, { SM_CYMENU, TEXT("SM_CYMENU"), TEXT("The height of a single-line menu bar") }, { SM_CYMENUCHECK, TEXT("SM_CYMENUCHECK"), TEXT("The height of the default menu check-mark bitmap") }, { SM_CYMENUSIZE, TEXT("SM_CYMENUSIZE"), TEXT("The height of menu bar buttons in pixels") }, { SM_CYMIN, TEXT("SM_CYMIN"), TEXT("The minimum height of a window") }, { SM_CYMINIMIZED, TEXT("SM_CYMINIMIZED"), TEXT("The height of a minimized window") }, { SM_CYMINSPACING, TEXT("SM_CYMINSPACING"), TEXT("The height of a grid cell for a minimized window") }, { SM_CYMINTRACK, TEXT("SM_CYMINTRACK"), TEXT("The minimum tracking height of a window") }, { SM_CYSCREEN, TEXT("SM_CYSCREEN"), TEXT("The height of the screen of the primary display monitor") }, { SM_CYSIZE, TEXT("SM_CYSIZE"), TEXT("The height of a button in a window caption or title bar") }, { SM_CYSIZEFRAME, TEXT("SM_CYSIZEFRAME"), TEXT("The thickness of the sizing border around the perimeter of a window that can be resized") }, { SM_CYSMCAPTION, TEXT("SM_CYSMCAPTION"), TEXT("The height of a small caption") }, { SM_CYSMICON, TEXT("SM_CYSMICON"), TEXT("The recommended height of a small icon") }, { SM_CYSMSIZE, TEXT("SM_CYSMSIZE"), TEXT("The height of small caption buttons") }, { SM_CYVIRTUALSCREEN, TEXT("SM_CYVIRTUALSCREEN"), TEXT("The height of the virtual screen") }, { SM_CYVSCROLL, TEXT("SM_CYVSCROLL"), TEXT("The height of the arrow bitmap on a vertical scroll bar") }, { SM_CYVTHUMB, TEXT("SM_CYVTHUMB"), TEXT("The height of the thumb box in a vertical scroll bar") }, { SM_DBCSENABLED, TEXT("SM_DBCSENABLED"), TEXT("Nonzero if User32.dll supports DBCS") }, { SM_DEBUG, TEXT("SM_DEBUG"), TEXT("Nonzero if the debug version of User.exe is installed") }, { SM_DIGITIZER, TEXT("SM_DIGITIZER"), TEXT("Nonzero if the current operating system is Windows 7") }, { SM_IMMENABLED, TEXT("SM_IMMENABLED"), TEXT("Nonzero if Input Method Manager/Input Method Editor features are enabled") }, { SM_MAXIMUMTOUCHES, TEXT("SM_MAXIMUMTOUCHES"), TEXT("Nonzero if there are digitizers in the system") }, { SM_MEDIACENTER, TEXT("SM_MEDIACENTER"), TEXT("Nonzero if the current operating system is the Windows XP, Media Center Edition") }, { SM_MENUDROPALIGNMENT, TEXT("SM_MENUDROPALIGNMENT"), TEXT("Nonzero if drop-down menus are right-aligned with the corresponding menu-bar item") }, { SM_MIDEASTENABLED, TEXT("SM_MIDEASTENABLED"), TEXT("Nonzero if the system is enabled for Hebrew and Arabic languages, 0 if not") }, { SM_MOUSEPRESENT, TEXT("SM_MOUSEPRESENT"), TEXT("Nonzero if a mouse is installed") }, { SM_MOUSEHORIZONTALWHEELPRESENT, TEXT("SM_MOUSEHORIZONTALWHEELPRESENT"), TEXT("Nonzero if a mouse with a horizontal scroll wheel is installed") }, { SM_MOUSEWHEELPRESENT, TEXT("SM_MOUSEWHEELPRESENT"), TEXT("Nonzero if a mouse with a vertical scroll wheel is installed") }, { SM_NETWORK, TEXT("SM_NETWORK"), TEXT("The least significant bit is set if a network is present") }, { SM_PENWINDOWS, TEXT("SM_PENWINDOWS"), TEXT("Nonzero if the Microsoft Windows for Pen computing extensions are installed") }, { SM_REMOTECONTROL, TEXT("SM_REMOTECONTROL"), TEXT("Terminal Server session is being remotely controlled") }, { SM_REMOTESESSION, TEXT("SM_REMOTESESSION"), TEXT("Terminal Services environment") }, { SM_SAMEDISPLAYFORMAT, TEXT("SM_SAMEDISPLAYFORMAT"), TEXT("Nonzero if all the display monitors have the same color format") }, { SM_SECURE, TEXT("SM_SECURE"), TEXT("This system metric should be ignored; it always returns 0") }, { SM_SERVERR2, TEXT("SM_SERVERR2"), TEXT("The build number if the system is Windows Server 2003 R2") }, { SM_SHOWSOUNDS, TEXT("SM_SHOWSOUNDS"), TEXT("Nonzero if the user requires an application to present information visually") }, { SM_SHUTTINGDOWN, TEXT("SM_SHUTTINGDOWN"), TEXT("Nonzero if the current session is shutting down") }, { SM_SLOWMACHINE, TEXT("SM_SLOWMACHINE"), TEXT("Nonzero if the computer has a low-end (slow) processor") }, { SM_STARTER, TEXT("SM_STARTER"), TEXT("Nonzero if the current operating system is Starter Edition") }, { SM_SWAPBUTTON, TEXT("SM_SWAPBUTTON"), TEXT("Nonzero if the meanings of the left and right mouse buttons are swapped") }, { SM_TABLETPC, TEXT("SM_TABLETPC"), TEXT("Nonzero if the current operating system is the Windows XP Tablet PC edition") }, { SM_XVIRTUALSCREEN, TEXT("SM_XVIRTUALSCREEN"), TEXT("The coordinates for the left side of the virtual screen") }, { SM_YVIRTUALSCREEN, TEXT("SM_YVIRTUALSCREEN"), TEXT("The coordinates for the top of the virtual screen") } };
Die szDesc Strings muss man noch feintunen, aber das ist momentan nicht wichtig...
-
Hallo,
ich bin immer noch daran interessiert, ob es in Visual Studio ähnliche Möglichkeiten gibt, sich wiederholende Operationen am Text zu automatisieren
Ansonsten, wenn nicht, dann nicht...
-
Ich weiß nicht, ob VS da was bietet. Ich hab grundsätzlich ne Ruby-Shell offen, in der ich u. a. solche Sachen erledige
-
abc.w schrieb:
Hallo,
ich bin immer noch daran interessiert, ob es in Visual Studio ähnliche Möglichkeiten gibt, sich wiederholende Operationen am Text zu automatisieren
Ansonsten, wenn nicht, dann nicht...Schon mal Makros probiert? Da kann man ja im Prinzip jeden VB.NET-Code reinhacken, den man braucht.
-
Makros... hier http://msdn.microsoft.com/de-de/library/7kyhdt1z.aspx ist eine Beschreibung, wie man es mit Makros machen könnte, geht leider nicht bei mir.
STRG+UMSCHALT+R - passiert nichts
Menü Extras - kein Untermenü Makros da... was mache ich falsch, was mache ich nun
-
Drück Alt+F11 um die Makro-IDE aufzurufen. Aber es kann natürlich sein, dass diese Funktionalität beim VS 10 Express Edition nicht dabei ist.
-
Alt + F11... tut sich nichts, scheint also nicht dabei sein. Schade... aber was soll's, für solche Sachen habe ich ja gVim...
-
Ich glaube in der Express Edition fehlt die Makro-Unterstützung einfach
-
Warum nicht einfach ein Snippet? Ich hab da auch ein paar selbst gebaut.
-
Kann man Snippets eigentlich auch irgendwie direkt aus VisualStudio heraus erzeugen? Quasi Quellcode markieren -> "Anlegen als Snippet" oder irgendwie sowas?
-
Hallo geeky,
so weit ich das weiß, geht das mit dem Standard "Snippet-Manager" leider nicht.
Jedoch gibt es einige Extensions (welche ich mir aber selber noch nicht installiert habe):
Snippet Designer
Snipper
-
Kann jemand vielleicht so nett sein und ein Snippet zeigen, mit dem man z.B. aus diesen Zeilen, "Roh-Text" sozusagen:
SM_ARRANGE The flags that specify how the system arranged minimized windows SM_CLEANBOOT The value that specifies how the system is started: SM_CMONITORS The number of display monitors on a desktop SM_CMOUSEBUTTONS The number of buttons on a mouse, or zero if no mouse is installed SM_CXBORDER The width of a window border SM_CXCURSOR The width of a cursor SM_CXDLGFRAME This value is the same as SM_CXFIXEDFRAME
diese Zeilen automatisch generieren könnte:
{ SM_ARRANGE, TEXT("SM_ARRANGE"), TEXT("The flags that specify how the system arranged minimized windows") }, { SM_CLEANBOOT, TEXT("SM_CLEANBOOT"), TEXT("The value that specifies how the system is started: ") }, { SM_CMONITORS, TEXT("SM_CMONITORS"), TEXT("The number of display monitors on a desktop") }, { SM_CMOUSEBUTTONS, TEXT("SM_CMOUSEBUTTONS"), TEXT("The number of buttons on a mouse, or zero if no mouse is installed") }, { SM_CXBORDER, TEXT("SM_CXBORDER"), TEXT("The width of a window border") }, { SM_CXCURSOR, TEXT("SM_CXCURSOR"), TEXT("The width of a cursor") }, { SM_CXDLGFRAME, TEXT("SM_CXDLGFRAME"), TEXT("This value is the same as SM_CXFIXEDFRAME") },
Ich kann zeigen, wie man es mit gVim machen könnte... sagt nur Bescheid...
-
Mit einem simplen Regex Search&Replace ?
-
BierzeltOmi schrieb:
Mit einem simplen Regex Search&Replace ?
Regex = "Regular expression"
Zeig mal her!
-
Was gibs da zu zeigen, du musst ja nur die erste Zeile matchen und dann die zweite, da braucht man nichmal regexmagie für.
-
Zeig mal her!
Suchen nach:
{^[A-Z_]+$}\n{^.+$}
Ersetzen durch:
{ \1, TEXT("\1"), TEXT("\2") },
Funktioniert zumindest bei mir...
-
SoVielleicht schrieb:
Suchen nach:
{^[A-Z_]+$}\n{^.+$}
Ersetzen durch:
{ \1, TEXT("\1"), TEXT("\2") },
Endlich eine vernünftige Antwort, funktioniert bei mir auch!Endlich die (Er)Lösung