|
It's easy enough to create such a function. Here is a site with JavaScript that can easily be converted to C. Others can be found here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Indeed, the algorithm is not so complicated as I first believed. Thanks David.
|
|
|
|
|
I have posted a question alredy but no awnser.
Kindly tell me how will i zoom in and zoom out a picture. in VC++ MFC
any help or sample
thanx
|
|
|
|
|
I'm willing to bet my life savings there is probably an article on bitmap zooming somewhere on CP....at the very least there is a bitmap class somewhere on here which has zoom functionality...
p.s-my life savings currently are -456...i'm in debt...please pay it for me
How do I print my voice mail?
|
|
|
|
|
Could it be that the video is allready loaded in the cache and/or memory? If you load it the first time, it has to be fetched from your HD into memory ... ?
(just a thougth)
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
my program plays DVR format video files and
Window Media Player play ordinary avi files
so they play different files and different contents..
so caching is not in this case
thanks for your reply anyway
|
|
|
|
|
Hi All
does anyone know how to programatically create a MS Acess database ?
i dont mean the tables, but the actual database itself
or could any one point me in the right direction
thanks
Si
|
|
|
|
|
#include "afxdao.h"
AfxGetModuleState()->m_dwVersion = 0x0601;
AfxDaoInit();
CDaoDatabase db;
db.Create("D:\\NewDatabase\\NewDb.mdb");
Note: The directory must already exist.
That's all.
MS
|
|
|
|
|
supurb thanks
|
|
|
|
|
Hi all
I would like to store the details of hard drive (like Volume, Capacity, Used Space and free space of Hard Drive) in a List box. How can I write a code to find volume, capacity, used space and free space?
Any help be appreciate.
rajesh
|
|
|
|
|
dont punch me, if this doesnt work.. I wrote this 4 years ago...
void CPathPage::LoadDrives()
{
char cDriveList[DRIVE_LEN*MAX_DRIVES];
char cDrive[DRIVE_LEN];
int iDriveCount=GetLogicalDriveStrings(DRIVE_LEN*MAX_DRIVES, cDriveList)/DRIVE_LEN;
UINT uDriveType;
while(iDriveCount)
{
--iDriveCount;
strncpy(cDrive,cDriveList+(iDriveCount*DRIVE_LEN),4);
uDriveType=GetDriveType(cDrive);
if(uDriveType==DRIVE_FIXED || uDriveType==DRIVE_REMOTE || uDriveType==DRIVE_RAMDISK)
{
InsertDrive(cDrive);
}
}
}
CString CPathPage::FormatSize(__int64 iSize)
{
CString sRet;
if(iSize>1024*1024*1024)
{
sRet.Format("%I64d Gb",iSize/(1024*1024*100));
sRet.Insert(sRet.GetLength()-4,'.');
}
else if(iSize>1024*1024)
{
sRet.Format("%I64d Mb",iSize/(1024*100));
sRet.Insert(sRet.GetLength()-4,'.');
}
else if(iSize>1024)
{
sRet.Format("%I64d Kb",iSize/(100));
sRet.Insert(sRet.GetLength()-4,'.');
}
else
sRet.Format("%I64d byte",iSize);
return sRet;
}
__int64 CPathPage::GetDriveSize(CString sDrive,BOOL bFree)
{
ULARGE_INTEGER i64FreeBytesToCaller;
ULARGE_INTEGER i64TotalBytes;
ULARGE_INTEGER i64FreeBytes;
i64FreeBytesToCaller.QuadPart=0;
i64TotalBytes.QuadPart=0;
i64FreeBytes.QuadPart=0;
if(GetProcAddress( GetModuleHandle("kernel32.dll"),"GetDiskFreeSpaceExA"))
{
GetDiskFreeSpaceEx((LPCSTR)sDrive,&i64FreeBytesToCaller,&i64TotalBytes,&i64FreeBytes);
}
else
{
DWORD dwSectPerClust;
DWORD dwBytesPerSect;
DWORD dwFreeClusters;
DWORD dwTotalClusters;
GetDiskFreeSpace (sDrive, &dwSectPerClust, &dwBytesPerSect, &dwFreeClusters, &dwTotalClusters);
i64FreeBytesToCaller.QuadPart=dwSectPerClust*dwBytesPerSect*dwFreeClusters;
i64TotalBytes.QuadPart=dwSectPerClust*dwBytesPerSect*dwTotalClusters;
}
if(bFree)
return i64FreeBytesToCaller.QuadPart;
else
return i64TotalBytes.QuadPart;
}
void CPathPage::InsertDrive(CString sDrive)
{
char cDriveName[MAX_DRIVES];
GetVolumeInformation(sDrive,cDriveName,MAX_DRIVES,0,0,0,0,0);
if(strlen(cDriveName))
m_lDrives.InsertItem(0,sDrive+CString(" [") + cDriveName + CString("]"));
else
m_lDrives.InsertItem(0,sDrive);
m_lDrives.SetItemText(0,1,FormatSize(GetDriveSize(sDrive)));
m_lDrives.SetItemText(0,2,FormatSize(GetDriveSize(sDrive,TRUE)));
m_lDrives.SetItemText(0,3,FormatSize(GetDriveSize(sDrive,TRUE)));
DWORD dDrive=0;
strncpy((char*)&dDrive,(LPSTR)(LPCSTR)sDrive.Left(1),1);
m_lDrives.SetItemData(0,dDrive);
}
|
|
|
|
|
HI,
I want to build an application , that zoom my BMP or GIF Picture saved on my Disk ..
I give it path and it will show that pic,,,
and on clicking a zoom button it will zoom it few percent. same like as an aplication ( Picture Viewr in windows XP) ..
any idea or sample to zoom a picture
thanx
|
|
|
|
|
Hi - I read about InpOut32.dll (dll letting you access I/O ports in Nt / 2000 / XP) on some CodeProject article. The link for the DLL, with source code, is http://www.logix4u.net/inpout32.htm.
I downloaded InpOut32 and copied the relevant lines from their sample CPP application to my "C" application, but I got linker errors as shown below:
TestProg.obj : error LNK2001: unresolved external symbol _Inp32@4<br />
TestProg.obj : error LNK2001: unresolved external symbol _Out32@8<br />
Debug/TestProg.exe : fatal error LNK1120: 2 unresolved externals<br />
Error executing link.exe.
After hours of trying to find differences between my program and the sample program, someone suggested that "C" files and "CPP" files are handled differently. I changed the name of my main program file from TestProg.c to TestProg.cpp, and the project now compiles and runs fine. I made no other changes to the project (same libraries linked, etc.)
Unfortunately, the change from C to CPP compilation affects other parts of the program, so I would like to change the main program back to "C".
What are the differences between how Visual Studio 6 handles "C" files compared to how it handles "CPP" files?
How do I get this DLL to work with my C application?
|
|
|
|
|
OK, my next rule is "think before you post". At least I found the answer myself before anyone flamed me.
I had a look at some Borland C++ samples which came with the InpOut32 DLL, and used the "traditional" DLL techniques used there - LoadLibrary, GetProcAddress, etc.
My code now works fine as a C file.
|
|
|
|
|
HI~
Sorry for asking a silly question but I don't know it really.
How to copy a LPWSTR?
We cannot write this:
LPWSTR newStr = oldStr;
since LPWSTR is a pointer. It just copying pointer but not the content of the string.
I would like to have two copy of the string in different memory location and there is 2 LPWSTR pointer point to each copy respectively. How?
Thanks
|
|
|
|
|
LPWSTR being a 'long pointer to a wide character string'
One would use wcscpy to copy the contents of a string of the same to another string of this type.
|
|
|
|
|
<br />
LPWSTR newStr = new wchar_t[wcslen(oldStr)];<br />
wcscpy(newStr, oldStr);<br />
<br />
<br />
<br />
delete [] newStr ;
rgds...mil10
|
|
|
|
|
Hi,
Can anyone tell me (or give me a link) how to print a CString?
I'm looking into CPrintDialog, but nothing happens so I must be forgetting something.
tnx a lot 4 your help.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Havr you tried even looking in the printing section here at CP?
I have posted a complete example on printing a long CString....using MFC
If you vote me down, my score will only get lower
|
|
|
|
|
tnx it worked, but I put myself into new trouble by converting the string to rtf format. I could change the \par and \tab to \n and \t, but I also need bold and underlined text.
I know FORMATRANGE will do this automatically, but how to add a CString to a CHARRANGE?
(ps: I did search for print functions before I asked here at the forum, but your article didn't show up until I committed your name. Just so wouldn't think I asked first and searched later )
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Hi Guys,
How r u all. I want to display a Meta File, But part of it.
I tried it by using playMetaFile() function.
This function is displaying whole meta file.
I would like to display only part of it
Like half of file to last of file.
Thanks in advance.
Salman
If you have in the cause and in the means and in the GOD, hot sun will be cool for you.
|
|
|
|
|
Hello,
Here is a problem for the realy good programer.
Well I need to check if someone start a download on a computer is there anyone how can help me, I need help fast.
\Never feer thare is always someone out there....
|
|
|
|
|
Hi,
I am currently writing an MFC dialog-based app which displays a html file using an Internet Explorer ActiveX control (i.e. Microsoft Webbrowser ActiveX Control), which works fine.
You can print a html-file from that control by right-clicking on the control and selecting "Print" from the Context Menu. However, I'd like to have a button in my dialog to print. So I searched through the generated Wrapper-Class of CWebBrowser2, but unfortunately, there is no function to call the printing routine. So, do you have any suggestion how I can print a html file using the Webbrowser ActiveX control?
Thank you very much in advance,
Erik
|
|
|
|
|
Hi,
I need a 'find method' which returns a node in a IXMLDOMDocument.
Is there any easy way to achieve this? Any tutorials/links about this?
Thanks in advance,
Jens
|
|
|
|
|
You could try here Code Project[^]
Or use the CP site search and look for "XML Document Wrapper" for instance.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|