|
It's because you're running this in a loop.. it doesn't wait for the song to play/end, it starts playing the song then goes to the top of the loop and starts all over again until it gets to the last item in the loop.. you need have the loop wait until the song ends or even better yet in your timer function wait until the song ends.. then if another song exists in the playlist start it.
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Hi,
I want to read version number and company name from RC File at run time.
How can i do this ?
Thanks in advance
|
|
|
|
|
If you mean "read version information from the resources of a module at runtime",
then you can use GetFileVersionInfo (...). You can even use it on the calling
module by using GetModuleFilename to get the path to use.
There is even an article "ShowVer.exe command-line VERSIONINFO display program"[^]
with example code.
If you really mean from an .RC file, then just read it as text and parse
it.
|
|
|
|
|
another way is to load the resource section by calling findresource and loadresource.
Don't try it, just do it!
|
|
|
|
|
I am writing a software, it needs hide itself and capture a snapshot of the screen. It works well normally, but when system is busy, sometimes, the window of my program has not been hiden or the background has not been repainted but my program does not know that, the snapshot is taken even the screen is not updated yet.
I just use
ShowWindow(hwnd, SW_HIDE);
UpdateWindow(hwnd);
to hide my window. But I don't know when Windows will repaint the screen, how to wait until the background covered by my program is repainted by Windows?
|
|
|
|
|
Hi Daniel,
your problem is, that the paint-function from windows are message-oriented. The hiding of your window take a WM_PAINT message in the message-queue from all other windows which are behind your window. That is the problem, you don't know when all the other windows processes the WM_PAINT message.
My two solutions:
1) bad but simple, let "sleep" your application after ShowWindow() for some milliseconds, e.g. Sleep(100)
2) Write a global Keyboard-Hook (like other programs which takes a snapshot).
Regards
Frank
|
|
|
|
|
I'm looking for a way to save data in the Windows BMP format. The code should run on Unix platforms, too, so API functions are not applicable.
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
Bitmap format is pretty simple. You will need to define all structures (BITMAPFILEINFO, BITMAPINFO, etc.), then just fill them right and save to disk. Look up for more information on structures in MSDN[^]
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Hi to all,
I need sources for programming external devices, actually I have to make a program to control electronic circuit boards... I collect some info from the net and I think it is easier to reach circuit boards with serial ports. Finally I guess there are some resources out there and if someone post these, I really will be gratefull to him/her...
Thanx in advance.
Not: I need these resources for our project (to add real physics to our robot project in school)...
|
|
|
|
|
There are a few Serial Communications classes around here (in codeproject) that help you have access to a serial port. You could search for them (I would give you the links but I don't remember where they are. I also need to go to bed, I am very tired). But, being an electrical engineer myself I have always programmed devices by dumping the binary the code into eeproms (assembly code), so serial communications were not always required. (I don't know your project specifications so I better stop here).
Good luck with your project!
Here are three links by the way (since you are a fellow engineer) :
http://www.codeproject.com/useritems/chaiyasit_t.asp?target=serial%7Ccommunication
http://www.codeproject.com/system/cserialcom.asp?target=serial%7Ccommunication
http://www.codeproject.com/system/serial_com.asp?target=serial%7Ccommunication
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Read the manual of the device carefully. Maybe there is a API for the device. Also ensure that the device is installed properly and the OS is supported.
To tell a long story short: RTFM
PS: I have done this over and over with modems
Try this @ home. (B&B)
|
|
|
|
|
You know what? KarstenK is right.
But at the same time, to save you the trouble of learning windows programming (if you don't know any) and in case the device is designed by you or it doesn't have an API interface, just use plain MS-DOS and functions such as outp() to send data through a serial port.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I am using VC6 - MFC
I designed a dialogbox in DialogEditor ...... and
I want this dialogbox will be my MDI child window of main MDI window!
So I mean, I want design interface (put controls to window: edit, button...) for all my MDI child window in Dialog Editor
, not by code (design by coding is slower than design by DialogEditor)
thank you!
|
|
|
|
|
When you are create an application using AppWizard, choose MFC AppWizard.
On page 1 of 6, choose "Multiple Documents" / MDI.
On page 6 of 6, choose CFormView as the base CView class.
Choose other options sensibly.
This will give you an MDI Formview application. Now just change the dialog
the form uses to match the one you've already made elsewhere.
Tada!
Iain.
|
|
|
|
|
I want to evaluate each option's value in a dropdown listbox,but I don't know how to use the function get_options of IHTMLSelectElement.
I try this:
IHTMLElementCollection *lpCol=NULL;
IHTMLSelectElement *lpList=NULL;
IDispatch *lpDisp = NULL;
//init lpList
lpList->get_options((IDispatch **)&lpCol); //this doesn't work!!!!!!!
and
lpList->get_options(&lpDisp);
lpDisp->QueryInterface(IID_IHTMLElementCollection,(void**)&lpCol); //doesn't work either.
please help me!!
Thanks in advance!
Alan Shen.
|
|
|
|
|
Hi,
My application has many dialog box, and I use the following code to go from one to another..
CcamsetfinDlg dlg8;
CcsettDlg dlg2;
CsettDlg dlg3;
Ctstdlg dlg4;
CtmpsetDlg dlg5;
CtmrsetDlg dlg6;
CSimpletonDlg dlg;
//m_pMainWnd = &dlg; //I removed the line or else the dialog vanishes immediately
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{m_pMainWnd = &dlg4;
dlg4.DoModal();
}
else if (nResponse == IDCANCEL)
{
INT_PTR pRet = -1;
pRet= dlg3.DoModal();
if(pRet==5)
{
m_pMainWnd = &dlg8;
pRet=dlg8.DoModal();
}
if(pRet==0)
{
m_pMainWnd= &dlg4;//
dlg4.DoModal();
}
The problem is the dialog box pointed by &dlg4 in the above if loop pops up and vanishes immediately.I had this problem with the first dialog box, but got over it as I got a suggestion that I should remove the line m_pMainWnd = &dlg; which I have quoted as a comment statement. Please help me in this regard.
Thanks.
Deepak Samuel
|
|
|
|
|
Hi,
from which type is your application? (e.g. dialog-based)
Why do you set the m_pMainWnd variable to current dialog? Because if your application dialog based and the m_pMainWnd = current dialog and the dialog close, then the application get a "signal" that the mainwindow is closed and the application terminates itself.
Regards Frank
|
|
|
|
|
Right. While not exactly the same, I bet it is closely related to MSDN article Q138681.
|
|
|
|
|
There is an article about "Dialog Tips & Trics" on CP.
read it!
I guess its because m_pMainWnd
|
|
|
|
|
How can enumerate LPT ports on machine?
If possible, with sample code please.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
i don't know anything about coding with LPT ports...
but try this:
char buffer[32];<br />
unsigned int i;<br />
HANDLE hPort;<br />
<br />
for( i = 1; i < 10; i++ )<br />
{<br />
sprintf( buffer, "LPT%i", i );<br />
hPort = CreateFile( buffer, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL )<br />
<br />
if( hPort == INVALID_HANDLE_VALUE )<br />
break;
<br />
CloseHandle( hPort );<br />
}<br />
Don't try it, just do it!
|
|
|
|
|
Your question intrigued me, as not long ago there were a series of articles / questions on
how impossible it was to enumerate serial ports...
I've done a little digging, and there are two functions that should interest you:
EnumPorts and EnumPrinters.
Here is some sample code for each:
DWORD dwNeed = 0;
DWORD dwPorts = 0;
BOOL b = EnumPorts (NULL, 2, NULL, dwNeed, &dwNeed, &dwPorts);
if (!b && GetLastError () == ERROR_INSUFFICIENT_BUFFER)
{
BYTE *buf = new BYTE [dwNeed];
memset (buf, 0, dwNeed);
PORT_INFO_2 *p = (PORT_INFO_2 *)buf;
b = EnumPorts (NULL, 2, buf, dwNeed, &dwNeed, &dwPorts);
delete [] buf;
}
dwNeed = dwPorts = 0;
b = EnumPrinters (PRINTER_ENUM_LOCAL, NULL, 1, NULL, dwNeed, &dwNeed, &dwPorts);
if (!b && GetLastError () == ERROR_INSUFFICIENT_BUFFER)
{
BYTE *buf = new BYTE [dwNeed];
memset (buf, 0, dwNeed);
PRINTER_INFO_1 *p = (PRINTER_INFO_1 *)buf;
b = EnumPrinters (PRINTER_ENUM_LOCAL, NULL, 1, buf, dwNeed, &dwNeed, &dwPorts);
delete [] buf;
}
You may also want to look at EnumMonitors, and the results different report levels give.
Iain.
|
|
|
|
|
Thank you. That's all I need
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Hello, everyone!
If I want to ask question about C/C++ under Linux environment. Can you introduce some forums?
regards,
George
|
|
|
|
|
this is a windows site
Don't try it, just do it!
|
|
|
|