|
ok now I am wasy confused!!! I need to go to the mental block ward!! So would I use a while statement...my only problem is is that i don't know how to use it in an error statement message....while (startTime>=60) ....but that would give me every number above 60 as an error..... I still don't get it....I'm so sorry to be such a pain!!!
Autumn
|
|
|
|
|
ONLY the 60...only the 60 and above for minutes.!!!I'm going crazy!!!!
Autumn
|
|
|
|
|
I'd use a do-while, then have it run while the number of minutes > 59. Thus it will keep asking until a valid time is entered.
Autunmsky wrote:
an error statement message
What do you mean by this ? You want to use cerr ?
Autunmsky wrote:
but that would give me every number above 60 as an error.....
No, strip it into minutes and hours first, then check the minutes. The bit I entered to do that may be confusing, but basically an & ( a bitwise and ) only stores values common to both. Therefore it will only return the portion of the number that is < 100, which is the minutes.
So 1102 & 99 = 2, 34534535023 & 99 = 23, etc.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
ok this is what the sheet says.....
use an additional error checking loop to validate the start time. The start time is valid if it is in the range between 0 and 2359, inclusive, and if the last 2 digits of the start time are not greater than 59. Print an error message and continue to ask the user for a valid start time until the user enters a valid one....
Autumn
|
|
|
|
|
Well, that's exactly what I've been advocating. The steps are
create the variables and initialise to 0.
start a do...while loop, and ask for the value.
use the bitwise and to strip the value into hours and minutes.
check if the minutes > 59, if so, print an error message
close do..while loop, the while condition is if our minutes > 59 or < 0. Remember this is a scope outside our loop, that's why we created the variables used first.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hey, I am having a problem with CreateBitmap. I found in some code where this function gets called. It is inside a DLL written in C. It uses a video file created from the waveform of a .wav file. When I have a wav file that is over 42 minutes long (which means it is a BIG file), this function seems to fail for some reason. I call this function with a Width, Height, 1, 1, and basically a pointer to -1 (I know this might seem weird but this is how it has always been). I did GetLastError and returned an 87, meaning "The parameter is incorrect". The parameters never really change except for the width, on .wav files that are over 42 minutes long the width is 33000 and higher. I thought an integer could hold this value, am I wrong? Could it be something else????
|
|
|
|
|
I suspect that you've answered your own question - I reckon that the bitmap being created is simply too big. However, your last parameter should most definately be 0 (NULL), and not -1.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Okay, if the bitmap is too big, any idea why it would be giving me the incorrect parameter as the last message? I did do a little more testing and it seems to all depend on the width. Sometimes, it will pass in 21000 and it will create the handle. Other times, 21000 will be passed in and it will fail. Why would it fail, any thoughts????
|
|
|
|
|
Windows will not allow you to create bitmaps over a certain size, therefore if you go over that size limit, 'incorrect parameter' is a correct, if not very helpful, thing to return. I remember this came up when I was writing a paint program. It's possible that the bigger the bitmap, the less *likely* it is to be able to allocate that block of memory. I don't know the details, I only know there *is* a limit.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Okay, thank you very much for all the information.
|
|
|
|
|
Hi,
I am using Direct Animation in my MFC MDI project, I create it like this
CWnd m_ctl.CreateControl( "DirectAnimation.DirectAnimationIntegratedMediaControl.1", "DAWindowedControl", WS_VISIBLE, rc, this, 101);
but when I use it to display animation, it seems it dose not update the screen, it is updated when resize the child window. Do you know how to solve it?
You can download the program at http://billhao.diy.163.com/main.exe, then click the icon A in toolbar to see the result.
Thanks
bill
|
|
|
|
|
At a guess, you need to add the WS_CHILD style and possibly some others as well to get your window working correctly.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
I have added WS_CHILD and some other style, but it still dosen't work. Any idea?
bill
|
|
|
|
|
pls help me!
Thanks.
bill
|
|
|
|
|
hello @all,
i have an access data base and a dialogbased program.
to connect the program with the data base i used odbc.
Then I have a CRecordset class for the data base.
Finally I want to register now something into my data base.
I make an object of the data base:
CDatabase db;
db.Open();
Now I want, that the first line of the column x has the value 1.
db.m_x=1; (i tried that, but it doesn´t work)
what´s wrong?
Thank you in advance.
|
|
|
|
|
there are 2 way to do what you want.
1) add new class to your project derived from CRecordset and in wizard get the table you want. then work through this class
CMySet set(&db);
set.Open();
set.AddNew(); // or set.Edit();
set.m_x=1;
set.Update();
... etc...
2) use SQL-queries
db.ExecuteSQL(strSQL);
Dmitry Timin
|
|
|
|
|
thanks for reply.
what do you mean with: add new class to your project derived from CRecordset and in wizard get the table you want?
normaly i make it like this:
i add a new class in my project (CRecordset, name: CDatabase) and choose the table i want.
then i make this:
<br />
CDatabase db;<br />
db.Open();<br />
db.Edit();<br />
db.m_x=1;<br />
db.Update();<br />
db.Close();<br />
i get the error in my program, that there is no current data record.
then i tried you second idea
use SQL-queries
db.ExecuteSQL(strSQL);
but it doesn´t work, because CRecordset doesn´t know 'ExecuteSQL(...);', i think.
please can you help me?
|
|
|
|
|
do not name your class CDatabase, because CDatabase is a MFC-class and it's the best way to connect to database through CDatabase.
then you create CRecordset-derived class and pass a pointer to database as a parameter.
ExecuteSQL(...) is a method of MFC CDatabase class.
class CMyApp: public CWinApp {
CDatabase m_db;
};
BOOL CMyApp::InitInstance()
{
m_db.Open(...);
}
void CMyView::Func1() // or something else
{
CMySet set(&theApp.m_db);
set.Open(...);
// etc...
}
Dmitry Timin
|
|
|
|
|
I've created a project, mfc.exe type, that will link in several static libraries located in the same workspace. Each library will be a CWinthread derived class that could be the home for a dialog box and its controls. The controls I would like to update from any of the other threads.
I have been able to get a dialog box to appear from a thread class but have not been able to get a control to update like static text.
Here's kind of the flow:
main
{
afxbeginthread (lcd, ...)
lcd->startup
lcd->display(string)
...
}
lcd::startup
{
Startup dlg
dlg.DoModal
...
}
lcd::display(string)
{
dlg.display(string)
...
}
CStartup::display(string)
{
SetDlgItemText (IDC_TEXT1, string)
...
}
If you know of a link to a page with info about what I described or have a comment, it would be appreciated.
Thanks,
Clay
|
|
|
|
|
main
{
afxbeginthread (lcd, ...)
lcd->startup
lcd->display(string)
...
} The problem lies in the bolded line. Executing lcd::startup from the main thread does not cause the thread to actually execute this function --it is th main thread that executes it instead. So, you're creting a thread and then launching a modal dialog box in the context of the main thread. No wonder, the app won't reach the next line (intended to change the static text) until the dialog has closed!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
>Each library will be a CWinthread derived class that could be >the home for a dialog box and its controls. The controls I >would like to update from any of the other threads.
Try using the PostThreadMessage function of your CWinThread-derived class. Your class should have a message handler for the message (lookup: ON_THREAD_MESSAGE )
Bijesh
--------------------------------------------------
|
|
|
|
|
I need a folder / file search dialog - I am aware of CFileDialog, but this won't return folder paths, only file paths. Is there any other class which will give me this combined function ? (The folder search is often used in installation programs, so I guess something standard must exist)
Doug
Doug
|
|
|
|
|
Check SHBrowseForFolder out.
Oops. This will only work for selecting folders, not both folders and files.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for pointing out SHBRowseForFolder(). (As a last resort, I can use both CFileDialog AND SHBroweForFolder() ) However, I'm currently trying to compile the following:
BROWSEINFO bi;
:SHBrowseForFolder(&bi);
I have included ShellApi.h but am getting C2065 on BROWSEINFO. (I originally found BROWSEINFO declared in shlobj.h and thought that ShellApi.h would fix the problem but it doesn't !
Where am I going wrong ?
Doug
|
|
|
|
|
I am inexperienced with Spy++, and I have searched the MSDN site and read and re-read the Help Docs that come with Visual C++, and, I cannot get the the message log to save to a log file. I suspect that I am doing something incredibly dumb, something that would be obvious to some of you more experienced coders. Also, when operating Spy++, I get what appear to be spurious messages (I have the Introductory Edition, so maybe this normal). Anyway,...
I launch Spy++, click on windows (from the menu) and select a window, then select messages, at which point I get a popup message box telling me that some other process is logging the messages in that window. If I move the cursor into the selected window, the log starts and I get a rapid-fire list of cursor and hit test messages (these are actually the correct mesasages). Then I select Options and the Output tab I check the save log to file (or something like that), and provide a path, and check OK. The file always shows up at the location specified but empty, and sometimes I get an invalid log file message (and sometimes I don't). I searched for information on what a valid file type would be and came up with nada. I am typing in a typical pathname, like "C:\Folder Name\File Name.ext" (without the quotes). Would this be a log or text file, or does it even matter?
Do any of you people use this feature? If so, how does it work? I would appreciate any useful information. Thanks.
|
|
|
|
|