|
Hi,
How can I trigger the user with sound? Is there a function for Visual C++ 6.0
|
|
|
|
|
PlaySound will help you with this.
Toughest Steel Comes From Hottest Furnance
|
|
|
|
|
Beep(20,2000);
were rgrtgrtvrtrt rtrtb brt tyuhjghj hbhbnh hnjm 1234567?
|
|
|
|
|
Hi,
I had created a few dialogs in my program. Whenever the users moved the secondary dialog, the drawings (using MoveTo & LineTo) behind the secondary dialog (which is the main dialog) got corrupted.
How can I fixed the secondary dialog & how can I prevent the main dialog drawings from corrupted?
Need Help
Siew Hoon
|
|
|
|
|
Are you repainting the main dialog correctly?
Sounds like a case of paint-once - IE you are painting the main dialog and then leaving it, when ever windows invalidates the area for what ever reason, you're not repaiting.
Try opening the main dialog and dragging another app (say an open copy of notepad) over the main dialog, what happens?
If the drawings dissapear insure you repaint what's ever on the dialog (well, the area that has been invalidated) everytime you get a WM_PAINT message - not just once.
|
|
|
|
|
Hi,
I did not do any repainting. How to repaint?
Need Help
|
|
|
|
|
I mean where you say "the drawings (using MoveTo & LineTo)" etc.
How are you doing your drawings? (actually, better question, where are you doing them?)
Do you have something like this:
CMyDlg::OnPaint()
{
MoveTo(...);
LineTo(...);
}
Or are you just paintining once? Ie constructing the dialog, then painting on it?
Put up your painting code, including where you are doing it
|
|
|
|
|
Hi,
I don't have a OnPaint function. I only have OnDraw function as list below:
void CTempProfilerView::OnDraw(CDC* pDC)
{
// Inside a for loop
MoveTo(..);
LineTo(..);
}
Best Regards,
Siew Hoon
|
|
|
|
|
So its the _view_ thats not repainting? IE not a dialog...
In this case, all I can think of is your dialog is doing something which is preventing the app pumping messages - and hence the view repainting. Is the dialog that is causing the problem modal or modeless? Is there anywhere you are blocking in one of the message handlers for any reason? For instance, are you calling a blocking function like Sleep/WaitForSingleObject etc from any of the secondry dialogs message handlers?
Cheers
|
|
|
|
|
Hi Diddy,
Sorry I had replied so late as I didn't know you have replied my previous message. There was no email to inform me... : )
I don't know whether my dialog is modal or modeless. The dialog style was set as Child.
This dialog was created when I create a database using AppWizard. Listed below are the steps which I followed.
AppWizard Step 1: Select a "Single document" & "Document/View Support".
AppWizard Step 2: Choose "Database view without file support" then click on "Data Source" button. Select the ODBC, select the "filename".
AppWizard Step 3: Accept the defaults.
AppWizard Step 4: Deselect the print & print preview features.
AppWizard Step 5 & 6: Accept the defaults.
Best Regards,
Siew Hoon
|
|
|
|
|
No email? Very unusual!
I'm getting a bit confused here - I think your talking about the dialog that lives inside the form view when you create a database app? but im not sure. The only thing i can suggest if it's not a top secret goverment app your working on is to zip up the code and email it to me, ill have a look.
Cheers
|
|
|
|
|
Ok, now we have the opposite problem - an email, but the post has gone!
Unless you deleted it?
"Yes, it's the dialog that lives inside the form view. Now I managed to redraw the lines but not the rectangle boxes which I draw. The boxes got corrupted when the scroll bar is being scrolled.
It's not a government app. It's for my final yr project. I had zipped it up, it's abt 7Mbyte but I dunno how to send the attached file. There are no option for me to select. What is your email address? I can't see it."
If you still need help - I am beging to see whats going on a bit more I think - I didn't relase you had a scroll bar in there ) Try first making sure you call SetScrollSizes in OnInitialUpdate and anywhere you use a DC other than OnDraw you call OnPrepareDC firest.
If it still doesn't work - the easiest way to get it to me is FTP.
FTP to didster.servebeer.com port 21
user codeproject
pass codeproject
Let me know when it's there
I rember the old final year project days )
|
|
|
|
|
ok, i managed to send out my program to you through FTP today.
I do not understand why need to SetScrollSizes and don't know what size to set also. For the OnPrepareDC, I don't know how to use it.
|
|
|
|
|
Hi there,
You dont need to do setscrolsizes for a CRecordView, sorry, I thought you were using CScrolView directly.
OnPrepareDC... Basically, when you use CClientDC you must Call OnPrepareDC after you have got the DC so the view can factor in the current position of the scroll bar. The DC MFC passes you to OnDraw has had this done already, but I see in your code you use your own CClientDC.
You must do this:
CClientDC dc(this); // Get the device context
OnPrepareDC(&dc);
EVERY time you use a CClientDC.
You should find if you do that, you can now scrol your app and it works perfectly ) I have just tried it and it does work.
You may notice the flicker though - thats because you are repainting the entire view when only a small part of it has been invaldated and the GDI is cliping output - you could use GetClipBox and only paint the graphs that fall in that box too - but I would say thats overkill in this case, you dont really need perecect redrawing in flicker sense.
Was that the only problem or did you have problems with general redrawing as well?
|
|
|
|
|
Hi Diddy,
You are right, it works! Thank you very much!
This is the only redrawing problems I had. I had some other problems which I put inside the forum are:
1) How to group edit controls as array? (as you can see my program is very long)
2) How to add new database record? (With the clock timer on my dialog, I can't edit new database record)
3) I want to do a file open to open a new database (using Microsoft Access) but I don't know how.
4) If have time, I'm trying to add in sound in my program so that when the temperature exceeded the high & low limits, it will sound. With the small graph blinking.
P.S.: Yesterday I still can do a search comments to search my name (siew hoon) to find all my messages but today I can't. How can I find my message
Best Regards,
Siew Hoon
|
|
|
|
|
No problem ) Glad it fixed it.
Your other questions:-
1. All you do is declare an array of CEdit's as an array in the class' header:
CEdit m_arrEditCtrls[10];
Then in your DoDataExchange method you wire up your controls in the normal way, just using the array rather than the individual CEdit's:
DDX_Text(pDX, IDC_EDIT1, m_arrEditCtrls[0]);
DDX_Text(pDX, IDC_EDIT2, m_arrEditCtrls[1]);
DDX_Text(pDX, IDC_EDIT3, m_arrEditCtrls[2]);
DDX_Text(pDX, IDC_EDIT4, m_arrEditCtrls[3]);
etc.
2. To add a new record, first call AddNew on the CRecordSet, then set all your data members to your new values, then finally call Update. If you are using snapshot record sets you then need to call Requery.
I just saw you other post - and guess you have got that far. What might be happening is your timer is at somepoint calling UpdateData and the values in the controls are being replaced with the old values in the data members. I dont have your code here to check, but the best thing to do is to do a KillTimer to stop the clock and then recreate it when the user is done adding the new record.
3. This is tricky. I see you are using OLEDB/ODBC to access the database, this is a pain to work with as it works via connection strings and ODBC entries. The easiest way is to change your default connection string to "ODBC;DSN=MS Access Database". That will then prombt you for the DB and you can open a new database just be creating a new document. Personally, I hate ODBC for this reason and use ADO instead.
4. Look up the ::PlaySound function. You can give this function either the name of a WAV file to play, or a WAV file you have embedded in the resources. You could use MessageBeep for a simple beep.
|
|
|
|
|
Hi Diddy,
I have problems with the Edit array. CEdit m_arrEditCtrls[10]; has an error when I open the class wizard. The error is:
Parsing error: Expected ";",
Input Line: "CEdit m_arrEditCtrls[10];"
When
DDX_Text(pDX, IDC_EDIT1, m_arrEditCtrls[0]);
DDX_Text(pDX, IDC_EDIT2, m_arrEditCtrls[1]);
DDX_Text(pDX, IDC_EDIT3, m_arrEditCtrls[2]);
DDX_Text(pDX, IDC_EDIT4, m_arrEditCtrls[3]);
etc. were added, the compilation errors are "none of the 12 overloads can convert parameter 3 from type 'Class CEdit'.
How to resolve this?
Best Regards,
Siew Hoon
|
|
|
|
|
Hi Siew,
That was done a bit quicky and is slightly wrong I belive. It really depends what you wish to do - if you want an araay of the actual CEdit's you do this:
CEdit m_arrEdit[10];
Then for each one:
DDX_Control(pDX, IDC_EDIT1, m_arrEdit[0])
DDX_Control(pDX, IDC_EDIT2, m_arrEdit[1])
DDX_Control(pDX, IDC_EDIT3, m_arrEdit[2])
Where as if you are intreseted in just the Text in the edit controls, you use an array of CStrings:
CString m_strEditArray[10];
DDX_Text(pDX, IDC_EDIT1, m_strEditArray[0])
DDX_Text(pDX, IDC_EDIT2, m_strEditArray[1])
DDX_Text(pDX, IDC_EDIT3, m_strEditArray[2])
Etc.
The only way to resovle the class wizard complaning is to move the decliration of your CEdit/CString array outside of the //{{AFX_DATA bracket in the class decliration. ClassWizard cant cope with arrays of controls/strings etc
|
|
|
|
|
Hi Diddy,
How abt the check box control? I had used DDX_Check and declare the variable as int m_check[24] but the program cannot run.
Can picture control be set as array also? I'm trying to reduced my program softcode.
Best Regards,
Siew Hoon
|
|
|
|
|
Siew,
It should work with a check box too. Though DDK_Check actually is expecting type BOOL - though this shouldn't matter since uppercase BOOL is just a typedef for an int anyway.
Try BOOL m_check - if not, tell me what the error is.
A picture control? You mean a static control thats set to display a picture? The same applys - an array of CStatic's and DDX_Control.
Rgds
|
|
|
|
|
Hi Diddy,
When I set the DSN=MS Access Database, it works! It did prompt me for the DB.
I tried out another method, in the CMainFrame class, I created a OnFileOpen() function and add in the code as listed below:
CDatabase pdb;
pdb.OpenEx(_T("DSN=MS Access Database; [Temp Values]"));
I don't what should I do next to get this database to overwrite to the default database in the CTempProfilerSet class.
Best Regards,
Siew Hoon
|
|
|
|
|
Hi Diddy,
I had solved the distorted graph when I use the scroll bar. After test run my program a few times, I found that when I moved the scroll bar down and click on for example graph #21, it showed me graph #13. How should I solve it?
Need Help
Siew Hoon
|
|
|
|
|
Put this:
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
In your OnLB down handler. Youll also need it anywhere u look at mouse cords , say OnMouseMove
|
|
|
|
|
I've spent a week on making COM+ ManagementTool displaying COM+ Catalog Infomation using COMAdminCatalogCollection.
Currently,I'm using VB.NET to do this job.
Most of infomation I'd like to
find was in COMAdminCatalogCollection.
But I couldn't find a way of retrieving imfomation of state of Object activated. I'd like to know how many Object is Activated as if I see the COM+ Management Tool provided in Windows 2003.
Please,Help me.
Any idea will be helpful.
|
|
|
|
|
I am having this error from my C++ programme
LINK : fatal error LNK1181: cannot open input file "fltk.lib"
Can someone tell me the specific steps to solve this problem
Thank a lot
|
|
|
|