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

Isn't it interesting that they blame the black out on beyonce?

Yes, it was her fault -- she was REALLY HOT wasn't she :) :)

Quote from Washington Post:

On NBC’s “The Today Show,” Barbara Lippert, editor-at-large at mediapost.com, said she believed the commercial was racist because it was “just saying that black people are happy.”

OMG! Now that's just over the top, can't we even make a commercial depicting people being happy?? Why don't we just ban TV altogether so that won't happen ever again. It's all God's fault, He is just punishing us with happiness for all the gay rights movement. Why otherwise would anyone want to go to Jamaica and have a good time?

<M/> commented: yeah she was +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

getchar() only retrieves one keystroke from the keyboard buffer. When you type something you have to also hit the <Return> key, right? The Return key is put into the keyboard buffer along with the other keys you type. After calling getchar() you need to clear the keyboard buffer of all remaining keys. Unfortunately there is no standard way of doing that.

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

It does not use COM functions

COM is C, not C++. In fact, the entire win32 api (which COM is a part) is C. That doesn't mean you can use c++, just that all win32 api functions have C interface so that they can be called from a variety of programming languages.

After a little testing with that code, I think you are right, it does need to be compiled as c++. I extracted some of the relevant code for FindAFolder(), copied it into a console project then changed the file exten to *.c and it won't compile.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
  1. You need to provide a function prototype for playgame()

  2. Line 43: remove the semicolon at the end of the line.

  3. line 70: you need to provide an else without any conditions to account for cases when the user enters something else.

  4. I think the biggest problem is line 30: an int divided by another int is still an int, not a float. integers have no decimal places, to 1/2 is 0 not 0.5. In order to correct that typecast either the numerator or denominator to float.

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

fgetc() returns int, not char.

The return type is int to accommodate for the special value EOF, which indicates failure:

The while loop should be this so that the rest of the code isn't run when fgetc() returns EOF:
while( (c = fgetc(myfile)) != EOF)

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

what is awful about it? The code you posted is a lot worse :)

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

You don't need a hook function to do that. Just call SHBrowseForFolder() function

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

I'm intrigued by Budweiser being the last on the list (

Yes, surprising to me too. Maybe it's because the Bush family doesn't own the company any more. There was a hostile takeover a few years ago (2008). The company hasn't been the same since then.

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

Alternatives are shared memory (via the Clipboard) and memory mapped files.

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

I have mixed emotions about it. What if I don't want the same avatar on all web sites that I visit?

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

Do you mean get and set, see this link. If you want read-only, don't incloude the set. If you want write-only don't include the get. Include both if you want read-write.

xHellghostx commented: That works thanks! +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

just delete line 21, not needed since those pointers were not allocated by calls to malloc()

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

Sounds like you are not logged in. Look in the purple ribbon at the top of the page, It should say "Logged in as Fiorentino01^" If it doesn't say that then you need to hit the login button.

The recommended way to thank someone is to hit the Up Arrow that appears to the right of the "Flag Bad Post" link. You can put in a comment if you want.

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

Another hint: mkdir() only works on one directory at a time. You have to call mkdir() for each new directory in the directory hierarcy. If you want to create a directory "c:\one\two\three" then call mkdir("c:\one"), mkdir("c:\one\two") and finally mkdir("c:\one\two\three")

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

You could do that, but there is a much easier way if you use the macros in ctype.h

if( isdigit(i) )
{
    // blabla
} else if( isalpha(i) )
{
   // blabla
 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Except for line 3 it seems to meet the requirements of the instructions you originally posted. line 3 should be: int main() because main() always returns an int.

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

Use substr() method e.g. if textBox1.Text.Substring(0,1) = '"' then

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

line 12: Do not declare variables in switch statements like that, but declare FILE* at the top of main() so that it is global to the entire function.

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

You don't need to worry about that. Just call the registry functions and they will take care of all that complexity.

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

Your compiled program does not contain all the code that it uses. Most of the windows code is contained in DLLs and ocx files. When you deploy your program you might also have to deploy some (or all) the DLLs and ocs files.

Before doing anything, download a copy of dependency walker (link) to find out what DLLs and ocx your program uses. Then you will have to check the target computer to find out which ones it is missing. Be careful not to overwrite old DLLs on your computer with newer versions on the target computer. You need to do version check before installing your DLLs and OCX files. If you use an auto installer such as InstallShield it will most likely do all that for you.

As an alternative, check your compiler settings and see if it will statically link the DLLs and OCXs so that they are not needed on the target computer. But that will probably double the size of your program. I don't know if vb 6 has such an option or not.

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

That can easily be done with .NET languages such as C# and VB.NET (see this link), but I might be terribly complicated to accomplish the same thing with win32 api functions.

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

My answer is the same regardless of language. here is just one example, read the reviews at the bottom of the page.

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

search amazon.com and read book reviews by other people who have bought the books.

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

Antidisestablishmentarianism

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

Read the last couple pages of that sticky thread, there are posts only a couple weeks old.

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

That zip file does not contain the source code. Just the *.exe and some html doc files.

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

I predict the earth will turn to a lump of cinder in another 2,000,000,000 years when our Sun goes super nova. But of course I could care less by then.

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

LOL. That's telling her to put her money where her mouth is :)

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

The program crashes because the pointer to class Test points to nowhere. You have to set it to a valid memory location before it can be used

int main()
{
    // Pointer to class
    Test *t = new Test; // <<< allocate memory for the pointer

What does it help to make a class object as a pointer?

In your simple program it doesn't help at all. What you are trying to do is learn how to use pointers, which becomes very useful in more complex programs.

*k = t->GetMax(10, 9);

That isn't going to work either for the same reason *T didn't work, no memory allocated to the pointer.

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

i am to try the gets()

Don't bother with that. use getline() as nullptr suggested.

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

your link is not valid. But here is how to do it

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

lines 3 and 4 are wrong, it's '\0', not '/0'

you have to clear the stringstream before re-using it. Put this after line 12

ss.clear();
ss.seekp(0); // for outputs: seek put ptr to start
ss.seekg(0); // for inputs: seek get ptr to start
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The program you posted doesn't give me any exceptions (vs 2012), works as expected. As long as lockThis is declared readonly there should be no problem.

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

No. The file is closed when leaving the lock block of code.

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

buttons don't have a boolean property that works like that. You might have to create your own boolean variables that are toggled on and off each time you click the button. Something like this example

Public Class Form1
    Dim button1_clicked As Boolean = False
    Dim button2_clicked As Boolean = False

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If button1_clicked = False Then
            button1_clicked = True
            TextBox1.Text += "Button1 is on" & vbCrLf
        Else
            button1_clicked = False
            TextBox1.Text += "Button1 is off" & vbCrLf
        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If button2_clicked = False Then
            button2_clicked = True
            TextBox1.Text += "Button2 is on" & vbCrLf
        Else
            button2_clicked = False
            TextBox1.Text += "Button2 is off" & vbCrLf
        End If

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

That Microsoft article is incorrect. The program causes an exception if LockThis is anything other than static.

There is not guarentee that threads will execute in consecutive order, as you can see from the output in that text file. You should not expect to see alternating lines of thread t1 and t2 in the file unless you tell the thread to release cpu time back to the MS-Windows task scheduler. I assume this will probably not be that big a problem for you in a complete program where each thread also has other tasks to do.

Is your intent to creat a program that produces a log file? If it is, there may be alternate ways to accomplish that.

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

According to this article lockThis needs to be a static object.
static readonly System.Object lockThis = new System.Object();

The above change made your program work for me.

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

Look at the sql statements in this tutorial

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

but you didn't post what you tried. No one can help you any more if you dont' or won't post what you did.

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

There have been several suggestions posted in this thread. Post the code you have tried instead of just crying "I can't!"

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

If I'm not mistaken, the form won't fire the keydown or keypress events unless it has focus,

I tested with with vb.net 2012, the code I posted works when a textbox has focus. My guess is that first the Form event handler gets called, then the TextBox.

I've tried your code but it doesn't work.

Probably because you forgot to set KeyPeview property to TRUE as I mentioned in my previous post.

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

The database admin sent an email to everyone about a new antivirus program, the email stated something to the effect that if you want viruses then get this program. My reply was "I don't want it if it contains a virus". I meant to send it only to the db admin, but instead clicked Send All and it went out to about 200 people! Needless-to-say I got a few emails about that blunder :) The db admin wasn't amused.

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

You can do this from the Form level instead of a control like below. In the Form's properties you have to set KeyPreview to True for this to work

Public Class Form1

    Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.A Then
            Button1.PerformClick()
        ElseIf e.KeyCode = Keys.B Then
            Button2.PerformClick()
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        MsgBox("Hello from Button1")
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        MsgBox("Hello from Button2")

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

I did that once too, emberrising.

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

All c++ compilers mangle c++ function names (functions in *.cpp files), for example the function void foo() may be actuslly foo@4 in the object/library files. Since you are trying to mix C and C++ files you need to tell the c++ code that aft2dboundary() is a C function, not a c++ function. This is how to do that

// main.cpp
#include <aft2.h>

extern "C" void _cdecl aft2dboundary(int *, double*); // <<<< function pro9totype

int main()
{
   // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is a better and easier solution. Note: you will also have to press the <Enter> key becuse C does not have a standard function to just get a single key. You could use functions in conio.h to do that, but be warned that not all compilers support that because it's non-standard.

int main()
{
    int quit = 'N';
    while( quit != 'Q' )
    {
        // do something here

        printf("Do you want to continue? (Press Q to quit)\n");
        quit = getchar();
    }
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Of course you can do it in your program, there are lots of tutorials thatg show how to connect to a database and run sql commands. Here is a small list of them.

In the case of the DateTime picker, there should be an OnClick event in which you put the code to query the database.

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

The package you downloaded should contain a *.lib file, you need to tell the compiler/IDE that it needs to find the function in that library.

There are a couple ways to do it

  1. In one of your *.cpp files add this to near the top of the program, after all includes
    #pragma comment(lib,"somelib.lib") Replace somelib.lib with the actual name of the librarfy

  2. Go to Project --> Properties (bottom of the menu) --> Configuration Properties --> Linker --> Input. On the right side is "Additional Dependencies". Add the name of the library there.

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

You need to learn about pointers, malloc() (for dynamic memory allocation), FILE* (for file i/o), scanf() or fscanf() to replace cin, and printf() to replace cout. Read (google) a C tutorial and you will learn how to do all those things.

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

I always copied it into an unsigned char 4-byte buffer

DWORD dwValue = 123;
unsigned char buf[sizeof(DWORD)];
memcpy(buf,&dwValue, sizeof(DWORD);

Or you could just typecast a pointer
unsigned char* ptr = (unsigned char*)&dwValue;