|
pDUMMY = _tcstoul( sztTmp, NULL, 0 );
passing the 0 means that if the string starts with 0x then it's assumed to be hex, if it starts with 0 and not an x then it's assumed to be octal, and otherwise it's assumed to be a decimal value so it's rather flexible.
you can pass 16 instead if you always assume the value is hexadecimal.
|
|
|
|
|
Rick York wrote: pDUMMY = _tcstoul( sztTmp, NULL, 0 );
actually you have to do
*pDUMMY = _tcstoul( sztTmp, NULL, 0 );
note the pointer dereference operator.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
It works.... haha!... thank you guys, you saved me!!!
|
|
|
|
|
can any one give me the difference between lib and dll in detail?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Static library is a lib, while a dynamic library is a DLL.
The problem with libs is that they limit the user to a specific compiler. Where as DLL are more flexible. When using libs a programmer never has to be in a worry of that .lib file being present on the user's machine while dll's impose such dependencies.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
.lib files help up match up the actuall library(.DLL) It's called implicit linking. .lib files get created when you export functions using .DEF file. Once done you can include this .lib file in your application and start using the DLL as if it's available in a .cpp file. (implementation). The .lib file takes care of mathing the call to the dll.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
hi,
Anybody knows how to add a string in front of another string and also at the back of the string. Here is the code that generate unhandled exception and access violation error.
Thanks for any reply.
{ char myfilename[15];
char Pathn[20]="";
strcat(Pathn,"c:/My File/");
int coord;
fSrc>>myfilename;
for(int l=0;l<6;l++)
{
testIC[l]=ICname[l];
}
strcat( ICname, " output.txt" );
strcat(Pathn,ICname);
outputfile=("%s",Pathn);}
|
|
|
|
|
It's obvious that Pathn is not large enough.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Don't use raw char arrays without a compelling reason to do so. Use std::string instead.
Steve
|
|
|
|
|
if its problem with std::string...........try to use this
_tcscat(ICname, " output.txt") also increase the array size or dynamically create the array........
syam
|
|
|
|
|
Sorry for such a simple question im sure, but how does a person make sure data types are correct for creating an easy robust program.
code : cout << "Enter number of terms" << endl;
cin >> terms;
I want to make sure terms is an Interger type, can i do that with an if statment?
if (terms = ?(some function call))
or is there another way to code to make sure what is entered is an Integer and not a character or string value?
If at first you don't succeed .... DENY EVERYTHING!
|
|
|
|
|
Lasoryth wrote: or is there another way to code to make sure what is entered is an Integer and not a character or string value?
There are several functions you can call that will tell you. Check out isdigit() and isalpha() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi All,
I was hoping someone might be able to lead me to some information regarding the screensaver settings. I have been tasked with implementing some functionality to programmatically set the Screensaver timeout period as well as ensure the "On resume, password protect" option under the Desktop->Properties.
I found what I think is a simple way to set the timeout period, utilizing the SystemParametersInfo call. It seems straight-forward, just make the following call:
SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 30*60, NULL, SPIF_SENDWININICHANGE);
Now the problem - I need to be able to uncheck the "On resume..." option, which I cannot seem to find a way to do.
|
|
|
|
|
Al_Pennyworth wrote: Now the problem - I need to be able to uncheck the "On resume..." option, which I cannot seem to find a way to do.
Have you checked the registry?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i'm quite new to mfc/c++ and i'm trying to create a really simple dialog box which controls the master volume of a simple form view application.. i've created the dialog and the variables to control the master volume in the form class (i've tested by creating a control in the form view and this works fine) but when i try to access and alter the form parameter from the dialog using a pointer and GetParent() during OnTimer(), it just does nothing... am i missing something?
thanks in advance
|
|
|
|
|
bimgot wrote: am i missing something?
Just a WAG: UpdateData()
led mike
|
|
|
|
|
have tried UpdateData()
does the dialog class require any settings in order to access the parent variables? i've even tried just very simple variable tests in OnTimer in the dialog class and it seems to have no effect on them.. is OnTimer even the right function to be using? i use it in the main form for a simelar process so i figured it would be but perhaps its different for dialogs?
|
|
|
|
|
bimgot wrote: ...it just does nothing...
Which means "nothing" without any supporting data. Does GetParent() return the correct parent address? How about a snippet of code that shows what does not work?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
OnTimer in the dialog class:
void CDlg::OnTimer(UINT_PTR nIDEvent)
{
CDialog::OnTimer(nIDEvent);
dlg_level = dlg_sldr.GetPos();
CformView* form = (CformView*) GetParent();
form->form_level = dlg_level;
form->UpdateData(TRUE);
UpdateData(TRUE);
}
then from form view class:
void CformView::OnViewDlg()
{
CDlg dialog;
dialog.dlg_level = form_sldr.GetPos();
dialog.DoModal();
}
hope this makes sense
|
|
|
|
|
UpdateData (TRUE) puts the values currently in the controls into the variables. You need to call UpdateData (FALSE) to move the variable values into the screen controls. Note that I have added a line. This is so that if you have other controls on the screen, you won't lose the values the user might have changed on the screen when you call UpdateData (FALSE).
void CDlg::OnTimer(UINT_PTR nIDEvent)
{
CDialog::OnTimer(nIDEvent);
dlg_level = dlg_sldr.GetPos();
CformView* form = (CformView*) GetParent();
UpdateData (TRUE);
form->form_level = dlg_level;
form->UpdateData(FALSE);
UpdateData(TRUE);
}
Judy
|
|
|
|
|
JudyL_FL wrote: UpdateData (TRUE) puts the values currently in the controls into the variables. You need to call UpdateData (FALSE) to move the variable values into the screen controls.
All the more reason why UpdateData() should rarely, if ever, be used.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
thanks very much, i understand UpdateData a bit more now,
i think i must have initialised something incorrectly, this still doesnt seem to update the values in the form.. the pointer to the main form is working correctly, if i call something like form->CloseWindow() during OnTimer it works..
i'm using OnTimer() in the main form to actually call the function which sets the volume:
void CformView::OnTimer(UINT_PTR nIDEvent)
{
CFormView::OnTimer(nIDEvent);
SetVolume(form_level);
UpdateData(FALSE);
}
would this still get called during the life of the dialog or do i need to set the volume somewhere else?
also is it possible some of the properties of the dialog could be effecting things?? really racking my brain here..
thanks
|
|
|
|
|
How does this answer the question, "Does GetParent() return the correct parent address?"
void CDlg::OnTimer(UINT_PTR nIDEvent)
{
CDialog::OnTimer(nIDEvent);
dlg_level = dlg_sldr.GetPos();
CformView* form = (CformView*) GetParent();
form->form_level = dlg_level;
form->UpdateData(TRUE);
UpdateData(TRUE);
}
void CformView::OnViewDlg()
{
CDlg dialog;
dialog.dlg_level = form_sldr.GetPos();
dialog.DoModal();
} Since CDlg is a modal dialog, I question whether this will even work, since messages sent to its parent will be blocked until DoModal() returns.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
void CDlg::OnTimer(UINT_PTR nIDEvent)
{
CDialog::OnTimer(nIDEvent);
dlg_level = dlg_sldr.GetPos();
CformView* form = (CformView*) GetParent();
// form points to the main form class correctly
form->form_level = dlg_level;
form->UpdateData(TRUE);
UpdateData(TRUE);
}
void CformView::OnViewDlg()
{
CDlg dialog;
// this points to the main form class as this is a member function
dialog.dlg_level = form_sldr.GetPos();
dialog.DoModal();
}
i did consider a modal dialog as bieng inappropriate for this but was unsure as i dont actually need to control the main window whilst the dialog is open, i just want to update some variables..
|
|
|
|
|
bimgot wrote: ...i dont actually need to control the main window whilst the dialog is open, i just want to update some variables..
So why call UpdateData() then?
void CformView::OnViewDlg()
{
CDlg dialog;
dialog.dlg_level = form_sldr.GetPos();
dialog.DoModal();
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|