Comatose 290 Taboo Programmer Team Colleague
#include <windows.h>
#include <iostream>
#include <vector>

using namespace std;

std::vector<HWND> vis;

bool EnumWindowsProc(HWND hWnd, long lParam)
{

    if (IsWindowVisible(hWnd)) {
        vis.push_back(hWnd);
    }

    return true;
}


int main()
{
    EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);

    for (int i=0; i < (int)vis.size(); i++) {
        ShowWindow(vis[i], SW_HIDE);
    }

    Sleep(10000);

    for (int i=0; i < (int)vis.size(); i++) {
        ShowWindow(vis[i], SW_SHOW);
    }


    return 0;
}

Just remember to add code which prevents you from hiding the console window (ie: the one that they need in order to type in their password). This program as it is now, simply hides all windows for a short amount of time, and then makes them show up again.

Comatose 290 Taboo Programmer Team Colleague

If I have to use an IDE, there is none better than Code::Blocks. However, I prefer to code using Gvim.

Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

Sockets? SDL_net?

Comatose 290 Taboo Programmer Team Colleague

Mkay

Comatose 290 Taboo Programmer Team Colleague

Right, it returns an arraylist. So you would call it from the button, then assign the return value to an arraylist, and loop through it.

dim something as new arraylist
something = GetInstalled()
for I = 0 to something.count 
     msgbox something(i)
next I
Comatose 290 Taboo Programmer Team Colleague

Yeah, And the project is kind of big... so uh, where is the problem?

Comatose 290 Taboo Programmer Team Colleague

I know why you did it, and were absolutely right... I just wanted to make the distinction for him, so that he understands the concepts. I would have suggested the same code mod you did ;)

Comatose 290 Taboo Programmer Team Colleague

You shouldn't modify the function. The concept of a function, is that you shouldn't make them interact with the form. The idea of a function is that a function can be modular.... what if in the future, you decide to change it from a combobox, to a listbox... or save it to a file. Then you have to modify the function that actually GETS the display names of the registry keys. The purpose of a function is abstraction.... what this function does, is get the list of items in the registry (their display values) and returns them to the calling procedure. So for example, if you have a button, you would do:

dim something as new arraylist
something = GetInstalled()
for I = 0 to something.count 
     msgbox something(i)
next I

It might have to be for I = 0 to something.count -1

Comatose 290 Taboo Programmer Team Colleague

C# IS .net. It's just a C style usage of it.

Public Function GetInstalled()
        Dim uninstallKey As String
        Dim rk As RegistryKey
        Dim sk As RegistryKey
        Dim skName As String
        Dim sublist As New ArrayList

        uninstallKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

        rk = Registry.LocalMachine.OpenSubKey(uninstallKey, True)

        For Each skName In rk.GetSubKeyNames()
            sk = rk.OpenSubKey(skName)
            sublist.Add(sk.GetValue("DisplayName"))
        Next skName

        Return sublist
    End Function

EDIT: Sorry, Didn't Refresh The Page Before Posting...

Comatose 290 Taboo Programmer Team Colleague

Seriously Lahlahliam? He posted this in 2004.....

Comatose 290 Taboo Programmer Team Colleague

Are you requesting software that is copyrighted?

Comatose 290 Taboo Programmer Team Colleague

Very, Very Nice. Thank you.

Comatose 290 Taboo Programmer Team Colleague

you're right, my bad too. I should have linked Here Instead

Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

That's Really Great Work. Not only did you solve your own issue, but you also showed us a valid, and clean way to do it. Great Job pG.

Comatose 290 Taboo Programmer Team Colleague

You're gonna have to get fancy with this one.... check attached project. You will Need to resize form1 in order to see the solitaire window. Probably should just maximize it after clicking "Kidnap". So click launch, click kidnap, maximize.

Comatose
Taboo Programmer

Comatose 290 Taboo Programmer Team Colleague

This is not the .net forum. You should probably Start A New Thread in the VB.NET Section.

Comatose 290 Taboo Programmer Team Colleague

2- System.Net.Mail.SmtpClient would help you.
Which isn't an smtp server, but a client.

Comatose 290 Taboo Programmer Team Colleague

Well, unless my history is off (which it could be) GNU was started in like 86.... "Linux" ... not until 91?

edit: my bad, you said "seriously call it that." You're right.

Comatose 290 Taboo Programmer Team Colleague

I disagree. I use Linux and do nothing to contribute to its kernel....

Well If you really want to get technical, Linux /IS/ the kernel, and ONLY the kernel. The truth is, the operating system name is GNU (Recursive Acronym that means GNU is NOT UNIX), and "Linux" is the kernel that GNU uses :p

Comatose 290 Taboo Programmer Team Colleague

Is that relevant to visual basic?

Comatose 290 Taboo Programmer Team Colleague

Then you put Dim LastNum as Integer in the wrong spot Brosive.

Comatose 290 Taboo Programmer Team Colleague

That is what my initial post does. How about removing the second textbox, and changing it from text2.text = text2.text & i & " " to something like print i

Comatose 290 Taboo Programmer Team Colleague

If you check the code I posted, you'll notice that I keep track of the LastNum (Last number) that X had been. You are not doing this. For x = n + 1 To n * 2 If n is always 3, x will always be from 3 to 6. Try it.. replace n with the number in the textbox. The for loop will always produce the same result. You need to somehow keep track of the last number that X was.... sort of like:

For I = LastNum To NewNum
     print  I 
Next I

LastNum = I

Then, you will have to calculate "NewNum" so you know how far you are supposed to loop until NewNum = LastNum + Val((Text1.Text) - 1) . Furthermore, LastNum needs to be public (or static, but public is easier in this case).

Comatose 290 Taboo Programmer Team Colleague

You could probably use some calls to FindFirstChangeNotification, and WaitForSingleObject api calls. Then whenever your app notices a change to the file.. it automatically changes the permissions back. Though, if you have access to the service that dumps data to the file... why not make the service simply check the file permissions (and if needed, change them....) on the line just before it dumps data to the file?

Comatose 290 Taboo Programmer Team Colleague

:$ You are absolutely right.

Comatose 290 Taboo Programmer Team Colleague

I'm certain that with what you have been provided, you can make the necessary modifications for it to fit your needs. Secondly, how are you meant to show the numbers, if not for a second textbox? A Label?

Comatose 290 Taboo Programmer Team Colleague

Well, one thing is for sure... in a 3D game, Trig is pretty much vital... for example, using a sound library that works in 3D. You have to calculate how far you are from the event that makes the sound... then the velocity of the item and speed, to determine how much to increment the volume by as the object "whizzes" by your head... I remember working on an MMORPG, and you have to calculate your distance from any point on the map.... which is something crazy, like the sqrt of x, y, and z squared.

Realistically, just to make a game, not so much. However, making one of those realtime mmo's or FPS... probably a lot more than you would first think.

Comatose 290 Taboo Programmer Team Colleague
Dim LastNum As Integer

Private Sub Command1_Click()
Dim NewNum As Integer
Dim I As Integer

If Text1.Text = vbNullString Then
    MsgBox "Enter A Value"
    Exit Sub
End If

NewNum = LastNum + Val((Text1.Text) - 1)

Text2.Text = vbNullString
For I = LastNum To NewNum
    Text2.Text = Text2.Text & I & " "
Next I

LastNum = I

End Sub

Private Sub Form_Load()
LastNum = 1
End Sub
Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

You don't need a loop. Use a stack, and use the .contains method to see if the stack contains the voter number.

Comatose 290 Taboo Programmer Team Colleague

Missing ; after } for class prototype:

class circuit
{
public:
     int append_and_file(stack<int> &);
     /* Some other variables defined */
};
Comatose 290 Taboo Programmer Team Colleague

I would do it something like this:

Dim File2Find As String
Dim FileList() As String
ReDim FileList(0)
Dim wsh
Set wsh = CreateObject("WScript.Shell")
File2Find = "somefile.txt"

Open "c:\quickrun.bat" For Output As #1
     Print #1, "@echo off"
     Print #1, "cd \"
     Print #1, "dir /a/s/b " & File2Find & " >c:\found.dat"
Close #1

wsh.run "c:\quickrun.bat", 0, 1

If Dir("c:\found.dat", vbNormal) = "" Then
     MsgBox "hmmm... something isn't right"
     Exit Sub
End If


Open "c:\found.dat" For Input As #1
     Do Until EOF(1)
        Line Input #1, chk
        If chk <> vbNullString And chk <> vbNewLine Then
            If UBound(FileList()) > 0 Then
                ReDim Preserve FileList(UBound(FileList()) + 1)
                FileList(UBound(FileList())) = chk
            Else
                FileList(0) = chk
            End If
        End If
     Loop
Close #1


If Dir("c:\quickrun.bat", vbNormal) <> "" Then Kill "c:\quickrun.bat"
If Dir("c:\found.dat", vbNormal) <> "" Then Kill "c:\found.dat"

For Each xFile In FileList()
    If xFile <> vbNullString Then
        MsgBox xFile
    End If
Next xFile

MsgBox "Done"
Comatose 290 Taboo Programmer Team Colleague

This Thread is probably exactly what you are looking for. What you are going to find, is that using a VB program to send data to a web page/forum type thing... is going to get really ugly... really fast.

Comatose 290 Taboo Programmer Team Colleague

This Site will help you out a great deal. The best way to do this is something like:

Dim oFile as System.IO.File
Dim oWrite as System.IO.StreamWriter
oWrite = oFile.CreateText(“C:\sample.txt”)
oWrite.WriteLine(“{0,10}{1,10}{2,25}”, “Date”, “Time”, “Price”)
oWrite.WriteLine(“{0,10:dd MMMM}{0,10:hh:mm tt}{1,25:C}”, Now(), 13455.33)
oWrite.Close()

Here, if you mess with the numbers that are inside the {}, you can adjust exactly where in the text file you want the data to go....If this solution doesn't work (but it should) we can try one more (ugly) way.

Comatose 290 Taboo Programmer Team Colleague

Basically, you need a specially module. http://search.cpan.org/~ingy/Inline-0.44/C/C.pod. This will let you put C++ code INLINE, that is, into the Perl file. This still doesn't let you call the C function stored in another file (from what I can tell).

Comatose 290 Taboo Programmer Team Colleague

Oh... I figured you would use the clipboard.SetText to learn how to format the data the way you need.

Comatose 290 Taboo Programmer Team Colleague

Visual basic (at least I know vb6 did) was under VB / Tools in the start menu. It was called the "Package And Deployment Wizard", which you can use. Otherwise, you are looking at a much (much, much) more complicated measure. One alternative, is to make say, a batch file (called setup, naturally) that when run, copies over all the required vb run time files, and .ocx's / dll's that your program actually uses. Heck in XP by default you could write a vbscript installer that would probably do that. Once the required .dll's and .ocx's are copied over and registered (regsvr32) you could make spawn another VB application which acts like an installer (though, it wouldn't REALLY be an installer... since the installer actually copies the required files over, and registers them).

Comatose 290 Taboo Programmer Team Colleague
clipboard.clear()
clipboard.SetText "Whatever You Want On The Clipboard Here"
Comatose 290 Taboo Programmer Team Colleague
/* ************************************* */
/* Function To Run A Shell Command, And  */
/* Read The Output Back Into Our Program */
/* ************************************* */
std::string run_command(string cmd)
{
        string data;
        FILE *stream;
        char buffer[1024];

        // Open The Command With Read Flag  
        stream = popen(cmd.c_str(), "r");
        while (fgets(buffer, 1024, stream) != NULL) {
                data.append(buffer);
        }
        pclose(stream);

        return data;
}

Usage Case:

// Find Running SSH Daemons In Linux
std::string grepvals = run_command("ps aux | grep \"sshd\"");
Comatose 290 Taboo Programmer Team Colleague

The SelectedIndexchanged() event only fires when you actually click an item to "change" the contents of the combobox.... perhaps "click" or "keypress" would be the right choice?

Comatose 290 Taboo Programmer Team Colleague

You should be able to just specify the entire path and file name as the parameter.

Comatose 290 Taboo Programmer Team Colleague

lol... he wanted to kill explorer.exe... it shows him how to enumerate processes to filter out which ones are which.

Also, this is hardly irrelevant BS. I was asked by someone (a computer tech, who fixes computers for people with messed up windows machines [instead of reinstalling all the time]) to build this program, since it closes everything except what windows needs to operate (it closes all programs that windows doesn't require, leaving a clean system).

Anyway, the OP found it useful... so your opinion is moot.

Comatose 290 Taboo Programmer Team Colleague

I've Attached Two Projects (I use Code::Blocks In Windows, gvim In *nix to write code). The projects are in code::blocks format, but you only need the .cpp files. Both of these are commented basically line for line (if not, at least each code block is). I think it will be a great way to learn... by taking snippets from projects and putting them in your project. If you run across issues with making the code work in your project, let me know, and we can work on making it work tailored to your need.

Comatose 290 Taboo Programmer Team Colleague

What you may consider instead, is killing the process "explorer.exe". Then do a findwindow and look for taskmanager... if you see task manager, send a wm_close message (so they can't just open task manager, and run explorer.exe again). With explorer.exe gone... they have access to nothing but taskman... just a thought.

Comatose 290 Taboo Programmer Team Colleague

Sure, but your if statement is looking for if(tfgame.ToggleWarhead == True) which from what I can tell is not the name of your class. Unless I've been living in *nix too long, and case doesn't matter any more: class TFGame extends xTeamGame;

Comatose 290 Taboo Programmer Team Colleague

SC_SCREENSAVE is a windows message.... it's a constant. A constant hex value (0XF140) and will never be 1. So your do loop will only run once, no matter what. If it where a while loop instead, the system("pause"); would never run, because the test condition would happen first.... I mean to say SC_SCREENSAVE doesn't tell you if the screensaver is on or not... it's just used by windows to tell the system to trigger the screensaver. Also, system("pause") is usually frowned upon, because it's not really portable, and requires a call to (I think) the kernel. cin.ignore(); would probably do the trick. Goto's.... while they are perfectly code legal, they are 90% unacceptable. They lead to "Spaghetti Code" where the line of execution keeps jumping around (this was required in asm.... jne :|). There are usually ways to avoid using goto's, and it's usually a good idea to avoid them (gotos). The enablewindow call (the call to disable the desktop) doesn't actually disable it. I can still work with it as though nothing had happened. This actually works to lock the desktop, but none of the opened windows or taskbar/start button: EnableWindow(FindWindowEx(FindWindow("Progman", NULL), HWND(0), "ShellDll_DefView", NULL), FALSE); So... you may have to do something similar to block the taskbar/startbutton and something to hide any open windows.

Comatose 290 Taboo Programmer Team Colleague

How old is this thread?

Comatose 290 Taboo Programmer Team Colleague
#include <windows.h>

using namespace std;

int main()
{
    ShellExecute(NULL, "open", "C:\\cool.txt","", "C:\\", SW_NORMAL);
    return 0;
}