Monday, January 31, 2011

VB Get Windir & Sys32dir

Private Declare Function GetWinDir Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Public Function WINdir() As String
Dim str As String
str = String(20, Chr$(0))
GetWinDir str, 20
WINdir = ClrNol(str)
End Function

Public Function S32dir() As String
Dim str As String
str = String(20, Chr$(0))
GetWinDir str, 20
S32dir = ClrNol(str) & "\system32"
End Function

Public Function ClrNol(Ctx As String) As String
ClrNol = Left(Ctx, Len(Ctx) - InStr(Ctx, Chr$(0)) + 1)
End Function

VB Always On Top

Public Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long

on FormLoad:
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 2 Or 1 Or 16

'you get this from klampok_child@yahoo.co.id

C++ ASCII Biner

#include <kc32>
#include <iomanip>
void main()
{
 char ch,lh;
 int n=0;
 for (int i = 0; i <= 255;i++)
 { (i==8)||(i==9)||(i==10)||(i==13)?ch = ' ':ch = i;
   if (n==3)
   { lh = '\n';
     n = 0; }
    else
      { lh = '|';
        n++; };
   cout << "  " << setw(8) << setbase(2) << i << ' ' << setw(2) << hex
   << i << ' ' << setw(3) << dec << i << " [" << ch << "]  " << lh;
 }
 pause;
}