Win32 |
1 Sep 2011
Updated: 1 Sep 2011
Rating: 0.00/5
Votes: 0
Popularity: 0.00
Licence: CPOL
Views: 7,170
Bookmarked: 0
Downloaded: 0
With SendInput:void SetNumLock (bool active){ BYTE keyState[256]; GetKeyboardState((LPBYTE)&keyState); bool active0= keyState[VK_NUMLOCK] & 1; if (active0!=active) { INPUT inp[2]; ZeroMemory(inp, sizeof(inp)); inp[0].type=INPUT_KEYBOARD; ...
|
C |
23 Aug 2011
Updated: 23 Aug 2011
Rating: 4.25/5
Votes: 3
Popularity: 2.03
Licence: CPOL
Views: 9,251
Bookmarked: 0
Downloaded: 0
I always use a home-made macro to zero my struct's and class's:#define ZEROMEMORY ZeroMemory (this, sizeof (*this))Sample1:struct S1 { double x; long i; char s[255+1]; S1 () { ZEROMEMORY; } };Sample2:class foo { private: double x[16]; char a,b,c; foo () {...
|
C# |
31 Mar 2011
Updated: 2 Apr 2011
Rating: 4.50/5
Votes: 2
Popularity: 1.35
Licence: CPOL
Views: 8,391
Bookmarked: 2
Downloaded: 0
Here goes my alternate.I am a C++ programmer. My goal is always to try to make code short and simple.bool bFailed=false;if (!bFailed) bFailed= condition1_fails;if (!bFailed) bFailed= condition2_fails;if (!bFailed) bFailed= condition3_fails;if (bFailed) DoFailedCleanup();else {...
|
C++ |
25 Aug 2011
Updated: 25 Aug 2011
Rating: 2.63/5
Votes: 4
Popularity: 1.58
Licence: CPOL
Views: 15,480
Bookmarked: 1
Downloaded: 0
Smaller code:void DrawRect(int x, int y, int width, int height, int curPosX=0, int curPosY=0){ setxy(x, y); cout << char(201); cout.width(width); cout.fill (char(205)); cout << char(187); setxy(x,height+y); cout << char(200); cout.width(width); cout.fill...
|
|
31 Mar 2011
Updated: 2 Apr 2011
Rating: 4.86/5
Votes: 7
Popularity: 4.10
Licence: CPOL
Views: 24,831
Bookmarked: 2
Downloaded: 0
Sometimes we spend a lot of time opening - closing folders trying to find .cpp / .cs / .h files in the Solution
|