|
Hi,
Why you put the code inside the custom draw function (OnNMCustomdrawProgress1) of the progress bar itself. This function is called only if the Progreesbar is having OWner draw style.Whether you want to show another progress control when the custom draw function of the progress1 is called???.
thanks,
Nitheesh
|
|
|
|
|
no,i need to draw a progress bar dynamically when i press a button and the progress should be shown untill a listbox is filled,what should i do for that???shouldn't i create a progresscontrol on dialog box????what else should i do???
RAJA
|
|
|
|
|
Why you dont use of ToolBox for make progressbar and also I told you you must remove declare of this control of a function.
|
|
|
|
|
i have used a toolbar to draw the progress abr only...but,I need the display of the progressbar when i click a button and the progress should be shown untill a operation is completed,and so,where should i add the progress bar???what coding has to be done??i don't get the progress shown if the above shown coding is put!!!!!!
RAJA
|
|
|
|
|
Hi,
Place your ProgressBar Creation code in OnInitDialog (override it) and make control hidden. Then in your button click event handler make it visible and set its bar position's.
Or
you can place a progress control bar and make it visible false. then do in button click event handler as said above.
And increment the bar position in the list fill function.
thanks
Nitheesh
|
|
|
|
|
Project RAJA wrote: ...while i run the project i can see only a empty progress bar,and no progress is shown...
So which is it, empty or invisible?
Did you mean to create the control at run time rather than at dsign time?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello
I Need A Simple MFC Project With Use DataBase In That and Programming Via Microsoft Visual Studio 2003 Like This Image :
http://i28.tinypic.com/n4b04g.jpg
My Project's Source Code Too Is Here :
http://uploadbazar.com/748PVD.zip
Please Help Me
How I Can Use Database In My Project ?
Thanks
Regards
Mohsen.Alipour@Hotmail.com
|
|
|
|
|
Mohsen.Alipour wrote: How I Can Use Database In My Project ?
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
as the topic,and also I want to get the Expection infomation if an exception threw out when compiling a source file,e.g stack overflow.There will be much information the program can catch.
how could I carry out this?any one can help me?
thanks in advance.
no cross no crown.
|
|
|
|
|
|
I'm using Visual C++ 6.0 - I'm new to windows programming.
I have a pop-up window where users enter data. It is setup as dialog using Visual C++. Sometimes I would like to display a note in this window that says "inches" and other times I would like this note to say "millimeters". I learned how to put up static messages, but I don't understand how to change them based on a variable in my C++ code. What is the simplest approach? Thanks ahead of time.
|
|
|
|
|
Are you using MFC? If so, you can add a CStatic control variable
to the window class, and use the CStatic::SetWindowText() method to
change the control's text.
You should be able to add the control object from the dialog editor...
right click the text control and chose "Add variable..." (I can't remember
exactly in VC6).
*edit* Actually, adding a string variable for the static control and using <br />
DDX is another possibly simpler MFC solution. I seem to have neglected that<br />
previously
If you use straight Win32, you can use the SetWindowText() API directly
on the control, something like:
HWND hwndControl = ::GetDlgItem(hwndDialog, IDC_MYSTATICCONTROL);
::SetWindowText(hwndControl, _T("New Text!"));
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the reply. Your answer changes the title of the window, but it led me to find the function:
void SetDlgItemText( int nID, LPCTSTR lpszString );
which seems to work okay for what I want.
|
|
|
|
|
For SetWindowText you need to a handle to controls but with SetDlgItemText you can use of control id.
|
|
|
|
|
Kwanalouie wrote: Your answer changes the title of the window
Not if the right HWNDs are used. For a static text/edit control HWNDs, the text
of the control should be set.
SetDlgItemText is great - it combines GetDlgItem() with SetWindowText() into one call
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: You should be able to add the control object from the dialog editor...
right click the text control and chose "Add variable..." (I can't remember
exactly in VC6).
you have to change name of IDC_STATIC to some else,to make editor aware that you want to add variable to that static control!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
You can use of Get/SetwindowText or WM_GETTEXT/WM_SETTEXT for get or set text toa control.
|
|
|
|
|
How can I free memory before returning the value in my function?. Here's the code, thank you very much.
int FindString(char*s, char* what, int len, int len2)
{
char * x = s;
for (int i = 0;i<len;i++,*x++)
{
if(memicmp(x,what,len2) == 0)
{
cout <<; "I found it @ " << i << endl;
return i;
}
}
return -1;
}
char *rr(char*s)
{
char cc[4] = {0x00,0x00,0x00,0x00};
int i =FindString(s,cc,512,4);
if( i > 0)
{
char * New = new char[i];
memcpy(New,s,i);
// How can I use 'delete' here before returning New???
return New;
}
return NULL;
}
|
|
|
|
|
Why do you want to delete the array before returning the pointer
to the caller? What are you trying to achieve?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You don't delete it before returning the Pointer. The function that called FindString receives this pointer. This calling function can do it's thing with the pointer, and, if needed return it again. When you're done with the value of the pointer you must call delete, otherwise you leak the memory. As soon as you call delete, the value of the pointer points no longer to valid memory, and may not be used again. Using it's value again is an error, and will lead sooner or later to unpredictible behaviour or even crashes.
regards
Bram van Kampen
|
|
|
|
|
Thanks for your answer. I was wondering if I had to return that pointer how to remove it if it was my desired return value. Thanks for your answer, Bram van Kampen. This way i'd be doing it fine??
<code>
int FindString(char*s, char* what, int len, int len2)
{
char * x = s;
for (int i = 0;i<len;i++,*x++)
{
if(memicmp(x,what,len2) == 0)
{
cout << "I found it @ " << i << endl;
return i;
}
}
return -1;
}
char *rr(char*s)
{
char cc[4] = {0x00,0x00,0x00,0x00};
char ReturnArray[1024] = {0};
int i =FindString(s,cc,512,4);
if( i > 0)
{
char * New = new char[i];
memcpy(New,s,i);
memcpy(ReturnArray,s,i);
delete[] New;
return ReturnArray;
}
return NULL;
} </code>
|
|
|
|
|
Hi,
U declared ReturnArray as a local buffer. ie it's scope is only within the function rr. So after the execution of rr ,ReturnArray will be destroyed. i think u r going to get a "memory cannot be read error" . am i right?.
thanks
Nitheesh
|
|
|
|
|
You could declare it as a global variable, outside the function instead:
char ReturnArray[1024] = {0};
<br />
char *rr(char*s)<br />
{<br />
char cc[4] = {0x00,0x00,0x00,0x00};<br />
|
|
|
|
|
These code put a string into name which is a column in database table
<br />
_RecordsetPtr rec; <br />
rec.CreateInstance(_uuidof(Recordset));<br />
<br />
CString cstrSQL;<br />
cstrSQL.Format("SELECT * FROM ... where ...");<br />
<br />
rec->Open(_bstr_t(cstrSQL), (IDispatch*)g_pConnections, adOpenDynamic, adLockOptimistic, adCmdText);<br />
rec->PutCollect("name",_variant_t("my name"));<br />
rec->Update();<br />
<br />
But,how to PutCollect a NULL value into this column?
|
|
|
|
|
_RecordsetPtr rec;
rec.CreateInstance(_uuidof(Recordset));
CString cstrSQL;
cstrSQL.Format("SELECT * FROM ... where ...");
rec->Open(_bstr_t(cstrSQL), (IDispatch*)g_pConnections, adOpenDynamic, adLockOptimistic, adCmdText);
if(sName =="") //NULL
{
rec->PutCollect("name", VT_NULL);
}
else
{
rec->PutCollect("name",_variant_t("my name"));
}
rec->Update();
|
|
|
|