Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

CreateProcess() gives you a lot more flexibility to control how the new process is actually created. All but the 1st, 9th and 10th parameters can be 0.

Your program has no control at all with the system() command.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I've tried codeblocks but it tends not to do anything when I hit compile, or build and run

Then you did it wrong. I use Windows 7 and it works ok for me. Code::Blocks is only an IDE and requires a compiler such as MinGW of Microsoft's CL. There are two versions of Code::Blocks, one with MinGW compiler and the other without it. I prefer using the version with MinGW because its the same compiler (almost) that is used on *nix os.

There is also free Microsoft Visual C++ 2010 Express, which compiles both C and C++ programs.

[edit]Oops! I just responded to a 18-month old dead thread :icon_cry:

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

CreateProcess() isn't really all that difficult once you realize most parameters are 0. That function does not wait for the newly created process to finish. If you want that behavior then you have to call WaitForSingleObject() after calling CreateProcess().

STARTUPINFO sinfo;
PROCESS_INFORMATION pInfo;
memset(&sinfo,0,sizeof(STARTUPINFO));
sinfo.cb = sizeof(STARTUPINFO);
BOOL b = CreateProcess("notepad.exe",NULL,0,0,0,0,0,0,&sinfo,&pinfo);
if( b == 0)
{
   // an error occurred
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The OP didn't say anything about having 10 CPUs. He just wants 10 processes to be launched all at the same time. There is no way to do it on only a single CPU. Even if there were a way, they would not actually all run at the same time on a single CPU due to time slicing processes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why don't you just call CreateProcess() in a loop and call it 10 times?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The problem with using magic numbers to identify a file format is that the numbers may be just coincidental to the rest of the file. For example I might have a binary file whose first few bytes are 49 49 2A 00, but that doesn't mean its a TIF file.

There are lots of magic numbers as shown in this wiki article.

In any event, I suppose you would want to check the magic numbers of a known file format to find out if the file is in that format. In the case of TIF the magia numbers occupy the first 4 bytes of the file, so you would use fstream to read the first four bytes

ifstream in("filename", ios::binary);
if( in.is_open())
{
   unsigned char magic[4] = {0};
   in.read(magic, sizeof(magic));
   if( magic[0] == 0x49 && magic[1] == 0x48 && magic[2] == 0x2a && pagic[3] == 0)
   {
       // It's a hit!
   }
}

I just tried this on a pdf file and the first few bytes are in text and read "%PDF-13".

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Bull! 2A has nothing to do with protection against the government itself.

The strongest reason for the people to retain the right to keep and bear arms is, as a last resort, to protect themselves against tyranny in government.-Thomas Jefferson

The right to have arms in English history is believed to have been regarded as a long-established natural right in English law, auxiliary to the natural and legally defensible rights to life.[9] The English Bill of Rights emerged from a tempestuous period in English politics during which two issues were major sources of conflict: the authority of the King to govern without the consent of Parliament and the role of Catholics in a country that was becoming ever more Protestant. Ultimately, the Catholic James II was overthrown in the Glorious Revolution, and his successors, the Protestants William III and Mary II, accepted the conditions that were codified in the Bill. One of the issues the Bill resolved was the authority of the King to disarm its subjects, after James II had attempted to disarm many Protestants, and had argued with Parliament over his desire to maintain a standing (or permanent) army.[10] The bill states that it is acting to restore "ancient rights" trampled upon by James II, though some have argued that the English Bill of Rights created a new right to have arms, which developed out of a duty to have arms.[11] In District of Columbia v. Heller (2008), the Supreme Court did not accept this view, remarking that …

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Those numbers have nothing to do with the amount of memory occupied by all those strings. Its nothing more than the starting memory address of them. If you want to display the length of the strings then you have to call strlen(), such as printf("%d\n", strlen(argv[i])); [edit]Oops! What ^^^ said :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Can't say because we don't know what library is loaded or what symbols are exported from it

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Look at the string you are passing to LoadLibrary(). You are passing it the path but not the name of a library.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to learn how to use your compiler's debugger so that you can single step through your program and find out for yourself what is causing the problem. That will save you lots and lots of time

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I started in 1982(?) while on active duty in the US Air Force. We had an HP computer that ran HP basic, pretty advanced for its day, more like PASCAL than QB. After retirement I bought a cheap computer from Radio Shack, a book (c language), and my career took off from there.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Yes, as far as I know, it shouldn't be a problem. (btw, I know that I am contradicting vijayan121 on this, he may be right, but I think not, I think he is being a bit over-cautious, ABI shouldn't be a problem here)

>>If your DLL doesn't have the exports showing up when listing them with dumpbin (which would make it a very useless DLL), then you will for sure need to recompile from the source files

Aren't those contradictionary statements?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

that pragma may not be recognized by your compiler. Try adding the library in the project settings. I don't use that compiler so I don't know how that's done.

Or you could just get a better compiler, such as free Code::Blocks with MinGW.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

google for "c++ ReadRemoteRegistry" and you will find several threads, like this one

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>for( ; m < 12 ; ++m ) if( memcmp( month, month_names[m], sizeof(month) ) == 0 ) break ;
struct tm log_time ;

Or you could just use wcscmp() from tchar.h. sizeof(month) may or may not be the same as wcslen(month)
for( ; m < 12 ; ++m ) if( wcscmp( month, month_names[m]) == 0 ) break ;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The first parameter to WinProc() is the handle to the window to which WM_LBUTTONDOWN event was sent.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>int a = 0;

You can not put that in a header file. extern variables are always declared in a *.c or *.cpp file. Put this in the header file extern int a;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you could convert it into struct tm that's declared in time.h then call mktime() to convert that structure into type time_t.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have to link with ws2_32.lib

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i dont know about C/C++ but in C#/Java/VB (.NET Appis) mouse events work only in form, i mean it wont catch any event out of program, also if use your method the focus will be lost and simply program will stay stand by and will not do any action i think...

C/C++ can grab mouse events globally by installing Windows Hooks

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> I would like to write code which takes an action every time a person clicks inside of the second window (picturewind) but not when the person clicks in the first window (hWnd)

Its a little unclear what the above means. In which program is the actions to be taken? If in the second window then its just standard mouse events. But if you want to do something in the first window when the mouse is clicked in the second, then its just slightly more complex. In the second window capture the mouse events as before but send a message to the first window letting it know about the events.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to capture one of the mouse events, such WM_LBUTTONUP On that page in MSDN you will also find links to all the other mouse events that you will want to study.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What exactly does "it doesn't work" mean? Error message(s)?

make sure everything was compiled in release mode, not debug mode.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And of those 100 new registrations daily how many are spammers???

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>choice &= 223; //converts to uppercase.

Here is another tip -- use standard C/C++ choice = toupper(choice);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

On networks you also have to consider endianness If one computer is big endian and the other little indian then the numeric data will have to be converted.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Actually, its finite, the condition is infinite, but this doesn't necessarily mean the loop is infinite.

True -- the return statement inside the loop will cause the loop to stop after the first iteration.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
temp =  ArrOperand[counter];
	static_cast<char>(temp);
	perm[i] = temp;

Why all that hard work??? All you need is this: perm[i] = (char) ArrOperand[counter]; -- that is, assuming the values in ArrOperand can be held in a char variable. If not, then it won't work.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>}while(choice != 'n' || choice != 'N');

You need to use &&, not ||.

Clinton Portis commented: oopsie +10
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

call recv() twice, the first time to get just the first 4 bytes (assuming the size of the structure is at the beginning, and then again to get the rest of the structure.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

it says hello world... it might do what you want to but it is overkill

despite the infinite loop at the end of main().

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The St Louis Cardinals just won their 11th World Series Baseball championship against Texas Rangers. The final score was 6 to 2. The Cardinals are second only to New York Yankees for the most world series games won. The first one played was in 1903.

Odd they call it the "world" series because only Toronto Canada has ever played in it. But still, sometimes we like to think we are the world :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 19: use == (comparison) operator instead of = (assignment) operator

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes, that is exactly the code I posted.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In my opinion, Programmer has the more importance as compare to the software engineer!

Your opinion is wrong.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have already stated the items in the combo box -- Day, Afternoon, Night and Mixed. Do you know how to add those items to the combo box while in Form Designor? (In the comboBox Properties page scroll down to the Items Collection and you can add them there. See thumbnail below)

In the Calculate button's SelectedIndexChanged event handler

private: System::Void comboBox1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			if( this->comboBox1->Text == "Day" )
			{
					 // do calculations for Day here
			}
			else if(this->comboBox1->Text == "Afternoon" )
			{
					 // do calculations for Afternoon here
			}
			else if(this->comboBox1->Text == "Night" )
			{
					 // do calculations for Night here
			}
			else 
			{
					 // do calculations for Mixed here
			}

	}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can not make the results of the C program permanent on the terminal. Like all other shell programs anything done within the program (or shell script) is destroyed when the program ends.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

GetProcAddress() probably returned a NULL pointer.

The spelling and case of a function name pointed to by lpProcName must be identical to that in the EXPORTS statement of the source DLL's module-definition (.def) file.

Notice the functions still must be exported.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

define it as a pointer and allocate memory to it at runtime MyArray DWORD 0 Exact syntax will depend on the assembler and computer you are using. And if Intel will depend on the memory model.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is nothing wrong with the for loop on line 25. What exactly do you want help with? (hint: you need to do more calculations within that loop. can't be done all on one line.)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

homework problem??? If so, then study about function pointers (or pointers to functions). Once you understand that then you will have the answer to your question.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

copy the DLL into any of the folders listed in the PATH environment variable and it will work regardless of where the application program is located.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

check your computer's file system to see if alleg42.dll exists? If it does, is it in one of the folders listed in the PATH environment variable?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

<snipped profanity and personal attack>

But he was right -- he wasn't calling you an idiot, there really is a book named Programming for Idiots. But I don't suggest you buy it because it isn't very good book.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since each line of the file contains three words (symbol operator symbol) then I'd use three different variables to read in the line

std::string symbol, operator, result;
while( help >> symbol >> operator >> result)
{
   switch(operator[0])
   {
     case '=':
       // do something here
       break;
       // do something here
       break;
     case '+':
       // do something here
       break;
     case '-':
       // do something here
       break;
     case '*':
       // do something here
       break;
     case '/':
       // do something here
       break;
     case '%':
       // do something here
       break;
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Start out your program very simply, just create a program that does nothing more than read each line of the file and display them on the console screen. Once you have that compiled and working correctly you can add additional code to make the program behave as you have described. Just do it a little bit at a time and pretty soon you will have the entire project finished.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Everything is more difficult in C/C++ than it is in java or some other languages. If you are looking for simplicity then go for C++/CLI which is .NET language. It has Windows Forms which you will probably like. You will need Microsoft's Visual c++ 2010 Express (free)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is no such thing as an "assembly compiler". Assembly programs are not compiled. They are just assembled. Two good assemblers for MS-Windows os -- MASM (a Microsoft assembler) and TASM (a Borland assembler)

When you write assembly you are expected to "know your stuff" and not be spoon fed. You should already know how to program and not be intimidated by the complexity of an assembler.

>>but it is too old and do not show in which line error is and no auto code compilation.
You are too spoiled by Code::Blocks.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

*nix shell is probably interpreting the ( character. you might try escaping it, e.g. \(