|
Hi ken
I've done something you want to do.
My Way : in OnNewDocument you must insert a line like
WinExec("app2.exe", SW_SHOW);
Then you normally start your app1 and the programm itself starts app2
regards
yummi
|
|
|
|
|
i m using VC++ 6 n DirectShow for video capture
i change the debug mode configuration to Release mode
there are warnings as follows
now wt should i do ?
R they have effect on my program or not.
Linking...
LINK : warning LNK4089: all references to "ADVAPI32.dll" discarded by /OPT:REF
LINK : warning LNK4089: all references to "OLEPRO32.DLL" discarded by /OPT:REF
LINK : warning LNK4089: all references to "WINMM.dll" discarded by /OPT:REF
cam.exe - 0 error(s), 3 warning(s)
|
|
|
|
|
No problems there. The compiler has optimised in such a way that it no longer needs those libraries, so it has removed all references to them. Since you weren't using the libraries anyway, it won't make any difference at all. It wouldn't show this in Debug mode because the compiler was probably not optimising your code.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
CDC memDC;
memDC.CreateCompatibleDC(NULL)
I made memory dc with Parameter NULL, which means SYSTEM compatible DC as far as i know..
Because I can't use View's DC in my module that manipulate Bitmap..
And then I made CBitmap..
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&memDC, 200,200);
But What I noticed here is the bitmap that I've just created is 1bit bitmap,
that is white-black bitmap..
I can not understand why..
I saw some source that manipulate bitmap like rotate.. stretch here..
That used same kind of memDC, which was created by the function CreateCompatibleDC with NULL Parameter..
The bitmap that source created was full color bitmap..
What's wrong with my code?
|
|
|
|
|
I've never used CreateCompatibleBitmap. Actually, I don't even use CBitmaps, I use DIBSections via a wrapper class. There are several on CP, but in the meantime, I'm pretty sure that bitmap has a constructor or a general Create call that will do what you want it to.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
johnny,Kim wrote:
But What I noticed here is the bitmap that I've just created is 1bit bitmap,
that is white-black bitmap..
I can not understand why..
This is documented in MSDN. When a memory device context is passed to CreateCompatibleBitmap() , a 1-bit bitmap is always created. To create a colour bitmap, pass in a device context referring to the screen or an actual device.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks you..
I should've checked MSDN.. Sorry about that I was lazy...
|
|
|
|
|
Hello,
I'm using a CWnd derived custom control inside a dialog for drawing. I'd like to know if there's some kind of OnInitDialog (from CDialog) or OnInitialUpdate (CFormView) to do some initialization i cannot do nor in the control constructor, neither in the dialog's OnInitDialog (i'm refering to the dialog that includes the custom control).
Your help will be really appreciated.
Thanks in advance!
|
|
|
|
|
override CWnd::OnCreate or PreCreateWindow in your control
|
|
|
|
|
I am completely new to ASCII programming. My problem is this: I have to send the ASCII command "ENQ" to an amplifier which then sends an analog value back to my compiler.
I have no idea how to send ASCII commands, I am trying to use the MSComm command, but I am not having any luck. If anyone can give any advice on how to 1. send ASCII commands, and 2. be able to read the incoming values from the ASCII commands it would be very helpful to me!!!
Thanks in advance.
Loren
|
|
|
|
|
an ascii command to an amplifier that then sends an analog reply to your compiler?
hmmmmmmmmmmmm....
well i would imagine the amp is plugged into a parallel, serial, usb or scsi port so it can be controlled by the computer ... the replies will be coming back from the amp to the same port you sent them in all liklihood
can u give more details on what equipment u are working with and what u are trying to do?
"there is no spoon" biz stuff about me
|
|
|
|
|
How dare you try and help this person with their icomprehensible request ? No wonder you got voted a 1...
</sarcasm>
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
How do you connect to the amplifier? Because you mentioned MSComm I assume you are using a serial connection - are you sure you have the correct serial settings for the amplifier?
You should be able to download a more capable terminal program that allows you to send ENQ (ASCII 5) commands. The amplifier cannot send you an analog value, it must send a response back through the same serial connection, and in this case will be displayed in your terminal program. Failing that, look through CodeProject for serial communication, and you will have to write a program to send the ENQ, and read the response.
Note: ENQ is nothing special, and there is no 'ASCII programming'. If you look at an ASCII table[^] you will see that ENQ is just the value 5.
|
|
|
|
|
I've never gotten a good answer out of anyone when I have inquired about the proper way to ensure that a file is included only once in a build. I also did not see anything in my thread search so I'll ask and hopefully get a reasonable answer.
In the below subset of code, I though the first set of instructions was to ensure that the header file would be included only once in a build. Then I thought, well what is the pragma once for then? According to the MSDN help, pragma once does the same thing. So when class wizards generate a class header file, why do they insert code that seems to serve duplicate purposes? Any ideas?
#if !defined(AFX_RETRYDLG_H__4A3C71B3_E316_48A5_B38E_7F3E778D47DD__INCLUDED_)
#define AFX_RETRYDLG_H__4A3C71B3_E316_48A5_B38E_7F3E778D47DD__INCLUDED_
//I've already used the previous #ifndef ... #endif to
//ensure the single inclusion of my class declaration.
//Why do I need this #pragma once on top of that?
#if _MSC_VER > 1000
#pragma once
#endif
//of course my class would be declared after the #pragma once statement.
class MyClass
{
MyClass();
~MyClass();
};
#endif // _MSC_VER > 1000
|
|
|
|
|
#pragma once is a microsoft only pragma, and in the example you show, it is useless ( i think ).
I usually remove it from generated code.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
The way i understand it (could be wrong) is that the #ifndef test prevents referential loops when the compiler is recursing through the #include lists for a given module. This is on a per module (cpp file) basis.
Where as the #pragma once is for the entire build session. It likely instructs the compiler to cache the parsed contents of the file so that the second module that needs the file doesn't have to reparse it.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Personally, I'd stay with the #if, etc. directives as this is a more portable way of doing things.
However, the reason for...
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif
...appearing is (IIRC) due to a bug with the developer studio debugger when keeping track of something or another. I tried googling to refresh my memory to no avail though.
Jeremy Falcon
|
|
|
|
|
When you use the #pragma once directive, the compiler will only open and read the file only once. If all you use is the #ifdef...#endif code block, then the compiler will open and read the file every time it is encountered, which is not all that efficient when all of the files contents gets ignored anyway. The only think to remember is that the #pragma once does not work on older compilers, so it is wise to always include both methods in your header file.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
thanks for the additional info, I think I read that before, but it's nice to have a reminder.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
One benefit not yet mentioned is that if you use the #ifdef method, you can test later to see if the header was included. For example WTL has this:
#ifndef __ATLBASE_H__
#error atlapp.h requires atlbase.h to be included first
#endif to check that atlbase.h is included before atlapp.h.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Four fonts walk into a bar. The bartender says "Hey - get out! We don't want your type in here."
|
|
|
|
|
I have an MFC dialog which has three property pages on them. All was well until I added a Menu at the top. The menu now covers most of the tabs for the property pages, and I cannot figure out how to move the property pages down. They are of type PP_LARGE.
Bob
|
|
|
|
|
I want to loop a segment of a wav file, but when I set the play cursor back there's a "blip" so I need to somehow put the portion of the wav I want to loop in a separate secondary buffer (because DirectSound only supports looping for an entire buffer), but then I don't know how to play the different buffers seemlessly. Do I use 3 buffers one for the "attack" one for the "sustain" and one for the "decay" portion of the wav or do I use one buffer and somehow stream the data into the buffer.
|
|
|
|
|
Use three buffers.
The primary buffer is used by DirectSound to playback the wave. You shovel data into this buffer, DirectSound then plays the data and then the data is discarded. You then have one secondary buffer that contains actual data from the file you wish to play. The easiest way is to use small wave files and load the entire file into this buffer. Finally, you have a tertiary buffer that contains only the data you wish to loop. If your sound files are large (over 1 Mb), the secondary buffer must be a streaming one or you'll quickly run out of memory.
While normal playback is up, shovel data from the secondary buffer into the primary buffer. When a looping section occurs, shovel data into the primary buffer from the tertiary one. When the looping should end
The most efficient way to do this is to create two wave files. One which has the entire wave you wish the play, and one with just the looping section. You can then use a full-feature wave editor program to accurately pinpoint the samples and timings on where you can start the loop, and where you can end it and continue with the original file.
It is wise to use a buffer. The alternative is that you shovel data directly from the file stream into the primary buffer. The disadvantage is that if a disk-excessive application happens to start or the OS needs access to the drive, your sound may glitch badly. Loading the data into a buffer beforehand is more efficient. Naturally, best results are achieved by using small buffers and always keeping a few seconds of audio data in reserve.
For an example on how to use a secondary buffer with DirectSound, you should consult the DirectSound C++ SDK and it's manual. The necessary functions (Lock, Unlock, Play) can be found from the IDirectSoundBuffer -interface.
I suggest you first design the buffer-usage with a paper and a pen, taking note of buffer positions, chunk sizes and all that. Remember that you can specify the size of the secondary buffer, but not for the primary one.
If this does not help you out, I might consider writing a small sample application, as the technique interests me as well.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I use 3 buffers now and I can loop the sustain portion of the sound seemlessly, however, now there's a "blip" before the start of the loop and at the "release", which is what I thought would happen. The first wav plays and at the end it signals for the next wav to play (the loop wav) but the sound of the 2nd wav doesn't start soon enough, causing the blip. When the 2nd wav stop playing and the 3rd wav is signaled to play there's another blip for the same reason.
So basically I need a way to seemlessly play one wav (in a buffer) after another. It seems the only way to do this is to implement some sort of overlap/switch between the 1st/2nd buffers (using GetCurrentPosition to see where to start playing in the 2nd buffer) and some sort of crossfade (for the release).
The WAV already has markers for loop start/end and release (which I use) and I have another program that can play the sound correctly so I know that glitchless play back is possible.
|
|
|
|
|
I tried to do an "overlap/switch" with the buffers, but it didn't work. I can't get the playback of the 2nd wave to start where the 1st wav left off (i.e. I can't connect them in playback without a blip). I'm sort of stuck...I might try to do it via streaming, but I don't know if that'll work (i.e. using only 1 buffer that plays/loops continuously with periodic writes to the beginning of the buffer to replace old data (until only the loop part is remaining).
|
|
|
|