I'm going batty .... !

Wrote this snippet of code in C to block echoing in console window app. It works. Can't get the same thing to work in VB!!! No matter how many times I set the console mode it still echoes... Does anybody have an EXAMPLE of how to switch console input echoing on and off in Visual Basic? Much appreciated!

Ian

#include <windows.h>
#include <stdio.h>

int main(int argc, char **argv)
{
char passwd[128];
char usrinput[128];
HANDLE h;
int md;

/* set no echo */
h = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(h, &md);
SetConsoleMode(h, md & ~ENABLE_ECHO_INPUT);

printf("Password:"); fflush(stdout);
fgets(passwd, sizeof(passwd), stdin);

/* reset echo */
SetConsoleMode(h, md);
printf("\n"); fflush(stdout);

printf("got '%s'\n", passwd);
fgets(usrinput, sizeof(usrinput), stdin);
return 0;
}