PDA

Click to See Complete Forum and Search --> : 4 Easy questions from a beginner to help add to your Post Count


V(ery) Basic
Aug 20th, 2000, 09:07 AM
Thank you.

I'm giving examples of how you would do the same thing in VB to make the questions clearer.

1) How do I append a Null to a string? (VB: 'strX & vbNull')
2) How do I generate a random number? (VB: 'Rnd')
3) How do I redraw evrything on the form automatically (you know without having to put everything in WM_PAINT (Do I set CS_SAVEBITS to the WNDCLASSEX thing to pass to RegisterClassEx or is ther a better way)? (VB: 'Me.Autoredraw = True')
4) Is there a way to create a static variable (local to a function)? (VB: 'Static MyVar As Long')

Sorry for my complete ignorance (I started C++ a few days ago). I know I'm ambitious, but the more I'm told, the more I learn. ;)

Thank you all. But not you in particular.

parksie
Aug 20th, 2000, 10:06 AM
1. Strings are by default null-terminated in C++. For example, these do pretty much the same thing. They are different, though, in a very complicated, low-level way.

char* mystring = "My Str";
char mystring[] = {'M', 'y', ' ', 'S', 't', 'r', '\0');


2. I think there's a rand() function defined in stdlib.h

3. I don't know.

4. Just use static:

void myfunc(int iNum) {
static int myInt;
myInt += iNum;
}

Aug 20th, 2000, 10:06 AM
Use the RedrawWindow or UpdateWindow function.
Also, keep in mind that redrawing is painting it.

parksie
Aug 20th, 2000, 10:09 AM
I think that for the AutoRedraw stuff, VB itself stores the bitmap and blits that back again, rather than anything in the API.

V(ery) Basic
Aug 20th, 2000, 12:31 PM
Originally posted by parksie
I think that for the AutoRedraw stuff, VB itself stores the bitmap and blits that back again, rather than anything in the API.

That's what CS_SAVEBITS does (saves a bitmap and then puts it back)

Thank you, bozos, you've helped a lot. You'll see. One day I'll be able to do something without having to look through MSDN, and then post a quetion here if I can't find it there.

Originally posted by, well, me
One day


multos grazias