|
i have 3 tabs on tab control
when i click on one tab i dialogbox became show
but when i click on next tab new dialog became show but preveious
does not hide
i am using ShowWindow(0) and i have also try EndDialog(0)
here is my code
void CBargraphDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
CTabCtrl *c =(CTabCtrl*)GetDlgItem(IDC_TAB1);
int s=c->GetCurSel();
t=new txt;
t->Create(IDD_TXT);
bargraph=new graph;
bargraph->Create(IDD_GRAPH_DIALOG);
t2=new txt2;
t2->Create(IDD_TXT2);
if(s==0)
{
t2->ShowWindow(SW_HIDE);
bargraph->ShowWindow(SW_HIDE);
t->ShowWindow(1);
}
else if(s==1)
{
bargraph->ShowWindow(1);
t->ShowWindow(0);
t2->EndDialog(0);
//t2->ShowWindow(0);
}
else if(s==2)
{
t2->ShowWindow(1);
t->ShowWindow(0);
bargraph->ShowWindow(0);
}
*pResult = 0;
}
|
|
|
|
|
Shift Dialog creation code zto InitDialog.
-@SuDhIrKuMaR@-
|
|
|
|
|
ani_ikram wrote: t2->ShowWindow(SW_HIDE);
bargraph->ShowWindow(SW_HIDE);
Why didn't you use similar code in following options and instead of 0/1 use
SW_HIDE/SW_SHOW.
also as sudhir has already suggested you are every time creating dialogs in SelChange notification.
you can move them to InitDialog as suggested by sudhir.
Regards,
Sandip.
|
|
|
|
|
SandipG wrote: Why didn't you use similar code in following options and instead of 0/1 use
SW_HIDE/SW_SHOW.
Especially since SW_SHOW is 5
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I want to rename my exists VC6.0 project, how to do it correctly?
Many thanks.
|
|
|
|
|
|
The tools you suggested works fine. Many thanks, and I vote 5 for you.
|
|
|
|
|
|
chnage the name, what is the problem.. i hope you are talking about dsw files.
"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/xml>
|
|
|
|
|
I have cleared some doubts regarding combo box in one of my earlier threads.Had got the solution too.I have a new problem..
I have two dialogs as I told before.there is a combo box in the first dialog.i have a text box in the second dialog.when i click a button, i get the second dialog in which the text box is present.i get the data in the text box in the combo box when i click the ok button .have written code for that.my problem is , i have to see all the data that i enter in the text box in the second dialog into the combo box in first dialog.now what happens is, i can only see the last entered item.i have written it i the OnOK function ,but have commented CDialog::OnOk();
I need to enter details as long as i want and see them all in the first combo box. what to do?
Code in second dialog:
CString i;<br />
fstream f;<br />
f.open("C:\\myfile.txt",ios::app); <br />
printf("\n");<br />
<br />
GetDlgItemText(IDC_EDIT2,str_name);<br />
f.write(str_name.GetBuffer(str_name.GetLength()),str_name.GetLength()); <br />
f<<endl;<br />
<br />
m_combo.AddString(str_name); <br />
<br />
m_edit3.SetWindowText(_T(""));<br />
f.close();
in first dialog:
Add cd;<br />
cd.DoModal();<br />
<br />
m_selcam.AddString(cd.str_name);
|
|
|
|
|
|
projectip wrote: m_combo.AddString(str_name);
Which combo box variable is this.
for adding multiple strings you can create a modeless dialog and use SendMessage(..) to parent dialog
to add strings.
I hope it makes sense.
projectip wrote: Add cd;
cd.DoModal();
and you are able to see only one string because
projectip wrote: m_selcam.AddString(cd.str_name);
this will execute only when DoModal() will return.
Regards,
Sandip.
|
|
|
|
|
m_combo is in the second dialog...thats just for debugging purpose.
|
|
|
|
|
Hi all,
I want to make enteries in Add or remove programs(control panel)Programmatically.
how can i do this???
Thanks in advance
|
|
|
|
|
CRegEdit is class that would help you add your entries in the Registry location
"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/xml>
|
|
|
|
|
These day i practice ACM problem.
and many times, i can't understand problem.
i am studying by "Programming challenges" book.
but that book only give me problom, not answer.
what i want to say is i want to know tip.
May be there are people who solve problom, and i don't want to code or source, i just want to know how they can solve that problem.
so, do you know website about ACM problom and tip?
firstly, i am sorry, i am from korea.
and i am not good in wriitting english so please understand~
Thank you everyone~
|
|
|
|
|
You can try posting a specific problem in the Mathematics and Algorithms forum and ask for a tip. There are many people there that will help you.
|
|
|
|
|
Hi,
Why ShellExecuteEx is suggestible to use over CreateProcess,WinExec in Vista. What is the disadvantage if I still continue to use CreateProcess,WinExec in Vista.
Thanks,
Venkat
|
|
|
|
|
WinExec function is provided only for compatibility with 16-bit Windows. So even if you are using windows XP, you should not use it.
venkat.kupunaram wrote: Why ShellExecuteEx is suggestible to use over CreateProcess
who suggested?
|
|
|
|
|
CreateProcess gives you more control over the spawned process u start, you can spawn it as a different user or different security priveledges and a whole lot more.
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius and a lot of courage to move in the opposite direction." -Albert Einstein
|
|
|
|
|
Roughly speaking:
-ShellExecute is more developer-friendly.
-CreateProcess gives the developer more control.
I don't know about particular issues related to Vista OS .
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello,
i have the following problem (i think it is a beginner question but i hope to get an informative answer!)
Actually i try to get the BatteryDeviceName of my notebook. I use the code snipped from the MSDN.
But at these step iam hanging because the DeviceIoControl returns a BATTERY_INFORMATION structure, because the InformationLevel (bqi) is set to BatteryInformation. BUT I want the BatteryDeviceName, so I changed the Information Level. Then the IOCTL_BATTERY_QUERY_INFORMATION should return a null terminated unicode string.
My question is how can i store this ?string?
Here is my code:
BATTERY_INFORMATION bi = {0};
bqi.InformationLevel = BatteryDeviceName;
if(DeviceIoControl(hBattery,IOCTL_BATTERY_QUERY_INFORMATION,&bqi,sizeof(bqi),&bi,sizeof(bi),&dwOut,NULL))
{
MessageBox(NULL,L"#8 - IOCTL_BATTERY_QUERY_INFORMATION ... OK",L"",MB_ICONINFORMATION);
MessageBox(NULL,L"[BatteryDeviceName should be here !!!]",L"",MB_ICONINFORMATION);
}
As you can see i need to replace the bold line or more to store the String.
I hope someone can help me.
Thanks,
gabbana
|
|
|
|
|
Maybe something like this:
wchar_t szBatteryDeviceName[260];
bqi.InformationLevel = BatteryDeviceName;
if(DeviceIoControl(hBattery,IOCTL_BATTERY_QUERY_INFORMATION,&bqi,sizeof(bqi),szBatteryDeviceName,sizeof(szBatteryDeviceName),&dwOut,NULL))
{
...
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Great thank you, but i have one problem:
If I use the szBatteryDeviceName in the MessageBox, he prints the correct batterydevicename but adds a part of the application path, so i think it ignores the null terminated string ?
|
|
|
|
|
Interesting - I wouldn't expect that.
I guess you could add the null terminator yourself:
wchar_t szBatteryDeviceName[260];
bqi.InformationLevel = BatteryDeviceName;
if(DeviceIoControl(hBattery,IOCTL_BATTERY_QUERY_INFORMATION,&bqi,sizeof(bqi),szBatteryDeviceName,sizeof(szBatteryDeviceName),&dwOut,NULL))
{
szBatteryDeviceName[dwOut/sizeof(wchar_t)] = 0;
...
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|