|
gmallax wrote: But,It always fails.
This sort of problem description really does not mean anything. If your program fails then you need to explain exactly what error messages or exceptions you see. Only then can anyone begin to guess what may be wrong.
It's time for a new signature.
|
|
|
|
|
Did you call av_register_all() ? It's like CoInitialize, you need to call it before calling anything else.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hiya,
It would be helpful if someone tell me how I could convert ostringstream to tchar* such that it will work in both ansi and unicode compilation. currently i have done like:
std::ostringstream strn;
strn <<"Just do it!";
const TCHAR* tata = static_cast< LPCTSTR >(strn.str().c_str());
But this does not seems to work in both the cases.
|
|
|
|
|
I'd use something like:
#ifdef _UNICODE
typedef std::wstring tstring;
typedef std::wostringstream tostringstream;
#else
typedef std::string tstring;
typedef std::ostringstream tostringstream;
#endif
tostringstream strn;
strn << _T("Just do it!");
tstring str = strn.str();
const TCHAR* tata = str.c_str();
modified on Wednesday, May 12, 2010 8:48 AM
|
|
|
|
|
Hi, I have an owner-drawn static control that I use to display a file path. The file path often exceeds the width of the static control and the last directories and files are truncated.
I know about PathSetDlgItemPath and PathCompactPath, but they don't work with this control because it is owner-drawn (the app is skinned). I've looked at PathCompactPath, but it requires a HDC parameter for reference, and the drawing is done with Gdiplus. The control draws itself in the OnPaint routine with this code:
void CNiceLabel::OnPaint()
{
CPaintDC dc(this);
CRect r;
GetClientRect(&r);
auto_ptr<Graphics> g(Graphics::FromHDC(dc.m_hDC));
CStringW txt;
GetWindowText(txt);
Gdiplus::Font myFont(m_FontName, (REAL) m_FontSize, m_FontStyle);
StringFormat format;
RectF rf;
g->MeasureString(txt, txt.GetLength(), &myFont, PointF((REAL) r.left, (REAL) r.top), &rf);
if (m_bWordWrap)
{
rf.Width = (REAL) r.Width();
rf.Height = (REAL) r.Height();
}
Color color;
color.SetFromCOLORREF(m_Color);
SolidBrush whiteBrush(color);
g->DrawString(txt, txt.GetLength(), &myFont,
rf, &format, &whiteBrush);
g->Flush();
}
I thought about using g->GetHDC() to obtain a HDC for PathCompactPath to work with, but I probably need to select the font in it, and the font I use for drawing is a Gdiplus::Font, not CFont. And it can't be selected - it is passed to DrawString directly as a parameter.
So I'm looking for a way to make PathCompactPath work with my control, or if someone can point me a function that does a similar job but has its source code published, that would be great.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi,
How can i get file status(ie. open, close, edit) using C or C++. Is there any API in windows.
Thanks in advance
Suzu
|
|
|
|
|
A file is either opened or closed by one or more processes. The mode in which it is open is a characteristic of the handle, which is owned by a process, not the file. (not all handles are owned by processes, but let's keep this simple.)
The bad news is: there is no API. You could have a go at the object manager[^] name space, but this requires the openfiles global flag to be on. Turning it on or off will require a reboot.
Short of that, you can only obtain the information in kernel mode, and that will require a device driver.
|
|
|
|
|
Do you mean the context menu of a file by this "file status(ie. open, close, edit)", or do you mean if a file can be accessed, opened for reading/writing, etc.? You can do that by calling _open[^]
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Just i want to get current status of the file. ie.
1) It is opend
2) It is Closed
3) It is modified
Thanx
|
|
|
|
|
You need to be more clear.
1) A file might be opened in the sense that there are handles of that file opened by one or more processes.
2) I don't know what you mean by "closed", is it that no process has opened the file currently?
3) A file has always been modified somewhere in the past, it might be a minute ago or a month ago or 10 years ago. That's how you create a file, you create it empty and then modify it. Do you mean that you want to get the date of last modification? What do you mean by "it is modified"?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Accessing File Status (MFC)
Also, you can try CFile::GetStatus
CFile theFile;
char* szFileName = "X:\\TEXT.TXT";
BOOL bOpenOK;
CFileStatus status;
if( CFile::GetStatus( szFileName, status ) ) bOpenOK = theFile.Open( szFileName, CFile::modeWrite );
else bOpenOK = theFile.Open( szFileName, CFile::modeCreate | CFile::modeWrite );
http://msdn.microsoft.com/en-us/library/e3z63bza(VS.80).aspx[^]
.
|
|
|
|
|
yeah... but i need pure win32 API or any library function.
|
|
|
|
|
|
Hi All,
I am developing an SMS application using VC++ 2005 on Vista with Unicode character set.
Is it possible to find the language (i.e, either Chinese, English, french etc etc) of the incomming string?
That is, if I recieve an message in french language, I should be able to recognize the language as French just from the string itself. Are there any API's which will give me that info?
Thanks in advance.
|
|
|
|
|
Nope, nada, non. (*)
For that you would need an infinite corpus for all/most languages, you'd also have to be able to analyze said language based on no "hint" of a language so you'd need to have an analyser for all languages, and imagine also if a sentence used multiple words for multiple languages ...
I was thinking maybe CString could encode "something" to identify the string, but that you not make sense since there is nothing preventing you to use "latin" characters in a japanenese string and make a french sentence.
(*) probably someone will prove to the contrary, but I don't think so, that's why all online translation ask for in (and out) languages.
Watched code never compiles.
|
|
|
|
|
Hi all
Is there any freeware API for multisession cd and dvd burning in windows xp,vista and windows7
|
|
|
|
|
Hi,
I'm not sure of the internals of it (multisession, writing modes, etc.,), but the following two projects are open source:
CDRDAO[^]
Infra recorder[^] (This one is actually for Linux, but a windows version is done with cygwin)
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010
Current training method: HIT
|
|
|
|
|
|
Hi
I am trying to register a Type Library (.tlb) on Windows 7 operating system.
I am having around 40 Type Libraries. Few type libraries are not getting to register. I have used command prompt for registering them using 'Run as an Administrator' BUT still it fails to registers. I am an 'Administrator' of the machine with UAC(User Account Control) disabled.
Those type libraries who succeeds display
"Registration of MyTypeLib.tlb successful"
But those who fails display
"RegisterTypeLib of MyOtherTypeLib.tlb failed : 8002801c". I have also used process monitoring tool, but not able to find any break through.
Can you please any sun light on this dark night.?
|
|
|
|
|
Hi
I am using a CComBSTR object.
CComBSTR bstrText;
bstrText.LoadString( MyStringID);
How do the object know that it has to pick up the string ID 'MyStringID' from XMLResource as we are not passing any Registry Key info to it.
Thanks in advance.
|
|
|
|
|
The LoadString() function loads a string resource which is encoded into the exe file, not from the registry. See here[^] for details.
It's time for a new signature.
|
|
|
|
|
|
Dear All,
I am unable to use the Api ::CreateFileMapping(...) in Windows7 Version and Vista for Elivated User.
Please give me solution for this. I have checked the Error using GetLastError(...) it is giving File AccessPermissions and the Error Code is 5. Please suggest an appropriate solution for this.
Thanks & Regards,
Uday.
|
|
|
|
|
Did you check the Access permissions? Is the file open in another process? Which file are you trying to map? Is it a real file, or do you use the paging backing store? If so, does the system have a backing store?
|
|
|
|
|
Hi,
It is working for Administrative User, But failed in for standard user with Administrative Privilages.
These is observed only on Windows 7 Version and Vista for 2003 and Windows XP working for standard user with administrative previlages.
Please provide me a solution for this.
Thanks,
Uday.
|
|
|
|