Following a tutorial, I built a small sample program that uses winsock. It compiles, but there are a few different places I'm not sure what's happening with the pointers. Full source is available [here](http://pastebin.com/NTdCWhWr) Line 25: `struct hostent *host;` As near as I can tell, this creates a pointer to a memory address holding an instance of the "hostent" struct and refers to it as "host." What I can't figure out is why `hostent *host;` or hostent h; host = *h; wouldn't accomplish the same thing, as hostent is already an existing struct in the winsock2 header. Line 37: `socket_address.sin_addr.s_addr …

Member Avatar
Member Avatar
+0 forum 3

I'm trying to do something simple like get calc.exe to start minimized, but it's not happening. import subprocess import win32gui import win32con info = subprocess.STARTUPINFO() info.dwFlags |= subprocess.STARTF_USESHOWWINDOW info.wShowWindow = win32con.SW_SHOWMINIMIZED x = subprocess.Popen("calc.exe", startupinfo = info) It pops up the same as always, no matter what I provide for wShowWindow.

Member Avatar
Member Avatar
+0 forum 1

I've got an application that I call several times in a for loop using subprocess.call. Every time I call it, it starts minimized. I want it to be in a restored window. So what I've tried to do is get a handle on the window using win32gui.FindWindow. But in my current setup, FindWindow doesn't run until after the process is finished. from subprocess import call from os import getcwd from win32gui import FindWindow from win32gui import ShowWindow settings_files = list([file_1, file_2, file_3]) #this creates a command "%executable_path%\spider_3.0.exe /run" spider_app = "\"%s\" /run % ("join(getcwd(), "spider_3.0.exe")) while len(settings_files) != 0: current_settings_file …

Member Avatar
+0 forum 0

I've been strugglin with this all day. I'm trying to use python to walk through a registry key and delete all the values it finds. I've succeeded in getting it to find all the nested values, but as soon as I try to delete one, I'm met with "WindowsError: [Error 2] The system cannot find the file specified." I'm sure it's something simple I'm doing wrong, but I can't for the life of me figure out what it is. from _winreg import * def find_subkeys(key, subkeys, scanned_subkeys): current_key = OpenKey(HKEY_CURRENT_USER, key, 0, KEY_ALL_ACCESS) for i in range(4096): try: subkey = …

Member Avatar
Member Avatar
+0 forum 3

Someone looking at my code today told me that I didn't need to delete a pointer I declared in one place because I didn't create it using the "new" operator and went on to say that you only have to delete them when you use the "new" operator to declare them. Is this accurate? Relevant code included, the pointer is to a vector object within a struct named "pParams". /*use parameter name to determine which member of the pParam struct should be affected*/ void Cfg::proc_param(string name, string value) { vector<string> *param_vector; bool bad_param_name = false; if (name == "dirs_recursive") param_vector …

Member Avatar
Member Avatar
+0 forum 7

I just can't help but feel that there's a more efficient way to do this than with multiple calls to the string[i] operator. I've tried storing the results of string[i], but that leaves me with a char, which I'm evidently unable to compare. I know that I can compare a char*, but from what I can tell, that's a C char and string[i] provides me with a C++ char. I could be way off with my entire analysis of the situation, so any help would be greatly appreciated. void proc_cnf_line(Settings& settings, string line) { string param_name; string param_value; bool param_named …

Member Avatar
Member Avatar
+0 forum 7

I'm sure I'm missing something basic here, but I cannot get this to compile. Using codeblocks 10.05 with mingw build of gcc 4.4.1. I've included unistd.h and tried replacing MAXPATHLEN with PATH_MAX but every time, it gives me: error: 'MAXPATHLEN' was not declared in this scope or error: 'PATH_MAX' was not declared in this scope #include <iostream> #include <unistd.h> int main() { char temp[MAXPATHLEN]; return 0; } I've also tried #include "unistd.h" to no avail.

Member Avatar
Member Avatar
+0 forum 2

I've made a simple function that takes a vector as an argument. If the vector is empty, it throws a domain_error (I've included stdexcept). I'm feeding it an empty vector from the main loop just to learn try...catch statements and when it catches the error, it's supposed to print something and carry on. Instead, however, it hangs on catching the error. I know I'm close, though, because if I use the step-through debugger in code::blocks and tell it to go to the next line, it continues as I'd expect it to. Why won't the executable do this on its own? …

Member Avatar
Member Avatar
+0 forum 3

I'm working my way through Accelerated C++ and I've come across this exercise. The read_hw function works fine if it's void as long as I comment out the "return in" line. The author didn't bother to explain why he's returning a reference to the cin that was passed in the first place. Also I'm not sure what to make of the if (in) here, since it was passed as a parameter it seems like it should be there. I would greatly appreciate any (correct) explanation for almost anything going on here related to istream/cin. [code] // read homework grades from …

Member Avatar
Member Avatar
+0 forum 4

I'm used to c++ along with an open database (switched from mysql to postgres not too awful long ago.) A new job I'm looking at taking focuses heavily on .net along with SQL Server. As such, I've been looking into the .net framework and what I can't seem to figure out is how to make sure I'm actually using it. From what I've gathered, C# and VB.net are both managed languages, and someone mentioned that there is a managed C++ that compiles first to Microsoft CLR. Is using Visual C++ enough to ensure I use this "Managed C++." Does this …

Member Avatar
Member Avatar
+0 forum 3

I'm used to c++ along with an open database (switched from mysql to postgres not too awful long ago.) A new job I'm looking at taking focuses heavily on .net along with SQL Server. As such, I've been looking into the .net framework and what I can't seem to figure out is how to make sure I'm actually using it. I know VB.net is one option, but I loathe VB and would prefer to do my coding in C#, if not C++ (though judging by the interviews, they lean more toward C#). I'm really stuck, though, as to how to …

Member Avatar
Member Avatar
+0 forum 3

The End.