|
I need to open / read a URL that has PostData. The PostData is long (ASP.Net, so includes the __VIEWSTATE). I just dont know how to send a post back to the server. I am sure its simple, but I have searched and cant find anthing.
An Expert is somone who has previously made ALL the Mistakes, I dream of this day. - Lucky
www.mpic3.com - My PIC based MP3 player project
|
|
|
|
|
The following refers to an application I am writing in VC++ 6.
I want to add some items to a list box in a dialog. I understand that this involves something called DDX, which, as far as I am aware is something that the IDE sorts out for me.
I have added a public variable to the dialog class via the Class Wizard to be associated with the List box - m_listGTTimeUnits.
Now, the application is a Windows Explorer style application and the dialog appears when I right-click over the right hand pane.
I have tried a couple of ways to add values to the list box, both of which allow the code to compile but cause the program to crash with the message "Debug assertion failed" when the dialog is called...
Firstly...
<br />
void CRightView::OnRightmenuEditnode() <br />
{<br />
...<br />
CEditNodeDlg dlg;<br />
dlg.m_listGTTimeUnits.AddString("days");<br />
...
and secondly
<br />
void CRightView::OnRightmenuEditnode() <br />
{<br />
... <br />
CListBox * pList = (CListBox*) dlg.GetDlgItem(IDC_LISTLTTIMEUNITS);<br />
pList->AddString("days");<br />
...<br />
If anyone has any idea of what it is that I am doing wrong, I would be very glad to hear!
Thanks,
Ben.
modified on Saturday, January 26, 2008 10:47:25 AM
|
|
|
|
|
Ben Aldhouse wrote: CEditNodeDlg dlg;
dlg.m_listGTTimeUnits.AddString("days");
Ben Aldhouse wrote: void CRightView::OnRightmenuEditnode()
{
...
CListBox * pList = (CListBox*) dlg.GetDlgItem(IDC_LISTLTTIMEUNITS);
pList->AddString("days");
...
In the above handlers, you created an instance of your dialog but you never created the dialog window.
Why do you need to update the list box from the view? Cannot you update it from the dialog itself?
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.
[my articles]
|
|
|
|
|
These are just snippets, I have the following lines later on
<br />
<br />
if (dlg.DoModal () == IDOK)<br />
{ <br />
myPNode->SetNodeDescr(dlg.m_strNodeDesc);<br />
<br />
<br />
if (dlg.m_strNodeDesc != oldDesc)<br />
pDoc->SetModifiedFlag();<br />
}<br />
I wouldn't mind adding the items to the list box in the dialog itself if I knew how to. I've tried adding them in the dialog class constructor but this doesn't work, either. I am beginning to think that I should overload the base classes 'OnInitDialog' function. I've just tried to creating this in the dialog...
<br />
<br />
bool CEditNodeDlg::OnInitDialog()<br />
{<br />
m_listGTTimeUnits.AddString("days");<br />
<br />
}<br />
<br />
but I am getting 'error C2555: 'CEditNodeDlg::OnInitDialog' : overriding virtual function differs from 'CDialog::OnInitDialog' only by return type or calling convention' and I'm not sure what to do about this.<br />
<br />
|
|
|
|
|
Ben Aldhouse wrote: I am beginning to think that I should overload the base classes 'OnInitDialog' function. I've just tried to creating this in the dialog...
This is the way to go.
Ben Aldhouse wrote: bool CEditNodeDlg::OnInitDialog()
Replace bool with BOOL .
BTW Why don't you make the Visual Studio make the work for you (select your dialog on class explorer, right click and choose Add Windows Message Handler item)?
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.
[my articles]
|
|
|
|
|
|
I've got it! Thanks for your help! Basically I needed to change 'bool' to 'BOOL'.
<br />
BOOL CEditNodeDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
m_listGTTimeUnits.AddString("days");<br />
<br />
return TRUE;<br />
}<br />
|
|
|
|
|
Hi all, i found this example on MSDN. Im trying to find out how i can accomplish what im trying to do, and thats monitor the events of a application.
So here's the code...
<br />
#include <windows.h><br />
<br />
int main(){<br />
HOOKPROC hkprcSysMsg;<br />
static HINSTANCE hinstDLL;<br />
static HHOOK hhookSysMsg;<br />
<br />
hinstDLL = LoadLibrary((LPCTSTR) "c:\\windows\\notepad.dll");<br />
hkprcSysMsg = (HOOKPROC)GetProcAddress(hinstDLL, "SysMessageProc");<br />
hhookSysMsg = SetWindowsHookEx(WH_SYSMSGFILTER,hkprcSysMsg,hinstDLL,0);<br />
return 0;<br />
}<br />
</windows.h>
I've noticed that i dont have notepad.dll - It may not be new to some but it is to me seeing how i've never had to look for it. So what would i have to do to monitor notepads events? Also, what char would i dump the messages from to a fstream .txt file? Thanx in advance!
|
|
|
|
|
dellthinker wrote: I've noticed that i dont have notepad.dll
You have to build it (of course you don't need to call it notepad.dll): if you need a global hook (and you need a global one to hook another process like notepad) the you have to create a DLL hosting your hook procedure.
I strongly suggest you to read MSDN documentation about hooks [^].
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.
[my articles]
|
|
|
|
|
Hi CPallini,
I developing an application that hooks the Open/Save dialog for getting the selected file path. currently am able to hook the common dialog but it's not working on office Open/Save dialog. On Searching i found that Office is using separate Open/Save dialog. Can anyone help me to identify the Office Open/Save dialog messags equivalent that of common dialog's
CDN_INITDONE
CDN_FILEOK
CDM_GETFILEPATH
CDM_GETFOLDERIDLIST
CDM_GETFOLDERPATH
CDM_GETSPEC
CDM_HIDECONTROL
CDM_SETCONTROLTEXT
CDM_SETDEFEXT
.
I think you can help me to solve this out.
thanks
Nitheesh
|
|
|
|
|
Well I'm not an expert, but I read some time ago that Office rolls its own controls and maybe the controls themselveles don't even use messages as communication mechanism (but I maybe wrong).
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.
[my articles]
|
|
|
|
|
Hi CPallini,
thank you for you reply.
Nitheesh
|
|
|
|
|
dear friends
the following code is right? i would like to assign :
createArray(a);//initialize 10 3x4 arrays
fitFunc(fitness);//one arrays containing 10 values
double minValue = fitness[9];
for (int i =0;i<10;i++)
{
if (fitness[i] < minValue)
{
minValue = fitness[i];
gbest[i][3][4]=a[i][3][4];
cout << " "<< gbest[i][3][4]<<endl;
}
}
thanks a lot..urgent
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: the following code is right?
If it accomplishes your intended purposes, then yes.
I mean:
You're computing the minimum value of fitness array (and storing it into minValue ) and each time you find a currently mininmum value, say fitness[k] , you copy the corrensponding a[k][3][4] element into gbest[k][3][4] (all other
gbest elements remaining untouched) eventually displaying the copied element.
Is the above your target?
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.
[my articles]
modified on Saturday, January 26, 2008 5:42:07 AM
|
|
|
|
|
dear friends
i mean:
fitness[10] has 10 elements..when i get minimum of fitness[10], then i should know which position of fitness, for example:fitness[6] or fitness[8]..and so on....
and then i will assign corresponding a[i][3][4] to gbest[i][3][4]...because i finally use gbest[i][3][4]....if the fitness[6] is the minimum value of fitness[10]..then i assign a[6][3][4] to gbest[6][3][4]...
thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: fitness[10] has 10 elements..when i get minimum of fitness[10], then i should know which position of fitness, for example:fitness[6] or fitness[8]..and so on....
Then you have to update also an index when you update the minimum, for instance
int minIndex;
minIndex = 9;
double minValue = fitness[minIndex];
for (int i =0;i<10;i++)
{
if (fitness[i] < minValue)
{
minIndex = i;
minValue = fitness[minIndex];
}
}
at the end, you know, for instance that minimum value (that correnspond to minValue ) is in fitness[minIndex] .
li zhiyuan wrote: and then i will assign corresponding a[i][3][4] to gbest[i][3][4]...because i finally use gbest[i][3][4]....if the fitness[6] is the minimum value of fitness[10]..then i assign a[6][3][4] to gbest[6][3][4]...
Sorry I don't understand the above.
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.
[my articles]
|
|
|
|
|
thanks brother
the problem is that: i can't assign a[i][3][4] to gbest[i][3][4]....
the code is following:
createArray(a);//create 10 3x4 arrays
fitFunc(fitness);//calculate fitness vale of one array containing 10 values
double minValue = fitness[9];
for (int i =0;i<10;i++)
{
if (fitness[i] < minValue)
{
minValue = fitness[i];
cout <<endl<<" " <<"Position of minimum fitness value :"<<" "<<"minimum value is :"endl;
cout<<" " << i<<" "<< minValue<<endl;
gbest[i][3][4]=a[i][3][4];
cout << " "<< gbest[i][3][4]<<endl;
}
}
so brother, the problem is in gbest[i][3][4] = a[i][3][4];...above this point, it is right...
Li Zhiyuan
5/10/2006
|
|
|
|
|
Why can't you? Do you get an error?
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.
[my articles]
|
|
|
|
|
compilation had no errer...but the result is wrong.
just i got one value from equation gbest[i][3][4]=a[i][3][4]...not 3x4 array..so what happened? i dun know? too urgent...i have a little things to finish..but cost too my whole day...thanks..brother
Li Zhiyuan
5/10/2006
|
|
|
|
|
if you need to copy the whole 3x4 array you can use one of the following approaches:
(1) use an iteration over all the array elements, i.e. change from
gbest[i][3][4]=a[i][3][4];
(BTW, the above code is wrong, you're accessing elements out of the array boundaries)
to
for (j=0; j<3; j++)
for (k=0; k<4; k++)
gbest[i][j][k]=a[i][j][k];
(2) do a crude copy of memory, i.e. change
gbest[i][3][4]=a[i][3][4];
to
memcpy(&gbest[i], &a[i], 3*4*sizeof(a[0][0][0]));
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.
[my articles]
|
|
|
|
|
thanks friend, i solved problem, by the way, how to plus elements of two multiarrays?
i mean it will plus corresponding position value of two multiarrays?thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: how to plus elements of two multiarrays?
i mean it will plus corresponding position value of two multiarrays?thanks
Please elaborate, I don't understand.
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.
[my articles]
|
|
|
|
|
hi am using vc++ mfc and pocket pc6.0.
i has 2 file in a same name.
1.windows\paul
2.temp\paul
i was used a code shellexecuteex to open files.
but it defaultly open windows\paul file.
to change the folder, what is the procedure?
can anybody help me?
paulraj
|
|
|
|
|
You can use this way.
#include <fstream>
std::fstream fw("C:\\WINDOWS\\paul", std::ios::in);
std::fstream ft("C:\\temp\\paul", std::ios::in | std::ios::out | std::ios::app);
Maxwell Chen
|
|
|
|
|
gnanapaul wrote: to change the folder, what is the procedure?
SetWorkingDirectory() , but changing folders is not necessary just to open a file.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|