Comatose 290 Taboo Programmer Team Colleague

is SWBF2SERVERMANAGER the window class, or the caption/title of the window? Also, are you sure that the ID of the control will always be 1000? I tested the same code, but removed the double exit points and the check for 1000... I made a quick VB program with a button on it, with a caption of: SWBF2SERVERMANAGER, (and changed the FindWindow, so that it searched by caption and not class) and voila.... worked like a charm for me.

Comatose 290 Taboo Programmer Team Colleague

I'm not sure how you would go about locking the desktop window... I suppose you could try to use the "SetParent" API call, and essentially kidnap the desktop window... but I think putting it back may be a whole can of worms.

Comatose 290 Taboo Programmer Team Colleague

The Password issue is a whole lot uglier. Since I believe it was win2k or so, the password to get into the system from the screensaver is the account password. So, if you logged into XP as ClutchKiller, then the password for the screen saver is the same one that you used to log in to XP. So, what you are essentially looking for, is how do you change the account password.... and then put it back to what it was before..

Your Welcome :)

Comatose 290 Taboo Programmer Team Colleague

sure, windows.h includes everything that we need. The standard C++ stuff, is just the includes, using namespaces (the namespaces and the #include <iostream> isn't even needed...it just came with the Code::Blocks IDE Blank Project, so I just left it) . So, Basically, the include directive tells the pre-compiler that we want to copy the contents of <windows.h> into our file at the top. The next step is the main function, known as the exe's entry point (the first piece of code that will run when the OS launches it) The only real line of code in the program is the SendMessage call, which is found in the windows.h file... SendMessage is a function used to basically make another window/program behave as you would want it to (ie: you can send messages to have a window minimize, maximize, close... whatever) .

SendMessage wants to know what window to send the message to. We used another function (defined in windows.h) called GetDesktopWindow, which will give us the "handle" or "hwnd" of the Desktop Window. An Hwnd is a unique hex value assigned to a window so that it can be identified by the OS. Every window has one. So, we get the hwnd for the desktop (with GetDesktopWindow) and use that hwnd, so that SendMessage knows which window we are sending a message to. The WM_SYSCOMMAND, let's the window know that we are about to send it a system command of some kind. The SC_SCREENSAVE (both WM_SYSCOMMAND and SC_SCREENSAVE are also …

clutchkiller commented: Helpful +1
Comatose 290 Taboo Programmer Team Colleague

Under the Code Snippets, what is the difference between the vb section and the visualbasic section? Also, what is the difference between vbnet and visualbasicnet sections?

Comatose 290 Taboo Programmer Team Colleague

Set AutoCompleteSource to ListItems, then set AutoCompleteMode to whichever one you like. I prefer Suggest, but you can check them all to see which one is ideal for you.

Comatose 290 Taboo Programmer Team Colleague

Right... So a select statement isn't meant for updating/editing... it's only meant for retrieval. You need the update sql query.

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

using namespace std;

int main()
{
    SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0);
    return 0;
}
Comatose 290 Taboo Programmer Team Colleague

The tools should be on the right hand side... there should be a small little box that says "tools" and when you hold your mouse over it... it should come out. I hate the design too, but there is a button to make it "sticky" so that it stays open.

Comatose 290 Taboo Programmer Team Colleague

The only way to really format data in notepad, is to use tabs. Say, name <tab><tab>Position<tab><tab>Counseled by date which is easy enough with:

lineoftext = txtname.text & vbtab & vbtab & txtpos.text & vbtab & vbtab & txtcname.text & vbtab & vbtab & DateTimePickerdoc.Value.ToShortDateString
Comatose 290 Taboo Programmer Team Colleague

*Points Above*
Also NOT a game engine, but a rendering engine.

Comatose 290 Taboo Programmer Team Colleague

The best way to get started on this, is to make the dialog box as a form of your own... so in your project add a new form, and design it to look like that (with the controls and drop-downs where they go, and the picture box). Then start working on the code for it. The OpenFileDialog control won't support what you want to do, neither will the API Call. Let me know if you find a solution that I've overlooked.

Comatose 290 Taboo Programmer Team Colleague

Oops, I just realized that my code is wrong in the if statement. It should be:

if usedIDs.Contains(textbox1.text) then
     ' /* ID Has Been Used! */
     messagebox.show("This Voter ID Is Already Used.... Get Your Own!")
else
     usedIDs.Push(textbox1.text)
end if

Sorry for that.

Comatose 290 Taboo Programmer Team Colleague

just for kicks and laughs, let's try to replace the (or just below the line of) 'msgbox line with Application.Doevents(). I've noticed that sometimes when a msgbox makes code work that doesn't seem to work without it, a Doevents is the right medicine. Let me know if it works or not.

Comatose 290 Taboo Programmer Team Colleague

Why export it to notepad, and then copy/paste into excel, when you could have the VB program automatically add it to excel?
--------------------------------------------------
replace lineoftext = join with this:

lineoftext = txtname.text & "," & txtpos.text & "," & txtcname.text & "," & DateTimePickerdoc.Value.ToShortDateString
Comatose 290 Taboo Programmer Team Colleague

Not sure what pygame is, but free 3d game engine for C++:
Ogre3d!

EDIT: Sorry... Ogre3d isn't a game engine... it's a rendering engine.
Crystalspace
StemCell Engine

Comatose 290 Taboo Programmer Team Colleague

I'm a little confused.... you are trying to save data? If so, you wouldn't open a connection to the database with a Select... Select is used to retrieve rows and columns from the database table.... I think you want something like with like UPDATE table SET field = 'whatever' WHERE column = 'something'

Comatose 290 Taboo Programmer Team Colleague

Hmmm, I think the mscomm control handles both serial and parallel communications... but seeing that this is a network printer, and you are mapping it, it complicates things some. If the second code that you posted works (ie: using Open "c:\test1.txt" for Binary as #1) then why not simply save the code that you write to the file into like, a byte array (instead of the hard-drive), and then open LPT1 like you do, and just write the array in a loop or such to the printer. When you are done sending the data, just redim the byte array, and redim it again for a new ZPL.

Comatose 290 Taboo Programmer Team Colleague

You'll want to put the code to change the label (labelname.backcolor = vbred) color in mousedown or keydown, and then change it back to whatever it was previously on mouseup or keyup. You may need to use a variable of some kind (public to the form) to hold the default (or last used) color of the label (before you changed it on keydown)

Comatose 290 Taboo Programmer Team Colleague

Post the code that you have already (for the open and write sections)

Comatose 290 Taboo Programmer Team Colleague

Don't remove the code.... remove the ' before the code...
Do you have a sample database that you are working with this...
if you can attach the database (or a sample) with the .zip'd vb project,
I can try to see more clearly what you need.

Comatose 290 Taboo Programmer Team Colleague

it seems to me like the combo boxes in the update button are commented out:

'Combo1.Text = rs.Fields(0)
'cmbEqu.Text = mobjADORst1.Fields(cmbEqu.ListIndex)
'cmbLoc.List (cmbEqu.ListIndex)

Since comments don't actually do anything as far as the program goes, then naturally they wouldn't get populated..... try removing the ' from the beginning of those three lines in the cmdUpdate_Click()

Comatose 290 Taboo Programmer Team Colleague

What's the code look like?

Comatose 290 Taboo Programmer Team Colleague

Thank you for the reply. :)

Comatose 290 Taboo Programmer Team Colleague
' /* Declare A New Stack Object */
Dim usedIDs As New Stack

' /* Assume User Enters VoterID In Textbox1 */
if usedIDs.Contains(textbox1.text) then 
     ' /* Voter Number Has Not Been Used Yet  So... */
     ' /* Add Item To Stack */
     usedIDs.Push(textbox1.text)
     ' /* Keep Doing Stuff For Valid Voter ID */
else
     messagebox.show("This Voter ID Is Already Used... Get Your Own!")
end if
Comatose 290 Taboo Programmer Team Colleague

sudo apt-get install g++

and you probably want to compile it with g++ not gcc

Comatose 290 Taboo Programmer Team Colleague

It already works using the number pad (ie: alt + 251 or whatever), but to do it how you want, you must subclass the form (which is kind of ugly), can't you just on keyup or keydown do something like this:

richtext1.text = richtext1.text & chrw(keycode)

or am I missing what you need?

Comatose 290 Taboo Programmer Team Colleague

What happened to the ability to post a new tutorial in the tutorials section?

Comatose 290 Taboo Programmer Team Colleague

App.path and App.exename need to stay there.

Comatose 290 Taboo Programmer Team Colleague

What do you mean search a file? Are you trying to make a program that the user can type in a search text, and it will find the file name? or will it find that phrase/word /INSIDE/ the file?

Comatose 290 Taboo Programmer Team Colleague

For Top Level:

MsgBox(ListView1.SelectedItems(0).Text)

And Subitems:

MsgBox(ListView1.SelectedItems(0).SubItems(1).Text)

You may want to make sure you have subitems before trying that one ;)

Comatose 290 Taboo Programmer Team Colleague

Well.... I don't see when the destructor would be called.... that is, does a second new mean a call to the first destructor? I don't think so... because destruction happens when the object is set to nothing, or it goes out of scope... and neither one is happening. You are simply assigning the object variable to a new instance of an object... and the first object is not set to nothing, nor is it going out of scope... If the idea though, that when the object no longer has the variable pointing to it that it gets destructed can be tested...so I did a for loop from 0 to 1000, and basically just put in it strBldr = New StringBuilder("a", 2).. If the destructor gets called when strBldr no longer points to it, then the application shouldn't consume more memory (maybe temporarily while it's swapping stuff around, but not permanently). Then I opened up Windows Task Manager, and sorted the list by memory usage. Then I clicked the button with the for loop in it, a few times... and sure enough, the memory usage of the EXE kept growing more and more each time I did it. (I made the initial strBldr variable public, in the class scope... so it was declared at the top :) ) So to answer your question.... probably.

Comatose 290 Taboo Programmer Team Colleague

I'm still a little confused here on what you need... could you give me a little more info..

Comatose 290 Taboo Programmer Team Colleague

Well, one thing to consider instead of remotely logging in, is remotely shutting down / rebooting the machine. Which in XP can be done with the shutdown program (command line).

shutdown -r -f -m \\MachineName

However, you'll need to be logged in as someone that has such rights in your Active Directory (I think though, that logging in as Administrator on the local account allows this too, which seems like a bit of a security flaw, but hey).

I'm not 100% sure what you plan to do once you are "logged in" remotely, but I have written a script that writes a file to a remote machine (a javascript file) and then runs it (used to eject the tray of a remote machine). The code looks a little something like this (modified to avoid the confusion of nesting javascript inside vbscript):

set objWMIService = GetObject("winmgmts:\\" & "computername" & "\root\cimv2:win32_process")
errreturn = objWMIService.Create("cmd /c echo msgbox " & chr(34) & "Sup Buddy!" & chr(34) & " >c:\fun.vbs", Null, Null, intProcessID)
errreturn = objWMIService.Create("cmd /c c:\fun.vbs", Null, Null, intProcessID)

Basically, it uses WMI to connect to (in this case) computername, at the win32_process section. It then spawns a cmd process with /c (/c means execute and return when done), which echo's vbscript code (a msgbox) and uses command line redirection ( > or >>) to put the vbscript code into a .vbs file (c:\fun.vbs). Then, it does the same thing, but instead of using echo to make the file, …

Comatose 290 Taboo Programmer Team Colleague

I'm not sure how doing it in another language is going help... if you planning on pruning the entries, the list will be the same in Python or in Bash (or anything else for that matter).

I suppose you could do something nifty, like create an array of forward items, an array of drop items etc, and then loop through it, so that it is more code-like and less sequential.... but either way, running iptables -L will still yield the same result...

Comatose 290 Taboo Programmer Team Colleague

As far as needing to change the wsh.regwrite line, no. It is fine the way it is... basically, app.exename is sort of like a variable that contains the name of the program... so, if someone changed the exe name from reprieve.exe to fun.exe, then app.exename would become fun. Then, app.path literally denotes where on the directory structure the file is... so if the path was: c:\windows\reprieve.exe, then when you run it, app.path would become c:\windows.

As far as sending signals to a USB Port....This is a pretty good start. Some devices hooked to a USB port have a pseudo-serial interface, so it should work with those.... as far as like, sending raw data.... the link is your best bet.

Good Luck.
Comatose.

Comatose 290 Taboo Programmer Team Colleague

Certainly.... If you know the ascii value that corresponds to the diacritical mark. For example, I can change e to é or ë by doing something like:

letter = chrw(233)
'or
letter = chrw(235)

However, there is no built in functionality to take a character and simply combine a diacritical mark resulting in the new character.
What I would do, is build a real simple program that has two textboxes on it. Then, I would put a button on it with some code like:

text2.text = ascw(text1.text)

Then in windows, go to start, run, type in charmap. Then find the modified version of each letter that you want to add, put it in the textbox, and click the button... it will give you the ascw value of the diacritical mark/letter mix. (like é = 233 or ë = 235). Then you store these in an array or collection or something. Then, when they highlight "e" and click say Umlaut or Grave, you basically do a simple if. so like, if highlighted_letter = "e" and Umlaut was clicked, then change e to chrw(235).
I think where most of the work is going to come in, is that there is no (from what I can see) stand-alone accent marks. For example, I can't just make the Umlaut mark right now by itself... I can make the O or E combined with Umlaut, but not just two dots side by side. On the button caption, you could probably get …

Comatose 290 Taboo Programmer Team Colleague

Nice.

Comatose 290 Taboo Programmer Team Colleague

Compile it... put the EXE in the folder that you want to run it from, and then run it.

Comatose 290 Taboo Programmer Team Colleague

Hmmm...

dim objWord
dim myDoc
Set objWord = New Word.Application
Set myDoc = objWord.Documents.Add("filename")
msgbox myDoc.BuiltInDocumentProperties("NUMBER OF LINES").Value

If The Above Doesn't Work, It Might Be:

msgbox objWord.BuiltInDocumentProperties("NUMBER OF LINES").Value
Comatose 290 Taboo Programmer Team Colleague

If you are running apache, I believe it runs as user apache, or as nobody.... you could in theory, make the php script setuid and run as someone with permission to write to the directory. However, this is pretty glaring security risk, but if you keep it contained, it shouldn't be too big of a problem.... I think though, that newer versions of *nix prohibit setuid on scripts (though, it might just be setuid to root on scripts.. which you should never do anywhere, but not sure).

Comatose 290 Taboo Programmer Team Colleague

Well first, since this seems to be a timed thing... check cron. See what cron is up to. If that isn't much help, you could consider crufting up a quick script or app that uses sockets and binds to the given port numbers... then the program that is trying to connect to (ie open the ports) will crap on itself (Address already in use) and might help you to catch the output.... other than sniffing the packets, to catch the destination address, you're hands are pretty much tied.

Comatose 290 Taboo Programmer Team Colleague

*Just Smiles*

Comatose 290 Taboo Programmer Team Colleague

I'm pretty sure that you can't use a variable name as a property of an object..... you could try this instead:

Data1.Recordset.FindFirst(store) ' might work
Comatose 290 Taboo Programmer Team Colleague

Yes, Yes you can. However, wireshark may use a lot of hard-drive space if you leave it running for a long time (and there is a lot of activity on those ports). See, each time a packet is sent or received wireshark records it... if you set filters, then you can tell it to only record say, UDP traffic, or specific port numbers, or only specific port numbers with UDP traffic, etc. So, you run the program, take the port numbers in question, and tell wireshark to filter out everything except UDP traffic on those specific ports. Then, whenever UDP data is sent or received on those ports.... wireshark will record it. So if these ports send data, say, every three minutes... and you go home, when you come back 8 hours later, you are probably going to have quite a large log file or memory consumption.... if it only sends data once an hour, then you won't have much used at all.

Comatose 290 Taboo Programmer Team Colleague

Well shut me up.....

Comatose 290 Taboo Programmer Team Colleague

Well, the first step in any perl app when using the dbi interface is to make sure perl knows to use it:

use DBI;

Then, you want to make perl connect to the database using the DBI interface, so, make a variable and assign it to a database connection:

$dbh = DBI->connect("DBI:mysql:users", "Username", "Password");

In this code, we connect using DBI to a mysql database, named users. We also supply the username and password to access the database.
Now, we need to create a query, and execute it:

$query = $dbh->prepare("SELECT username from dba_users where username like '%I3598%';");
$query->execute();

And finally fetch the information we want:

while ($tmpname = $query->fetchrow()) {
     push @dba_usernames, $tmpname;
}

Now, (assuming all the assumptions I made about the type of database, the name of the database, and the name of the tables/columns are accurate) you should have an array called dba_usernames, that contains a list of all the usernames that match your query.
Now, simply display them if you want (though, you could probably do this in the while loop instead for efficiency.. but this lends itself to future growth):

foreach $name (@dba_usernames) {
     print "$name\n";
}

You may have to tweak it a little, to work exactly how you like, but this should at least get you knee deep on the right path.

Comatose 290 Taboo Programmer Team Colleague

http://www.linuxdevices.com/articles/AT8047723203.html is a pretty good starting point for making debs.
http://wiki.freegeek.org/index.php/Basic_Debian_Packaging is a short but good one.
https://wiki.ubuntu.com/PackagingGuide/Basic?action=show&redirect=HowToBuildDebianPackagesFromScratchAnd this one is a whole lot more work, but will help you understand it really (really) well.

Comatose 290 Taboo Programmer Team Colleague
int *x = new int();

How can you dynamically allocate memory on the heap using a reference?

Comatose 290 Taboo Programmer Team Colleague

Which platform are you planning to deploy it on? You can choose say, RPM for RH based distro's, or .debs for debian... or, go good old fashioned tar ball (.tar.gz) which is pretty universal.