Teen Programmers Unite  
 

 

Return to forum top

VC++ stuff...

Posted by Cortez [send private reply] at October 19, 2002, 10:47:30 AM

How can I use progress bars in VC++ 6.0? Is it something like in VB (pb.min=1, pb.max=100, pb.value=50...)?

Posted by buzgub [send private reply] at October 19, 2002, 09:27:52 PM

I can't help but suspect that you probably CreateWindow a progress bar, then SendMessage an increment message of some description to it.

I'm sure MSDN can give you more information.

Posted by CodeRed [send private reply] at October 21, 2002, 12:00:47 AM

Yeah, it's nothing like VB, and it has nothing to do with your compiler eathier, read up on the windows API

Posted by Cortez [send private reply] at October 22, 2002, 05:12:58 AM

Well, thanks anyway. I first tried MSDN, but i couldn't find the stuff about VC++ 6.0 (the exampes are 7.0...).On the other hand, I have a new problem. Well, here what I want to do:

a dialog that (right after it's called with DialogBox(hInst, (LPCTSTR)IDD_SOMETHING, hWnd, (DLGPROC)somebox)) runs the, say zip function (it will handle the progress bar, it's OK) and after the function completes, ends itself. Well, i tried something like this:

LRESULT CALLBACK somebox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

switch (message)
{
case WM_INITDIALOG:
return TRUE;
break;


deafult:
zip(szFileName, szFileName2, password);
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
return FALSE;
}

But no, it's making an infinite loop. Hell, i still don't understand why. This not like dos c programming...

Posted by buzgub [send private reply] at October 22, 2002, 06:31:33 AM

You're right, it's not.

It looks to me like every single message that gets to your dialog that is not a WM_INITDIALOG will lead to compression starting. Surely that means that if you move the dialog, move the mouse over the dialog, or try to do practically anything else, it will start zipping. You probably want to have a button that causes zipping to start, not a magic "do-anything" switch.

Posted by CodeRed [send private reply] at October 22, 2002, 10:37:38 AM

You didn't cut and paste that code did you? because default is spelled wrong, wouldn't that be funny if that was your only problem LOL.

"i couldn't find the stuff about VC++ 6.0 (the exampes are 7.0...)"

Once again, it doesn't matter. You're compiler has little if anything to do with Win32 API code. And Buzgub is right, all that does is start the compression process (assuming that is what the zip() function is used for) Here, add this control to your dialog box or something similar:

OkayBTN   "&OK",IDOK,174,18,50,14
CancelBTN "&Cancel",IDCANCEL,174,35,50,14

Then add this to your message handler
case WM_COMMAND:
    switch(LOWORD(wParam))
    {
        case IDOK:
            zip(szFileName, szFileName2,password);
            EndDialog(hwnd, IDOK);          
        break;
        
        case IDCANCEL:
            EndDialog(hwnd, IDCANCEL);
        break;
    }
break;
Posted by Cortez [send private reply] at October 23, 2002, 11:49:16 AM

No, i didn't copy-pasted it. Thanks, but i know how to make and use a button. All i asked is that the window starts the zip function and after the function finishes, makes a self destruct. (this is just a progress bar dialog box that will tell the user about the process. i can add the progress bar stuff later) And I'm not a experienced programmer unlike many here, sorry if I sound very lame, guys...

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.