|
store the values in regisry and check while updating
"A winner is not one who never fails...but the one who never quits"
|
|
|
|
|
|
hi,
I wan't to play a movie clip in an application using Visual C++.
I think it is possible. Any body can give me an idea abt this.
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
|
the easiest way is to insert a mediaplayer activex into ur project and call its funtions....
nave
|
|
|
|
|
Thats i already did.
Now i want to do it without using any Active X controls.
I know there is some way to do it.
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
Insert Animation Control on dialog .
Add variable from it (m_AVICtrl);
add avi source to your project (IDR_AVI1);
call Open of variable :---> m_AVICtrl.Open(IDR_AVI1) ;
call Play function ---> m_AVICtrl.Play() ;
|
|
|
|
|
|
See mci functions
whitesky
|
|
|
|
|
Can you please tel some thing about the mci function...or any links????
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
|
Hey all,
I need to do this operation
float x;
int y;
int z;
x= (float)((y-z)/60);
if(x % (int)x)!= 0)
{x = (int)x +1;
}
how do i do a mod of float and int. If x is an int then, I can use % operator. But in my case I need to find out if x = 2.1 then I need to round it to 3 ; also if x= 2.6, i need to round it to 3.
How can I do this? Can anyone help? Iam using VC++6.0
Thanks in advance.
|
|
|
|
|
<br />
x= (float)((y-z)/60);<br />
x=ceil(x);<br />
if(x % (int)x)!= 0)<br />
{<br />
x = (int)x +1;<br />
}<br />
|
|
|
|
|
hey what happens to
ceil(x);
if x =2.0, then will it be 2.0 or 3.0?
|
|
|
|
|
try this
float x = 2.1;
int n= x;
if( n < x )
{
n++;
x = n;// x will contain 3 now
}
nave
|
|
|
|
|
thanks for that.
how do i print a double value? i mean the type specifier?
|
|
|
|
|
|
Hi all . could any one show me how to use [B]Microsoft HTML Object Library [/B] in visual c++ 6 to extract data from html and populate it in listview. I have done this in visual basic 6 and i posted the code below . I be happy if an expert help me convert it to visual c++ 6 since i need it for a project that has to be done in visual c++ 6. My current visual c++ code retrives html of url and all now i need to be able to do extract the data i wanted from html and populate the listview with that data. I shown a picture of output in the pic.Thanks
code that retrives the html for me in visual c++ 6:
<br />
void CFindUserDlg::OnButton4() <br />
{<br />
<br />
HINTERNET hNet = ::InternetOpen("MSDN SurfBear",PRE_CONFIG_INTERNET_ACCESS,NULL,INTERNET_INVALID_PORT_NUMBER,0) ;<br />
HINTERNET hUrlFile = ::InternetOpenUrl(hNet,"http://www.mysite.com/Display.php",NULL,0,INTERNET_FLAG_RELOAD,0) ;<br />
<br />
char buffer[10*1024] ;<br />
<br />
DWORD dwBytesRead = 0;<br />
BOOL bRead = ::InternetReadFile(hUrlFile,buffer,sizeof(buffer),&dwBytesRead);<br />
<br />
SetDlgItemText(IDC_EDIT2,buffer);<br />
<br />
::InternetCloseHandle(hUrlFile) ;<br />
::InternetCloseHandle(hNet) ;<br />
<br />
<br />
<br />
}
visual basic 6 code:
<br />
<br />
Private Sub Command3_Click()<br />
'this function places data into listview<br />
' requires that you add a reference to the Microsoft HTML Object Library<br />
Dim mydoc As HTMLDocument<br />
Dim wombat As IHTMLElementCollection<br />
Dim lp As Long<br />
<br />
Set mydoc = New HTMLDocument<br />
<br />
'mydoc.body.innerHTML = "<html><head><p><ul><table border=1 cellpadding=4> " & _<br />
' "<tr><th>Name</th> > <th> color </th> </tr> " & _<br />
' "<tr><td>tony</td> <td>33023</td> " & _<br />
' "<tr><td>cindy</td> <td>16711935</td> " & _<br />
' "<tr><td>sarah</td> <td>3434343</td> " & _<br />
' "</table> </body></html>"<br />
<br />
mydoc.body.innerHTML = RichTextBox1.Text<br />
<br />
Set wombat = mydoc.getElementsByTagName("TR") ' Get the rows<br />
For lp = 1 To wombat.length - 1 ' Ignore first row<br />
Set LI = ListView1.ListItems.Add(lp, , wombat.Item(lp).All.Item(0).innerText)<br />
ListView1.ListItems(lp).ForeColor = wombat.Item(lp).All.Item(1).innerText<br />
LI.ListSubItems.Add , , wombat.Item(lp).All.Item(1).innerText<br />
<br />
Next<br />
End Sub
picuture of the output:
[IMG]http://i5.photobucket.com/albums/y180/method007/ListViewPop.jpg[/IMG]
|
|
|
|
|
Why dont you use Regular Expression to extract data?
|
|
|
|
|
well i do not know how to use it . could u show me how to extract it using either method and populate the listview.thanks
|
|
|
|
|
The following program doesn't free all the memory. Can any one tell me what is wrong with the code?
Thanks.
//
wchar_t *pwcTest = L"Test";
int g_I=1000;
void AllocateMem(wchar_t ***pwcArray)
{
*pwcArray = (wchar_t**)new wchar_t*[g_I+1];
ZeroMemory(*pwcArray, sizeof(wchar_t*)*g_I+1);
for(int i=0; i<g_I; i++) {
(*pwcArray)[i] = (wchar_t*)new wchar_t[wcslen(pwcTest)+1];
wcscpy((*pwcArray)[i], pwcTest);
}
(*pwcArray)[i] = NULL;
}
void FreeArray(wchar_t **pwcDC)
{
if(pwcDC != NULL) {
for(int i=0; pwcDC[i] != NULL; i++)
delete [] pwcDC[i];
delete [] pwcDC;
}
}
int main( int argc, char *argv[ ])
{
char s[2];
printf("main:\n");
fscanf(stdin, "%s", s);
// Mem Usage (in the Windows Task Manager): 632K
wchar_t **pwcArray = NULL;
for (int i=0; i<1000; i++) {
AllocateMem(&pwcArray);
FreeArray(pwcArray);
}
printf("main: %d\n", i);
fscanf(stdin, "%s", s);
// Mem Usage: 688K (g_I=1000)
// Mem Usage: 908K (g_I=10000)
return 0;
}
//
mdexch
|
|
|
|
|
I reformatted your code to make it easier for me to read, particularly since C++ (which you are using) provides references.
wchar_t *pwcTest = L"Test";
int g_I=1000;
void AllocateMem(wchar_t**& pwcArray)
{
pwcArray = new wchar_t*[g_I+1];
ZeroMemory(pwcArray, sizeof(wchar_t*) * (g_I+1) );
for(int i=0; i<g_I; i++) {
pwcArray[i] = new wchar_t[ wcslen(pwcTest) + 1 ];
wcscpy(pwcArray[i], pwcTest);
}
pwcArray[ g_I ] = NULL;
}
void FreeArray(wchar_t **pwcDC)
{
if(pwcDC != NULL) {
for(int i=0; pwcDC[i] != NULL; i++)
delete [] pwcDC[i];
delete [] pwcDC;
}
}
int main( int argc, char *argv[ ])
{
char s[2];
printf("main:\n");
fscanf(stdin, "%s", s);
wchar_t** pwcArray = NULL;
int i;
for (i=0; i<1000; i++) {
if (i%100 == 0)
fprintf(stdout, "%d\n", i);
AllocateMem(pwcArray);
FreeArray(pwcArray);
}
printf("main: %d\n", i);
fscanf(stdin, "%s", s);
return 0;
}
I don't believe my version leaks memory, though I only spent a couple minutes on this. The CRT will ask windows for memory then hold on to it for future requests, even if from your perspective you haven't currently allocated it -- or at least this is my understanding.
earl
PS: VS2005: beginning 960K, end 1000K, regardless i = {1000,10000,50000}
-- modified at 19:28 Wednesday 12th July, 2006
|
|
|
|
|
Look like a CRT issue. On .Net 2003 compiler I see less memory allocation but different for different array size. May be 2005 is different.
Thanks for the input.
mdexch
|
|
|
|
|
I didn't see a leak; do note that when a heap is allocated, it may not be entirely released until the CRT deinitializes. This is not a memory leak, but an optimization.
I did see a problem with your code, though:
*pwcArray = (wchar_t**)new wchar_t*[g_I+1];<br />
ZeroMemory(*pwcArray, sizeof(wchar_t*)*g_I+1);
Note that you are allocating g_I + 1. The last item is being used as a guard item. Yet when zeroing the memory, you are zeroing out 4001 bytes (when g_I is set to 1000), not 4004. You need to wrap parenthesis around g_I + 1 as follows:
ZeroMemory(*pwcArray, sizeof(wchar_t*)*(g_I+1));
I would recommend placing the wchar_t strings in a struct with a destructor and then making the array and array of these structures (or use string or CString).
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
for(int i=0; pwcDC[i] != NULL; i++)
//How can be the above expression can be valid one that
is the one which is checking "pwcDC[i] != NULL" in which
we may actually be doing ABR( Array bound read) or anything so.
I am begginer in this so can u help me in this ?.
Thanks
Pavan
|
|
|
|