|
How about GetFileSize() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
but in this i have to pass handle of file, i want to use name of file to get size.
or i can use handle of file if i get to know handle of file(is there any function from which i get handle of file)
bye
|
|
|
|
|
You can use the FindFirstFile API to get this info!
Don't try it, just do it!
|
|
|
|
|
smarty12 wrote:
is there any function from which i get handle of file
Yes, CreateFile() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Visual C++ 6.0, SP/5
I'm trying to use a binary resource in my executable, but I'm not having any luck.
I've looked all over MSDN and the web, and I've found nothing that gives clear instructions on how to do this.
Anyone got any hints/tips?
------- 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
|
|
|
|
|
John Simmons / outlaw programmer wrote:
I'm trying to use a binary resource in my executable, but I'm not having any luck.
If by binary you mean RT_RCTYPE , check out this article.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Found the following on CodeGuru. I adapted it to my needs and all is well.
<br />
For each file you want to include, add a line to resource.h as follows:<br />
<br />
#define IDR_MYFILE 103<br />
<br />
Remember to give each file a unique resource ID.<br />
<br />
Close all resource files and open your .rc file as "text." Add the line<br />
<br />
IDR_MYFILE RCDATA DISCARDABLE "res\\myfile.ext"<br />
<br />
A good place to add this line is immediately after the line which defines the IDR_MAINFRAME icon. If you haven't placed "myfile.ext" in your "res" subdirectory, adjust the path accordingly. Save the .rc file. Close it and open ResourceView. You should see something like this:<br />
<br />
There are more convenient ways of inserting a custom data resource, but they either embed the file as raw hex data in the .rc file, inflating it to several times the size of the included file, or neglect to define the resource ID in resource.h so that ResourceView shows the ID in inverted commas.<br />
<br />
To turn a resource back into a file, load it into memory using LoadResource(). This returns a BYTE pointer that CFile can use to write that file to disc.<br />
<br />
// Load the resource and save its total size.<br />
HRSRC hRes = FindResource(NULL, MAKEINTRESOURCE(IDR_MYFILE),RT_RCDATA); <br />
DWORD dwSize = SizeofResource(NULL , hRes);<br />
HGLOBAL MemoryHandle = LoadResource(NULL, hRes);<br />
if(MemoryHandle != NULL)<br />
{<br />
// LockResource returns a BYTE pointer to the raw data in<br />
// the resource<br />
BYTE *MemPtr = (BYTE *)LockResource(MemoryHandle);<br />
CFile file("C:\_my_path_to_file\myfile.ext", CFile::modeCreate | CFile::modeWrite);<br />
file.Write(MemoryHandle,dwSize);<br />
}<br />
FreeResource((HANDLE)hRes);<br />
<br />
------- 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
|
|
|
|
|
Your mod begs a CP article!
[edit]
Just saw David's article.
[/edit]
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
Your mod begs a CP article!
Why, when I've already created one?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
I am using MFC with Explorer style. Basically the Left panel split has it's own class and own file. How would I get LeftView to get/pass information to? I have never actually done get/pass class info which isn't declare in the other one.
Would it be similar to
inline CClassDoc* CClassView::GetDocument() const
{ return reinterpret_cast<cclassdoc*>(m_pDocument); }
Thanks
|
|
|
|
|
You could do something like this, inside your frame that created the split.
CLeftView* CMyChildFrame::GetLeftPane()
{
CWnd* pWnd = m_wndSplitter.GetPane(0, 0);
CLeftView* pView = DYNAMIC_DOWNCAST(CLeftView, pWnd);
return pView;
}
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Happy Friday! Gurus,
I am trying to use the logics from Intel OpenCV DLLs, which were originally compiled by MSVC++ 6. From C# or ASP.NET Apps, when I was trying to add reference to these DLLs (i.e. cv096.dll or cxcore096.dll), I got this error:
“A reference to ‘D:\Programs\OpenCV\bin\cv096.dll’ could not be added. This is not a valid assembly or COM component. Only assemblies with extension ‘dll’ and COM components can be referenced. Please make sure it is a valid assembly or COM component.”
Note: The source code of Intel OpenCV DLLs is open source. I can open this source code project in either MSVC++ 6 or VS.NET 2003.
Question: How can I use these DLLs in .NET environment, preferably in ASP.NET and C# projects?
Thanks with a million
Khang
|
|
|
|
|
Khang Nguyen wrote:
How can I use these DLLs in .NET environment, preferably in ASP.NET and C# projects?
don't know about those specific DLLs, but you can import functions from C-interfaced DLLs (ie. non-COM, non-MFC) by using the DLLImport keyword
ex:
[DllImport("MyDll.dll", EntryPoint="DLLFunctionName")]
public static extern ...return type... DLLFunctionName(...params...);
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
Chris, thank you very much for you tip. Havea good weekend.
|
|
|
|
|
How to Create Network Setup Wizard in MFC
|
|
|
|
|
Hello friends,
I have developed one multi-threaded client-server app in VC++. with audio communication. Voice is transferred using UDP packets. The application works well with dial up communication but when I tried it on CableNet and on machines on the intranet having shared internet connection, it failed. I have checked the incoming UDP packets and found that only a few UDP packets reach to that computer (say 1 out of 100). I am not getting how to deal with this problem.
I have used TCP connection for text messaging and it works fine in both of the above situations.
The problem is with audio packets in UDP format.
I am looking for an immediate help as my project is in progress.
Thanks,
CoolVS
|
|
|
|
|
UDP doesn't guarantee delivery by specification, you'll have to use TCP
RFC 768 - User Datagram Protocol[^]
This protocol provides a procedure for application programs to send
messages to other programs with a minimum of protocol mechanism. The
protocol is transaction oriented, and delivery and duplicate protection
are not guaranteed. Applications requiring ordered reliable delivery of
streams of data should use the Transmission Control Protocol (TCP) [2].
|
|
|
|
|
Hello,
I'm having some trouble with the CPropertySheet. Here is the scenario: The PropertySheet doesn't have a 'Aplpy' button. The property pages contain information that need to be verified when the user clicks the 'Ok' button.
Here is my problem:
After having determined that the data is invalid, the property sheet should not close, but remain visible so that the user can correct the information.
I also got the blogging virus..[^]
|
|
|
|
|
|
Bob Stanneveld wrote:
The PropertySheet doesn't have a 'Aplpy' button.
Is it supposed to have one or did you remove it on purpose?
Bob Stanneveld wrote:
The property pages contain information that need to be verified when the user clicks the 'Ok' button.
This is a bad approach. Do not enable the OK button if invalid data exists.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
DavidCrow wrote:
Is it supposed to have one or did you remove it on purpose?
I removed it on purpose, since the property sheet isn't really an options dialog. No options can be 'applied' to the program, but need to be set before starting a sub process.
Thanks for your reply. I solved the problem using the OnApply method (this is even called though it does not have an apply button). I rather give a fault summary when the user submits data than handling every notification and verify the data individually.
I also got the blogging virus..[^]
|
|
|
|
|
|
|
How can I close a dialog in OnInitDialog. I need this because some checks where made in this function. If the check fails I need to cancel the dialog creation...
Thanks ...
|
|
|
|