pseudorandom21 166 Practically a Posting Shark

It was one of the links on that page that contained the actual code.

You will need the rest of the code (about the notification) so that windows and the various windows updates to recognise the new path information.

Thank you sir you are an expert lifesaver! I accidentally hit the -1 button in my hurry, sorry :/

But at least we both know you did excellently!

pseudorandom21 166 Practically a Posting Shark

Google came up with This link.

I believe it does everything you need it to =) (I suggest following its instructions by the way and doing it as a set-up process or perform some kind of detection so you don't add it repeatedly during your program execution)

I'm actually a little stumped about adding the path to my .exe to the PATH in the first place, that article mainly has a method to notify windows of the changes, right?

pseudorandom21 166 Practically a Posting Shark

Hey, I need to know how to add my program to the environment variable PATH without messing up my PATH in the process... Of course I plan to use Environment.GetEnvironmentVariables() and set...

Anyone have some experience with this?

pseudorandom21 166 Practically a Posting Shark

If a file fails to open or an error bit gets set (like EOF) then you have to clear them before opening a new one.

pseudorandom21 166 Practically a Posting Shark

Half Life 2 gets my vote, for multiplayer HL2 and Counter Strike: Source Beta.

pseudorandom21 166 Practically a Posting Shark

I think the program would be easier to maintain if all of those options were composed of one or more functions being called.

switch(a)
{
case 1:
  DoTemperature();
}
pseudorandom21 166 Practically a Posting Shark

Here's my feeble attempt:

#define _WIN32_WINNT 0x0601
#include <windows.h> 
// when you use Windows.h it should be the first header
// you include, because windows.h is really quite picky and lame about that sort
// of thing.
#include <iostream>

void DoFullscreen(HANDLE hOutput)
{
	BOOL result = SetConsoleDisplayMode(hOutput, CONSOLE_FULLSCREEN_MODE, NULL);
	if( !result )
		std::cerr << "Last error: " << GetLastError() << std::endl;
}

int main()
{
	std::cout << "Running test one.. " << endl;
	// One of these structures.
	CONSOLE_SCREEN_BUFFER_INFOEX bufferInfo = {0};
	bufferInfo.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
	// Get a handle to the console window.
        HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
	if(hOutput == INVALID_HANDLE_VALUE)
		std::cerr << "GetStdHandle() -> " << GetLastError() << std::endl;
	// Fill bufferInfo with the window information, using the window handle.
	if(!GetConsoleScreenBufferInfoEx(hOutput, &bufferInfo))
		std::cerr << "GetConsoleScreenBufferInfo() -> " << GetLastError() << std::endl;
	// If full-screen mode is supported (it's not on W7 and Vista)
	if(bufferInfo.bFullscreenSupported)
	{
		std::cout << "Good news, your system supports full-screen!" << std::endl;
		DoFullscreen(hOutput);
	}
	// Set current size to maximum.
	else
	{
		bufferInfo.dwSize = bufferInfo.dwMaximumWindowSize;
		// Set the new console screen buffer info structure.
		if(!SetConsoleScreenBufferInfoEx(hOutput, &bufferInfo))
			std::cerr << "SetConsoleScreenBufferInfo() -> " << GetLastError() << std::endl;
	}
        std::cout << "Press ENTER to continue..." << std::endl;
        std::cin.get();
	std::cout << "Running test two.. " << endl;
	HWND hConsoleWindow = GetConsoleWindow();
	if(hConsoleWindow == NULL)
		std::cerr << "GetConsoleWindow() -> " << GetLastError() << std::endl;
	ShowWindow(hConsoleWindow,SW_MAXIMIZE);
	std::cout << "Press ENTER to continue..." << std::endl;
        std::cin.get();
	return ERROR_SUCCESS;
}
pseudorandom21 166 Practically a Posting Shark

there is probably a list of "project ideas" on daniweb if you search for them.

pseudorandom21 166 Practically a Posting Shark

Everything he needs to know can be found by reading this page:
http://msdn.microsoft.com/en-us/library/dd743680(v=VS.85).aspx

pseudorandom21 166 Practically a Posting Shark

I've been programming in C++ for quite some time now and I know all functions must return a value.. but can someone tell me WHY we return 0?

I mean it compiles even when I don't put return 0.. and the program executes fine.. I can see in some functions we'd return a variable or a value.. but for int main() why do we always have to write return 0? Someone told me its the new standard that we don't have to type it anymore but I'm so used to return 0 that I can't not type it. I also heard its because when a function returns a value other than 0, it means something is wrong and the operating system can check the value it returned and check for memory leaks or something..

what if I returned 256? it still works.. :c

also can someone explain when i use unsigned variables?? I never use them unless a function on MSDN requires it.. so is there any use of them other than passing them to functions as parameters? Oh and when do we use constants? I mean I can just use a float or integer instead of const int or const float.. just don't change the value right? When do we use constants :S

I saw someone do this:

const float PI = 3.14159265f;
const float DEGREE_TO_RADIAN_FACTOR = 0.0174532925f;

can someone explain why there is an "f" at the end of the values??

Thanks in advance.

Yep.

but can someone tell …

pseudorandom21 166 Practically a Posting Shark

OR you can just always thread.
On Linux you can use fork().
On windows call CreateThread(), something like this:

#include <windows.h>
#include <iostream>

DWORD CALLBACK threadFunc(void*)
{
printf("New Thread");
 return 0;
}

int main(int argc, const char* argv[])
{
  DWORD id;
  HANDLE h = CreateThread(NULL, 0, threadFunc, NULL, 0, &id);
  int d;
std::cin >> d; //wait for user to input before terminating
 return 0;
}

WARNING: The code is C++, so you will have to change it a bit for C.

It's also important to note that Visual Studio has their own version of CreateThread and using CreateThread with VS leaks memory. For some reason <shrug>.

Anyway, for Visual Studio users you can use _beginthreadex() and _endthreadex(),
http://msdn.microsoft.com/en-us/library/kdzttdcb(v=VS.100).aspx

sergent commented: .. +5
pseudorandom21 166 Practically a Posting Shark

Because of this right here this code won't compile:

for (int i=0; i < numberofFights; i++)
	
		
		// coin toss
	int coinToss=rand()%100 + 1;

Why don't you try extracting the problem logic into a function and call that 5 times?

pseudorandom21 166 Practically a Posting Shark
pseudorandom21 166 Practically a Posting Shark

In many cases threads complicate matters before they solve them - especially if you are unfamiliar with threading in general.
Why not have some discrete concept of time where you invoke each behavior at each step? Something like:

while (true) {
   has_input = check_for_input
   if (has_input)
      apply_input
   do_controlled_car
   do_random_cars
}

This way you don't have to worry about the issues threads introduce.

I think that's a good idea too.

pseudorandom21 166 Practically a Posting Shark

hello
i wanna build software that i will be can speak with my friend with our cams
i have used that dll : WebCam_Capture
and that only show my camera . but i cant show my friend camera/ how can i do it?<<<
thankss

That is the most unimaginative thing I've heard in quite a while.

pseudorandom21 166 Practically a Posting Shark

I need to run some code written in Java from my personal website. How do I even begin?

pseudorandom21 166 Practically a Posting Shark

I'm looking for a... general purpose uber high-level programming/scripting language, with a small learning curve. I'm thinking it would be suitable for automating tasks like simple file IO, http requests, searching/sorting, simulating user input, etc.

So what language would you carry with you on your day-to-day mundane tasks?

pseudorandom21 166 Practically a Posting Shark

unfuddle seems like the best for private SVNs.

pseudorandom21 166 Practically a Posting Shark

1. In a for or while loop, if the condition is breached in the middle of the brackets {}, will the code immediately stop the loop, or wait until it gets to the bottom of the brackets {} ?

2. If a function is called in my code, does the computer wait until the function is finished before continuing with the rest of the code?

#1. Wait until it gets to the bottom, it will.

#2. Yes it does.

pseudorandom21 166 Practically a Posting Shark

It's not illegal if he's a student.

If he is a student he can get '08 and '10 pro. free from www.dreamspark.com

I have VS2010 pro. :D

pseudorandom21 166 Practically a Posting Shark

If you want cool debugging features you should use a different IDE like Visual Studio or Code::Blocks.

pseudorandom21 166 Practically a Posting Shark

Yeah now I'm depressed I didn't do the modulus thing. I was thinking about it I swear!

pseudorandom21 166 Practically a Posting Shark

Not really, maybe an airplane. Pilot training isn't cheap though.

pseudorandom21 166 Practically a Posting Shark

Something along the lines of:

string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string input;
	getline(cin,input);
	stringstream ss(input);
	unsigned int value = 0;
	ss >> value;
	if(value <= 0)
	{
		cerr << "Program encountered an unexpected error and will now exit. (Mwuahahaha!)" << endl; 
		return 1;
	}
	cout << "value = " << value << endl;

	//j is the current index into "alphabet"
	//r is the number of times it has wrapped around.
	//i is simply used by the loop as the "loop-control" variable.
	string::size_type i = 0, j = 0, r = 0;
	for( ; i < value; i++, j++)
	{
		 if(j == alphabet.size()) { j = 0; r++; }
	}

	string output;
	for( string::size_type k = 0; k < (r+1); k++ )
	{
		output += alphabet[j-1];
	}
	cout << "Output = " << output << endl;
pseudorandom21 166 Practically a Posting Shark
pseudorandom21 166 Practically a Posting Shark

thnk you (pseudo) for your comments.. i didnt know people here are rude..
hope you *** due to your EXCELLENT programming SKILLS!

I'm quite happy you feel as such. But isn't that a threat? :( Daniweb likely frowns upon threatening other members.

I'm sorry I called your programming "skills" wasted, I'm sure they're quite useful to you and your people. But for most of the rest of the world, we require "ISO/IEC C++ 2003".

Please see http://en.wikipedia.org/wiki/C%2B%2B
for information regarding future revisions to the C++ standard.

pseudorandom21 166 Practically a Posting Shark

The person copied that class from here: http://midnightprogrammer.net/post/ReadWrite-settings-to-INI-File-using-C.aspx

anyway that's a Win32 function, here's the reference page: http://msdn.microsoft.com/en-us/library/ms725501(VS.85).aspx

ddanbe commented: well noticed! +14
pseudorandom21 166 Practically a Posting Shark

Not to sound counter-productive but there is an installer available for boost, if you're using Windows I would say it's definitely worth checking out. It takes a long time to download the files but, you get the pre-built .DLLs and .LIBs for multiple compilers, target platforms, and runtimes.

After you install it, (it installs to program files folder by default) you just add:
project-> include directory "C:\Program Files (x86)\boost\boost_1_47"
lib directory "C:\Program Files (x86)\boost\boost_1_47\lib"

and then it probably statically links by default, and normally when I want to dynamically link I define the proper macro like: #define BOOST_THREAD_USE_DLL https://svn.boost.org/trac/boost/ticket/4921
Or In the header file: <boost/config/user.hpp> #define BOOST_ALL_DYN_LINK here's the installer link:
http://www.boostpro.com/download/

Overall I have found this way of obtaining and using the boost library to be by far the best.

pseudorandom21 166 Practically a Posting Shark

forecast says 30% chance of rain, hope it pours for a day or two personally.

pseudorandom21 166 Practically a Posting Shark

ok, i finished it and heres the link to the program: http://www.megaupload.com/?d=G9O7YGMV. Its packed in a .rar. I recorded it with my ipod in my living room. The higher the note, the quieter the note. Have fun.

Woah lol you should start using C++ strings and stringstreams! Check this part out:

if(LOWORD(wParam) == 1)
                     {
                                       PlaySoundA(TEXT("Memo.wav"), NULL, SND_FILENAME | SND_ASYNC);
                     }
                     
                     if(LOWORD(wParam) == 2)
                     {
                                       PlaySoundA(TEXT("Memo+(2).wav"), NULL, SND_FILENAME | SND_ASYNC);
                     }
                     
                     if(LOWORD(wParam) == 3)
                     {
                                       PlaySoundA(TEXT("Memo+(3).wav"), NULL, SND_FILENAME | SND_ASYNC);
                     }

If you name your files like this: Memo0, Memo1, Memo2, etc. something like this would work:

string fileName = "Memo";
stringstream ss;
ss << LOWORD(wParam);
fileName += ss.str() + ".wav";
PlaySoundA(TEXT(fileName.c_str()), NULL, SND_FILENAME | SND_ASYNC);

Also for your piano keys you can build an "alphabet" I tend to call it. Then you can use a loop..

string alphabet = "C C# D D# E F F# G G# A A# B C";
stringstream ss(alphabet);
string token;
while( ss >> token )
{
}
pseudorandom21 166 Practically a Posting Shark

also, how can you make the system detect when you press the home key? im talking about the key that has the windows sign on it.

I think that's the Windows key, and also "GetAsyncKeyState" may work, I'm not sure what you want.
http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx

pseudorandom21 166 Practically a Posting Shark

Try adding "Winmm.lib" to the project options under additional link dependencies.

Or add this line to the top of your file: #pragma comment(lib,"Winmm.lib")

pseudorandom21 166 Practically a Posting Shark

Well, that's because the human liad down his brain for the doctor to pass the waves or whatever through it
The human's brain allowed computer to take his time by deciding he wanted to be with the computer not that he was forced by the computer.

Now, how about that?;)

BS, never had a chance, enslaved as a child & the machine does it remotely (radio waves).

pseudorandom21 166 Practically a Posting Shark

also, how can you make the system detect when you press the home key? im talking about the key that has the windows sign on it.

You can do that with a Windows hook! There is an example in my skydrive (the link in my signature).

pseudorandom21 166 Practically a Posting Shark

Hi
I'm software engineering student. I know python, c, c++ and c#. It's been two years I'm trying to learn programming but somehow I still a beginner. I just know the syntax of these languages. I love Linux and open-source.
I tried to learn programming in Visual Studio but my programs not works always correctly. for example I don't know about database securities and how to implement them. I just know the simplest code :@
I tried to read simple source-codes but all projects codes are out of my knowledge and I can not understand them. The codes are so different from which I practice in language tutorials. The books just studies the programming languages not programming.
My Q is: How can I be a programmer who can understand the codes and writes neat and clean code. Suggest me some books or tutorial?

Gotta write programs man.

pseudorandom21 166 Practically a Posting Shark

Some of these a re built for purpose and am sure it was never the purpose of any of the authors to take complete control of anyone's life and if it was, they is not achievable. We control our own time and as such, control our destiny. It depends on the individual

How wrong you are!

??
Step 1. Machine controls the human brain (radio waves or something).
Step 2. Computer doesn't allow the human's brain to control his time.
?? PROFIT ??

pseudorandom21 166 Practically a Posting Shark

No it deactivates it, but if you sign in within 2 weeks it reactivates it for you. If you pass the 2week period then they 'delete' it, but they might have you still on their database who knows. If you want to stop using it for a bit, then tell your friend to change your password and not give it to you until a week or so.

Heh the FBI/CIA probably keep a record of everyone's FB.

pseudorandom21 166 Practically a Posting Shark

i dont know how, thats why i'm asking for help.. and i cant find any prime number program in google that uses while loop but doesnt use bool.

Well anything we would write for you would be using modern, standard C++ instead of your 30 year old outdated non-standard C++ that you compile with Borland Turbo C++. So you can see the problem with us writing a program for you every time you're too lazy to use a search engine to learn something.

Yeah, and in place of the bool use an integer, use the value "0" for false and "1" for true. Enjoy your wasted programming "skills".

HASHMI007 commented: wtf +0
pseudorandom21 166 Practically a Posting Shark

can anyone show me the code of prime number program using while loop but without using bool..?

Can you use google, or do it yourself?

pseudorandom21 166 Practically a Posting Shark

Well at least it'll be good place to go on holiday. I'll get about $20 to £1!

Nahh we'll elect Ron Paul and everything will be fine.

pseudorandom21 166 Practically a Posting Shark

A while back there was a thread about what to do after retiring, I'm just gonna put this one up here: Sailing! As if we didn't know one day we would all become seamen.

http://www.amazon.com/Twenty-Small-Sailboats-Take-Anywhere/dp/0939837323/ref=sr_1_3?ie=UTF8&qid=1312183991&sr=8-3

This is the introductory literature I'm looking at, what do you guys think?

pseudorandom21 166 Practically a Posting Shark

So great

Why "So great" ?

pseudorandom21 166 Practically a Posting Shark

I had a seemingly bright idea for a cleaner and easier to use operating system feature, for when the Windows clutter just gets too bad.

Basically I want to alter the behavior of every window, such that when it loses focus it is minimized. But I don't know how to do it yet!

Basically so far I plan to:

1. Store a handle to the window in focus (foreground I think it would be).
2. When the window loses focus, send a minimize event.

This is what I have so far.

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
	WINDOWPLACEMENT wndPlace; memset(&wndPlace, 0, sizeof(WINDOWPLACEMENT));
	wndPlace.length = sizeof(WINDOWPLACEMENT);
	HWND previousWindow = GetForegroundWindow();
	HWND newWindow;
	while( !GetAsyncKeyState(VK_ESCAPE) )
	{
		newWindow = GetForegroundWindow();
		if((previousWindow != newWindow) && (newWindow != NULL))
		{
			GetWindowPlacement(previousWindow,&wndPlace);
			if( wndPlace.showCmd == SW_SHOWMAXIMIZED || wndPlace.showCmd == SW_SHOWNORMAL )
			{
				ShowWindow(previousWindow,SW_MINIMIZE);
				previousWindow = newWindow;
			}
		}
		Sleep(10);
	}
	return 0;
}

But on Windows 7 there is a "window" that gets minimized that shouldn't be. It messes up my start menu actually, this is my start menu (you can drag it around the screen). Lots of weird behavior with hiding windows that belong to Windows.

What should I do? The behavior is quite nice thus far (minus the bugs). I am considering trying to determine if the windows belong to the OS by the path to their .exe...

pseudorandom21 166 Practically a Posting Shark

Well for one the CIA is actually pretty expendable. How about $40 billion annually for things like better education?

Our intelligence agencies have failed us miserably despite their $40 billion annual budget. They failed to prevent 9/11. They provided Bush with false WMD information which led to the Iraq war. This in turn has accounted for almost a MILLION Iraqi deaths and over 4000 deaths of our troops along with hundreds of thousands injured and disabled.

from: http://www.bradfitzpatrick.com/weblog/455/romney-laughs-at-ron-paul-cia-fbi-irs/

pseudorandom21 166 Practically a Posting Shark

Hi everybody I'm not sure where to put a question like this so forgive me if I'm in the wrong spot.

I've just passed my college course C++ (had VB.net experience... if it matters) with a B. Is that knowledge enough to get a job somewhere or do I need more experience?

Any programming or programming relatedjob is fine even if its lower pay or lower end, I just need the extra experience.

Also I know passing one class of C++ doesn't mean I mastered it, so IF I were to get a job as a programmer, am I expected to know everything or do some companies provide some training for new workers as well?

Thanks!

I think an "internship" is where they provide some training.

pseudorandom21 166 Practically a Posting Shark

void main()

void main is incorrect, the two official entry-point headers are: int main() and int main(int argc, char *argv[])

pseudorandom21 166 Practically a Posting Shark

I also don't think fstream will have a problem with 4+GB files, I think sadsdw's problem is more likely due to memory usage (speaking from experience).

pseudorandom21 166 Practically a Posting Shark

Do freelance programmers get somewhat f'd on projects, mainly the fixed-price ones? I can understand paying $16.00 for a utility if it doesn't take two or three days to complete, oh and the requirements keep changing too! Bet employers don't tell their unlucky programmers that the requirements will change and take them longer. It would be bad for business lol.

Well that aside, if you have done freelancing, what was your best (easy/payout ratio) project and with what programming language was it done?

pseudorandom21 166 Practically a Posting Shark

Press "Windows Key + R" then type "cmd" or "command" or "command.com" in the run box, just make sure you get a command prompt window open.

Then type "ver" or "systeminfo" and press enter.

Please note that if you use systeminfo you will likely have to scroll up.

pseudorandom21 166 Practically a Posting Shark

How is your weather in your country? I am living in the Philippines and the weather here today is stormy and according to news, we are overloaded of typhoons in this month. One typhoon is over and there is 2 more waiting on the line. Oh boy!

I wish it was like that here, it's just really hot and humid too. It sucks.