|
|
Thank you Michael. I added the derectory in the resource page too. Simply building the exe didn't work, so i am rebuilding the whole project again. It's a big project, so takes some time to compile. I hope it works, or I am doing something else also wrong.
Ankita
|
|
|
|
|
Ok this might seem like an obvious/stupid question but is there any way to play videos in C++ graphics? I'm using Codewarrior IDE (Learning Edition). I'm only in my high school programming class learning C++ cause our teacher doesn't teach us java. I know you can play wav files using PlaySound(). Is there anything as simple or not difficult to use to play a video? I'll convert it if need be.
|
|
|
|
|
|
Hello,
I need to implement a timer in my application. Upon receipt of a message, the application needs to wait for a specified period of time informing the end user and then continue. So I implemented the timer with setTimer() and processes the WM_TIMER message, updating the dialog for the user. When the speicified timer interval has expired, I issue killTimer(with Id) and close the dialog.
To test this from my CNotifyTimerApp::InitInstance(), I send a message like this:
AfxGetMainWnd()->SendMessage(...);
// Just to see when this gets displayed
MessageBox("After sending message");
to the mainframe class which will do as mentioned above. It seems that after SendMessage(...), immediately the MessageBox appears.
This is not what I want. When the dialog is displayed to the user with the timer counting down information, I don't want the applicatino to continue untill the time has expired. From the above, I think that SendMessage returns immediately and is executing the next instruction!
Can someone help me with this? Is there a better way of achieving this?
Thankyou,
Murali
Murali
|
|
|
|
|
SendMessage just sends a message. There's no reason for it not to return right away. If that's what you're really trying to accomplish, I think you'd be better off using Sleep()
My Music | My Pics | My Articles
BlackDice
|
|
|
|
|
Calling Sleep in a UI thread is questionable as while the application is sleeping its windows will not be redrawn and such.
Steve
|
|
|
|
|
What I want to do is, when I get this message, I want to create a timer for 60 secs and display a dialog to the user with the timer counting down. During this time, the application should not be doing anything, just wait till the timer expires and then continue from there on.
Am I being clear enough?
Thanks
Murali
|
|
|
|
|
He's one way to do it. Make a dialog and add a static text control to contain the countdown. In the OnInitDialog (I'm assuming MFC here) handler start a timer like this:
SetTimer(1, 1000);
Add a handler for the WM_TIMER message with ClassWizard. In the handler you would do something like this:
afx_msg void CCountdownDialog::OnTimer(UINT_PTR nIDEvent)
{
CString s;
s.Format(_T("Time remaining: %d"), --m_TimeRemaining);
CWnd *pStatic = GetDlgItem(IDC_COUNTDOWN);
pStatic->SetWindowText(s);
if ( m_TimeRemaining==0 )
{
KillTimer(1);
}
}
This should get you started.
Steve
|
|
|
|
|
What is AfxGetMainWnd() returning? My MFC is rusty but I don't think the app's main window is created yet in CWinApp::InitInstance() . That code would do better in CMainFrame::OnCreate() .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hi Mike,
The app's main window gets created like this:
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CNotifyTimerDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CNotifyTimerView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
After this I issue the following (I could have also used m_pMainWnd, but this just for testing):
//send the message to the main frame to display the notification.
AfxGetMainWnd()->SendMessage(WM_NOTIFY_POWER_ON_TIME, 0, 60);
What I want to do is, when I get this message, I want to create a timer for 60 secs and display a dialog to the user with the timer counting down. During this time, the application should not be doing anything, just wait till the timer expires and then continue from there on.
Am I being clear enough?
Thanks
Murali
|
|
|
|
|
Hey everyone:
I want to copy the way say window1 is currently displayed (in terms of what has been painted).
This is becauase I now need to call a command that will send window1 to all black.
Now I want to paste in the way window1 looked, which I have copied in step1.
Please tell me there's a nice & easy way to do this,
`Chase (membos AT yahoo DOT com)
|
|
|
|
|
I use the the ftprenamefile command to rename the file at the ftp server site to the new file I want.
The error that I get from the returned error code is 12003. Can anyone tell me what is this and how to solve this error?
Thank you.
|
|
|
|
|
ERROR_INTERNET_EXTENDED_ERROR
An extended error was returned from the server. This is typically a string or buffer containing a verbose error message. Call InternetGetLastResponseInfo to retrieve the error text.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I am trying to create an event listener for a left mouse button event in c++. Does anyone have any idea how to create this so that I can register the listener at the beginning and then when the event happens it will call a function of what I want to happen. If this makes no sense let me know.
Thanks
|
|
|
|
|
If VC++ 6.0, use the ClassWizard and set up a member function for WM_LBUTTONDOWN.
If VC++ 7.1, don't use the Classwizard ('cause it 'taint there) and set a handler for WM_LBUTTONDOWN
If your using VC .NET, I haven't the clue. It's too safe for me anyway.;P
(In .NET it's probably in the System.Computer.Actions.Mouse.MouseActions.ButtonActions.PressedActions.LeftButton.Down namespace or something hideously long like that)
-- modified at 20:25 Wednesday 12th April, 2006
|
|
|
|
|
I need to get text from my Edit Controls, which are CString types, and convert them to char arrays which I later store in the header of my binary file. I can do this easily if I specify my character set to be Non Unicode and use strcpy . The problem when I do this is that all my dialogs and buttons revert back to the Windows 2000 style, rather than the WinXP style. It is not really a bid deal, but I would like the application to look as up to date as possible.
Can anyone tell me how to convert CStrings into char arrays, using Unicode, or how to get WinXP dialogs with a Non Unicode character set? What I am getting at may be a little vague so let me know if you need me to explain it in more detail.
Any help is appreciated. Thank you!
|
|
|
|
|
If all you need to do is copy the data from the CString and write it to a file, you do not need to copy the contents of the string to a non-const buffer. CString objects have a LPCTSTR operator, which means that you can use it in place of a const TCHAR * .
Since the CString class is TCHAR -based, it supports Unicode. You can convert the string to ANSI for writing it to a file using the ATL Conversion Macros (T2CA ) if the data is not too large, or calling WideCharToMultiByte(...) yourself with your own buffer(s).
Also, if you get into the habit of using the TCHAR -based string functions, you life may get easier (i.e. using _tcscpy(...) instead of strcpy(...) ).
Look up how to create (and optionally embed) a common control manifest file; that should help you with getting the XP-style controls back into the application when running it in ANSI mode.
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
|
hello Everyone,
I am a beginner in Visual Studio C++.
In all I have read till know I can't find an example of how to plot,
let say i have x=[1 3 7 ] and y=[7 9 10]
i want to build an application where i press the button PLOT and it plots y versus x in circle (or line) in and a given color
I would really appreciate your help.
thanks again
|
|
|
|
|
You have to research device contexts. All "plotting", or any graphical output for that matter, in Windows is accoplished through a device context.
CDC *pDC;<br />
<br />
pDC->MoveTo(x1, y1);
pDC->LineTo(x2,y2)
pDC->Ellipse();
pDC->Rectangle();
There are many more features to device contexts which should allow you to do what you want. Any good Visual C++ book should talk about DC and I know this web site has A LOT of useful examples.
Hope that helps.
Paul
|
|
|
|
|
ilda lapi wrote: I am a beginner in Visual Studio C++.
In all I have read till know I can't find an example of how to plot,
In addition to the post on DC, you can also change that context into either an OpenGL or Direct3D display, thus allowing you a full range of very low-level drawing functions.
and there are additional methods such as GDI+ depending on your needs. http://www.codeproject.com/miscctrl/pgllib.asp[^]
there are actually quite a few ways to do plotting through various frameworks to libraries.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
I have to develop a device driver for windows NT that will add a virtual audio device to the system. i need to hook up and capture the audio stream coming from microphone and send it to two differnt application. one sugesstion i got from Kakan is to develop a filter driver.
Now can a filter driver be used to install a virtual device.
there are MSVAD sample drivers in DDK. are thay filter drivers?
can i use those sample codes for my work.
saad
|
|
|
|
|
Hi,
I have a line that I want to key as follows:
m_Query.Format("select Route_ID
Stage_ID,
Price,
valid_from,
valid_to,
Price_Key
from TicketPrice
where Ticket_Type = '%s'
FOR UPDATE", m_selected_id);
However I get C2001 newline in constant messages from the compiler. Anyone know the line continuation symbol?
Ger
|
|
|
|
|
Ger Hayden wrote: Anyone know the line continuation symbol?
You can either use the backslash character like:
m_Query.Format("select Route_ID \
Stage_ID, \
Price, \
valid_from, \
valid_to, \
Price_Key \
from TicketPrice \
where Ticket_Type = '%s' \
FOR UPDATE", m_selected_id); or enclose each string in quotes like:
m_Query.Format("select Route_ID "
"Stage_ID, "
"Price, "
"valid_from, "
"valid_to, "
"Price_Key "
"from TicketPrice "
"where Ticket_Type = '%s' "
"FOR UPDATE", m_selected_id);
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|