|
My application is using Windows Media Device Manager 10 SDK to interface with portable devices. Which my app will download wma to device with bit rate such as 32kbps, etc. However, there are certain portable devices only support 48kbps and up. So, I hope that before downloading, my app could tell if the plug-in device got the capability to play with the low bit rate wma files.
IWMDMDevice::GetFormatSupport() is where I started but it lead me to nowhere. Anyone has idea about this? Or simply it is just cannot tell the bitrate supported by a portable device? Thanks in advance.
|
|
|
|
|
Hi All
I looking API of MFC method to find current file version (special build description) .
[I have pointer to this current file].
Can someone help me ??
Thanks.
-- modified at 10:00 Tuesday 1st November, 2005
|
|
|
|
|
|
Looking though some people's code I often see if statements of the form
if (23 == x)
rather than
if (x == 23)
Is there any reason for doing this? I'm sure there is !!!
|
|
|
|
|
It is to prevent typo errors,
if (x=23)
will compile and do undesired things, assign x the value of 23 and always be true
if (23=x)
will not compile
its good practice to put the constant on the left and variable on the right
|
|
|
|
|
I have thought myself about it and could only think of one reason - to avoid mistakes with 'if (x = 23)'. Most compilers today warns you about such syntax, but in past that could be a common hard-to-find mistype. By having accustomed to write constant first, you ensure compiler would not handle this: 'if (23 = x)'
Igor Green
http://www.grigsoft.com/
Compare It! + Synchronize It! - files and folders comparison never was easier!
|
|
|
|
|
I need to import php-generated image data into a c++/mfc program as a variables and arrays. Here is the example of the file:
<br />
9<br />
11<br />
10<br />
COLORMAPSTART<br />
(0*37,70,56)(1*151,63,74)(2*66,100,81)****Snip****(8*114,45,72)(9*211,163,38)<br />
COLORMAPEND<br />
STITCHSTART<br />
(0,0)(1,0)(2,0)(3,0)(4,2)(5,2)(6,0)(7,0)****Snip****(96,4)(97,2)(98,2)<br />
STITCHEND<br />
In the first line (9) we have a total number of colours in the palette. Second line holds image width and the height is on the third line.
Between COLORMAPSTART and -END colors are indexed as follows (COLORINDEX*RED,GREEN,BLUE)
Between StitchSTART and -END we have the rest of the image (CURRENTPIXEL,COLORINDEX)
And this data should be read into variables and arrays...
So far I have read the data and hold it in CString ImportData but what now?
Here is some what I think what I should do:
<br />
int NumberColors=readthefirstline;<br />
int Width=ReadSecondline;<br />
int Height=readthirdline;<br />
Go to the end of "COLORMAPSTART"<br />
Do While(I am in the beginning of COLORMAPEND)<br />
{<br />
Get the text between "(" and ")"<br />
ArrayPaletteadd[ConverttoINT(What is left of "*"),CONVERTTORGB(What is right of "*")]<br />
GototheNext "()"<br />
}<br />
I have no idea how to achieve this
"layout" of the textfile can be changed if it is easier that way...
Thanks,
Janne (sorry about that username i got frustrated when after few tries)
|
|
|
|
|
Does this get you started:
CStdioFile file(...);
CString strLine;
file.ReadString(strLine);
int NumberColors = atoi(strLine);
file.ReadString(strLine);
int Width = atoi(strLine);
file.ReadString(strLine);
int Height = atoi(strLine);
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hello.
See the answer from DavidCrow for the answer to the first of your questions.
For the COLORMAP, I suggest you do like this:
Create an UIntArray, and store the values for every record (i.e. (0*37,70,56)) as a RGB value in the array.
Get the index (0 in the above case) and use it as the index (position) in the array.
Convert the rest of the record (37,70,56) to a single value via the RGB macro. Store the RGB value in the index (gotten above).
Use the SetAt()-member (or better still: SetAtGrow()) of the UIntArray.
(Shortcut: If you can be 100% sure the indexes is in perfect order at all times, and without gaps, then you can use the Add()-member of UIntArray).
When you later want to get a value from the UIntArray, use the GetAt()-member, and retrieve the RGB-value.
That's it, provided you are using MFC. You can use a similar method if you are using STL.
About Stitch, you can use the same metod as above, but you must considder the datatype to use for the array.
If you know for sure that the value never will exceed 255, then you can use unsigned char to store the value in. Then have a look at the ObjArray class. Else, use an UIntArray here too (but a different array than the COLORMAP-array, of course.) But it might be a waste of memory...
Good luck
Kakan
|
|
|
|
|
Thanks for help, you really solved my problem, but as all newbies i'm stuck again
Now I need Scrollbars. So I created two dialogbars which hold the scrollbars, but now I can't "get a grip" of the scrollbars to set ScrollRange, Width, Current position ect... (I'm using CView. Using CScrollView as a base class is not an option, I don't want them to scroll the view directly)
if (!m_wndHorScroll.Create(this,IDD_SCROLL_HOR,CBRS_BOTTOM,AFX_IDW_CONTROLBAR_LAST-1)) <br />
{<br />
TRACE0("Failed to create status bar\n");<br />
return -1;
}<br />
<br />
if (!m_wndVertScroll.Create(this,IDD_SCROLL_VERT,CBRS_RIGHT,AFX_IDW_CONTROLBAR_LAST-1)) <br />
{<br />
TRACE0("Failed to create status bar\n");<br />
return -1;
}<br />
<br />
I know that you can help, so Thanks!
Janne
|
|
|
|
|
Hello Janne, are you Swedish too?
Use the Class Wizard.
In Class Wizard, select your dialog class (if it isn't already) and create member variables for your scrollbars (one member variable for each scrollbar9.
And voila! You have them, in you class. Initialized and all. Ready for use.
(You use the same method for all the controls and windows you want to interact with).
Neat, eye?
|
|
|
|
|
Tyvärr bor jag i södra Finland, närmare bestämt i esbo. Jag hoppas att du kan hjälpa mig i alla fall ;D
Nope, Scrollbars are still dead I can move them but as soon as I release my finger "scroller" returns to the zero position. Just like before.
here is some code:
#if !defined(AFX_SCROLLHOR1_H__320F4D47_5576_4A56_8154_F0672773B771__INCLUDED_)<br />
#define AFX_SCROLLHOR1_H__320F4D47_5576_4A56_8154_F0672773B771__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
<br />
<br />
class CScrollHor : public CDialog<br />
{<br />
public:<br />
void SetBar();<br />
CScrollHor(CWnd* pParent = NULL);
<br />
enum { IDD = IDD_SCROLL_HOR };<br />
CScrollBar m_horisontal2;<br />
int m_horisontal;<br />
<br />
<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
protected:<br />
<br />
afx_msg void OnPaint();<br />
virtual BOOL OnInitDialog();<br />
DECLARE_MESSAGE_MAP()<br />
};<br />
<br />
<br />
#endif // !defined(AFX_SCROLLHOR1_H__320F4D47_5576_4A56_8154_F0672773B771__INCLUDED_)
And more...
<br />
#include "stdafx.h"<br />
#include "Busybee.h"<br />
#include "ScrollHor1.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
<br />
<br />
CScrollHor::CScrollHor(CWnd* pParent )<br />
: CDialog(CScrollHor::IDD, pParent)<br />
{<br />
m_horisontal = 0;<br />
SetBar();<br />
<br />
}<br />
<br />
<br />
void CScrollHor::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
DDX_Control(pDX, IDC_SCROLLBARHOR, m_horisontal2);<br />
DDX_Scroll(pDX, IDC_SCROLLBARHOR, m_horisontal);<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(CScrollHor, CDialog)<br />
ON_WM_PAINT()<br />
END_MESSAGE_MAP()<br />
<br />
<br />
void CScrollHor::SetBar()<br />
{<br />
m_horisontal2.SetScrollRange(0,100,false);<br />
m_horisontal2.SetScrollPos(50,true);<br />
m_horisontal=50;<br />
<br />
}<br />
<br />
void CScrollHor::OnPaint() <br />
{<br />
<br />
SetBar();
<br />
<br />
CPaintDC dc(this);
<br />
<br />
}<br />
<br />
<br />
BOOL CScrollHor::OnInitDialog() <br />
{<br />
CDialog::OnInitDialog();<br />
<br />
m_horisontal2.SetScrollRange(0,100,false);<br />
m_horisontal2.SetScrollPos(50,true);<br />
m_horisontal=50;<br />
<br />
return TRUE;
}<br />
Some additional questions:
How to set the width of that scrollbar?
Is there a way to add windows message OnScroll or something - for these scrollbars?
|
|
|
|
|
Shhh, nothing else than english here, else the others will be offended.
It doesn't matter to me where people come from. I think that's a very good thing with this place. As long as people is able to explain their problem(s) in english, it's OK.
Now, regarding your problem, I'm a bit on thin ice here.
The way I would handle scrollbars is the way I told you before: In the properties of your dialog, click that you want scrollbars. Then use the Class Wizard to create member variables to the scrollbars.
Then you will have (in this case) two member variables (in your dialog class) of the type CScrollBar. Just use them.
And if you want some special handling, then subclass the CScrollBar class.
(class MyCScrollBar : CScrollBar)
Then replace (in your dialog class and in the h-file of your dialog class) all references to CScrollBar with MyCScrollBar.
And that's it.
As far as I can see, you are using tis construct:
CScrollHor::CScrollHor(CWnd* pParent /*=NULL*/)
: CDialog(CScrollHor::IDD, pParent)
I think the base class should be CScrollBar.
And if you do it "my" way, then your scrollbar classes will get into the message map. I think that's your problem now, your classes doesn't get any Windows messages, and that's why they doesn't work.
I've learnt one big lesson during the years I've been coding for Windows, and it is:
Follow the rules!!!
There (normally) is other ways to do it, but they will:
A.
Make you spend forever to get it working.
B.
Make your program unneccesary complex.
(The problem, as a beginner, is to find out what the rules are...)
Good luck.
Kakan
|
|
|
|
|
|
|
you registered CodeProject for that ? you suck dude...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
This is not the correct forum for your inquiry.
Post a specific programming question, or move along.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
How can i get an image from Internet Explorer,
which is created as an internet explorer object.
|
|
|
|
|
does right-click on the image and "save-as" works ?
on the other hand, I would assume that you will need to parse the HTML code to find an tag, then parse the target string and collate the site URL to that string; use some FTP or HTTP protocol to download the file locally.
but what is "an internet explorer object" ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote: but what is "an internet explorer object" ?
Presumably an instance of IWebBrowser2 .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I know this works, but i want automate this using IWebBrowser2 Object with the Document Interface
|
|
|
|
|
Hi all,
First I know the handle of a window with a embeded webbrowser , in other process, how can i get IWebbrowser2 of the webbrowser? thx!
WalkSnail
|
|
|
|
|
i find a article about get ihtmldocument2 from hwnd,
url: http://support.microsoft.com/kb/q249232/
how can i get iwebbrowser2 from ihtmldocument
walksnail
|
|
|
|
|
Mr. Baken
You are right. I am trying to do the same thing. I want to read one character at the time from the file and then interpret it as an integer. Plz check that in fact i is an intege and i am passing it to function as character pointer as it is function requirement.
Plz tell me how can i get one charecter or integer from the file at a time. Also i want to do one more thing which is not related to above problem. That is i want to go to a perticular location in file and then read a 4 bit number from there. How to do that?
Thank you for help.
Aqueel A. Mirza
We Believe in Excellence
-- modified at 2:36 Tuesday 1st November, 2005
|
|
|
|
|
Hello again.
The fact that you are casting the integer pointer to a char pointer doesn't matter at all. It's just pointers, not the real values.
I suggest this code (modified from your example, and not tested):
unsigned int i = 0;
int count = 0;
unsigned char ch;
ifstream fin("data.bin", ios::in | ios::binary);
while (count != 5120)
{
fin.seekg(count);
cout <
|
|
|
|
|