|
|
Its OK figerd it out
I will get me cote
|
|
|
|
|
I having a problem with a control (say an edit box) on a Dialogue or FormView.
in my resource script is as follows
EDITTEXT IDC_EDIT1,34,50,26,14,ES_AUTOHSCROLL | NOT WS_BORDER<br />
PUSHBUTTON "&Size Info",IDC_SIZE_INFO,69,91,56,26<br />
<br />
I've a handler for the button
as follows:
-
<br />
void CMyDialog::OnSizeInfo()<br />
{<br />
CRect ButtonRect, EditRect;<br />
CWnd *pEdit = GetDlgItem(IDC_EDIT1);<br />
CWnd *pButton = GetDlgItem(IDC_SIZE_INFO);<br />
pEdit->GetClientRect(EditRect);<br />
pButton->GetClientRect(ButtonRect);<br />
}<br />
-
<br />
void CMyDialog::OnSizeInfo()<br />
{<br />
CRect ButtonRect, EditRect;<br />
CWnd *pEdit = GetDlgItem(IDC_EDIT1);<br />
CWnd *pButton = GetDlgItem(IDC_SIZE_INFO);<br />
pEdit->GetWindowRect(EditRect);<br />
pButton->GetWindowRect(ButtonRect);<br />
}<br />
-
<br />
void CMyDialog::OnSizeInfo()<br />
{<br />
CRect ButtonRect, EditRect;<br />
CWnd *pEdit = GetDlgItem(IDC_EDIT1);<br />
CWnd *pButton = GetDlgItem(IDC_SIZE_INFO);<br />
::GetClientRect(pEdit,EditRect);<br />
::GetClientRect(pButton,ButtonRect);<br />
}<br />
-
<br />
void CMyDialog::OnSizeInfo()<br />
{<br />
CRect ButtonRect, EditRect;<br />
CWnd *pEdit = GetDlgItem(IDC_EDIT1);<br />
CWnd *pButton = GetDlgItem(IDC_SIZE_INFO);<br />
::GetWindowRect(pEdit,EditRect);<br />
::GetWindowRect(pButton,ButtonRect);<br />
}<br />
in all cases the top and left properties are 0 and 0 and not 34 and 50 (EditRect) or 69 and 91 (ButtonRect). How I get this programatically.
Many thanks
Alton
|
|
|
|
|
You can :
CPoint pt(0,0);
child->ClientToScreen(&pt);
parent->ScreenToClient(&pt);
I believe pt will now contain the position of child relative to parent.
|
|
|
|
|
i want to buit an application that can connect two pc's using LPT1 using LAPlink cable. can some body send me this source code developed in C++. or help me in any other way.
|
|
|
|
|
Inheritance problem
Hello
I'll describe my problem. I've got a vehicle class (cVehicle), and two 'heirs', car (cCar)and van (cVan). The vehicle class has atributes X and Y, car has C and van has V, and both heirs inherit X and Y.
i have a class called Vehiclefactory which has a method which recieves a string with the atributes and it must return a Cvehicle object. Then i must add it to a list.
<br />
CVehiculo* temp = Vehiclefactory.Create (" string with atributes");<br />
VehicleList.Add (temp);<br />
Inside Vehiclefactory.create function, if i get a string with a C, i must create a car, and if i get a string with a V i must create a van
<br />
if (c==C)<br />
{<br />
cCar * car = new cCcar(X,Y,C);<br />
return aut;<br />
}<br />
if (c==V)<br />
{<br />
cVan * van = new cVan(X,Y,V);<br />
return van;<br />
}<br />
but the function returns a cVehicle class, so i lost the car or van atribute.
<br />
class cVehiclefactory<br />
{<br />
private:<br />
FILE *data;<br />
public: <br />
void read (char * filename);<br />
cvehiculo * Create (char data[51]);<br />
};<br />
i really need the create function to return a Cvehicle class, but i need to actualle return a car or a van, to be able to see its atributes and then to add it to a list. these lines of code must be in the program
<br />
CVehiculo* temp = Vehiclefactory.Create (" string with atributes");<br />
VehicleList.Add (temp);<br />
hope you can help me!!
thanks
|
|
|
|
|
CVehiculo could have a private member (with a public accessor) that specifies the type of class (car/van). This member is set in CVehiculo 's constructor. CCar and CVan should pass the appropriate value to CVehiculo 's constructor during their own construction.
CCar (c, x, y) :
CVehiculo (CVehiculo::Type::Car, x, y)
{
m_c = c;
}
CVan (v, x, y) :
CVehiculo (CVehiculo::Type::Van, x, y)
{
m_v = v;
}
You should make CVehiculo 's default constructor private, in order to prevent an uninitialized CVehiculo from being created. You could test the type of object returned by the factory by using CVehiculo 's accessor, eg:
class CVehiculo
{
public:
CVehiculo::Type getType()
{ return m_type; }
...
private:
CVehiculo::Type m_type;
}
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Shouldn't you be able to just cast the return to the type you want.
- Aaron
|
|
|
|
|
|
Like in visual studio for c++ docs it adds support for coloring text "for, if..." how can I make the same text coloring by default?
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
|
When I made an MFC app I included support for 4 recent documents but how can you erase these?
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
I think you'll have to use the undocumented class CRecentFileList , which manages this file list. The file list is owned by CWinApp , which has the m_pRecentFileList member. This member is protected , so you'll have to add code to manipulate it to your application class which derives from CWinApp .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
I was wondering how I might be able to have multiple child dialogs opening off of the main dialog?
What I mean is, when I click a button in my main dialog to open another dialog using
CDialog dlg;
dlg.DoModal();
it will open the other dialog but I cannot access the main dialog unless I closed the newly opened one. How can I get around this so I can focus the main dialog when the opened dialog is open?
Thanks
Ash
|
|
|
|
|
|
This sounds dumb....but how? hehe
Thanks
|
|
|
|
|
Sorry ill rephrase that... how do I make it a modeless dialog?
|
|
|
|
|
A nice tutorial on modeless (and modal) dialogs is available here[^].
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
i'd like to capture the message when key down or up on ComboBox.
.eg. when press the return key,then add a word to the ComboBox.
and how to capture the return key press?thx
GreenXML
|
|
|
|
|
Hmmm, you could use GetWindow (GW_CHILD) to get at the combo box's edit control, then subclass that (override it's PreTranslateMessage() ) to notify you when the user has pressed [Return].
Please post an article at CP if you get it to work. Thanks!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
BOOL MyDialog::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam!=VK_RETURN)
{
if(GetDlgItem(IDC_MY_COMBOBOX)==GetFocus())
{
//her you have it
}
}
}
|
|
|
|
|
I've been using a standard (qwerty) keyboard and allowing XP to switch it to the Dvorak layout. For those that don't know, that is just the same keyboard with the keys rearranged (ex. I type r and get p). Sadly, XP wont carry this into some games, so I've decided to write a program that will re-interpret the keydown messages the games are getting.
I was just wondering if someone could give me some hints on where to start looking for examples on this sort of thing. Would this require hooks (I've never made one)?
Optimomally, the program would work like a program I downloaded today for getting sound from old dos games, where you just right click the exe and it does something with a DLL to the exe.
Thanks!
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
|
Hello-
I've been investigating DirectSound for an app for a couple days and still a bit confused. What I would like to do is stream an MP3 from an Icecast/Shoutcast server to my machine and run that through DirectSound.
To me, this would be done by writing the code to connect to the server, start streaming the MP3, then shovel that data into a DirectSound buffer which is configured to connect (via a filter graph) to an MP3 decoder.
There are streaming examples with the DirectX SDK, but they don't talk about MP3s -- they're just for PCM.
Am I approaching this correctly? Are there better examples for me to look at? I also want to incorporate my own FIR filter into the DirectSound stream -- I'm assuming this will be possible.
Cheers,
Jake
|
|
|
|
|
After a few hours of work, I've done some prelimenary research for you.
If you use a stream from the Internet, take the following steps into consideration:
1. Connecting to the stream and requesting for a stream (HTTP commands)
2. Receiving data from the stream
3. Running the stream through a DirectShow filter chain that decodes it
4. Shoveling from the final filter in the chain into the DirectSound buffer
5. Playing back the buffer
There are at least some SHOUTCast DirectShow filters available, but I have no knowledge on how/if they work. A better way, I would feel, is to directly connect to the SHOUTCast server and request for a stream.
The entire process bases itself around the IMediaObject interface, that represents a block of media data.
First, you should create the necessary filter object, in MP3 case, it could be MPEG-1 Stream Splitter Filter, that can receive MEDIATYPE_STREAM with MEDIATYPE_MPEG1Audio.
To continue from here, you can use ACM Wrapper filter, that supports conversion from MP3 to PCM format, if you have any MP3 decoders installed (installing WinAmp will install a decoder as well).
The ACM Wrapper outputs PCM data that can be directed into a DirectSound Renderer filter, or if required, you can use IMemAllocator interface to get the decoded IMediaSample objects out from the chain.
In order to utilize the received data, you can create an instance of a IMediaSample interface (and the object), set it up to represent the data you have received (MEDIATYPE_STREAM with MEDIATYPE_MPEG1Audio subtype, for example, if you use the MPEG-1 Stream Splitter). Then get a pointer into the sample's data area, copy data from the download buffer, and call IMemInputPin::Receive on the input pin. To get the input pin, get a pointer to the IBaseFilter interface on the MPEG-1 Stream Splitter interface, and query through the pins using EnumPins. When you find the suitable IPin, query for the IMemInputPin interface on it.
This isn't a complete example on how to do it, but it should help you get started.
Alternatively, if you already have a working application that connects to a SHOUTCast source, receives data and fills a temporary buffer (raw data buffer, non-DirectSound), then I could consider joining up to write the logic to decode and playback it.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|