|
Hi,
I´m using C++ and WMI to get hold of information from my network cards. The problem is that I only recieve information of my primary, Ethernet network card. I´m intrested to get information from both my primary and my wireless network card. When executing ExecuteQuery() with the query "Select * from win32_NetworkAdapter", is there anyway that I can get that into a list of "network adapters". Possible this already is done and put into the list object sent to exec.query, but I can´t get more than one item from it, even if my wireless network card is actice.
Does somebody have a clue of a solution of my problem. If I have been fuzzy in my description of the problem I can explain it more and hopefully better.
Torben00
|
|
|
|
|
Hi,
I want to find the path of a file for example test.xml.
If test.xml is located in C:\Temp\Data\test.xml, then by giving the file name (test.xml) as input, I want the path as output i.e C:\Temp\Data
Can anyone please help me to do this?
Thanks
Madhavi.
|
|
|
|
|
hi,
use the win32findfile data strcture an use cfindfile class mfc or findfile apis
|
|
|
|
|
Hello,
I'd like to run two successive dialogs in my dialog application. The problem is that when the user exits the first one and the application tries to run the second, it fails (I suspect the message pump gets destroyed).
I've tried creating a dummy window (so that there would always be at least one message target) before running the first dialog but that didn't help)
Any helps? Can I re-ren the pump again or prevent it from ceasing?
Thanks
|
|
|
|
|
|
dlg = new CPoolDlg;
m_pMainWnd = dlg;
int nResponse = dlg->DoModal();
delete dlg;
playoff_dlg = new CPlayoffDlg;
m_pMainWnd = playoff_dlg;
nResponse = playoff_dlg->DoModal();
delete playoff_dlg;
That's the code in InitInstance. I have to say I'm in no way a MFC guru. I played with the code a bit to make the CPoolDlg and CPlayoffDlg members of the CMyApp, and had to make them * in order to be able to create them after the common controls initialization is done. If I comment the first dialog out, the second runs wo problems, if I don't, the DoModal returns -1 (from what I know on some message pump checking call)
|
|
|
|
|
search in the MSDN for Q138681
or just comment the m_pMainWnd lines out.
dlg = new CPoolDlg;
int nResponse = dlg->DoModal();
delete dlg;
playoff_dlg = new CPlayoffDlg;
nResponse = playoff_dlg->DoModal();
delete playoff_dlg;
|
|
|
|
|
The problem you have is that you are setting the m_pMainWin to be a pointer to your first dialog.
MFC automatically terminates the thread (your application) when the window that m_pMainWnd is pointing to is closed. For further information see MSDN.
You could change the code to:
dlg = new CPoolDlg;
playoff_dlg = new CPlayoffDlg;
m_pMainWnd = playoff_dlg;
int nResponse = dlg->DoModal();
delete dlg;
nResponse = playoff_dlg->DoModal();
delete playoff_dlg;
Which will ensure that the application lives for the duration of the second dialog.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Thank you both guys, it works now
|
|
|
|
|
How should we create 3 Dimensional Graph(Pipe) in VC++ Using MFC?
For example if we give pipe length, breadth, radious How should we draw 3D Pipe?
K.V.K.Naidu
|
|
|
|
|
Hello!
Within a C++ program I need to get the disk quota for all users on a window-machine. I found the IDiskQuotaControl interface, which seems to be the right tool for this task, but I'm not sure how to use it properly (there are no examples in the msdn). Can anyone help me with this?
Thank you very much,
Markus
|
|
|
|
|
std7702 wrote:
I found the IDiskQuotaControl interface...but I'm not sure how to use it properly (there are no examples in the msdn). Can anyone help me with this?
How about:
HRESULT hr;
IDiskQuotaControl *pIDiskQuotaControl;
hr = CoInitialize(NULL);
if (SUCCEEDED(hr))
{
hr = CoCreateInstance(CLSID_DiskQuotaControl, NULL, CLSCTX_INPROC_SERVER, IID_IDiskQuotaControl, (void **) &pIDiskQuotaControl);
if (SUCCEEDED(hr))
{
...
pIDiskQuotaControl->Release();
}
CoUninitialize();
}
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
This looks good, thank you!
|
|
|
|
|
I am using a modeless dialog box with activex controls. If I remove the activex controls then it is working correctly otherwise it is giving assertion failure error
At the line containing dialogboxname.ShowWindow() function.
Tell me what is wrong.
babu
|
|
|
|
|
If the code is no too long, post the .h and .cpp files from your dialog class. This can help us a lot
|
|
|
|
|
I am using a modeless dialog box with activex controls. If I remove the activex controls then it is working correctly otherwise it is giving assertion failure error
At the line containing dialogboxname.ShowWindow() function.
Tell me what is wrong.
arun
|
|
|
|
|
how to update CFile in vc++.
i want to change data.
(for example)
//existing data
dataid=1
datades=data1
//updating data
dataid=1
datades=dataone
CFile is like as sql have new,delete,update.
i know only create file, read file.
i don't know update file.
vc++ have update file or not.
|
|
|
|
|
The Simplest way to do so is to open the file again and then write your new data. Actually, I always did so in the following way...;P
SOMETYPE SomeFunction()
{
CFile l_File; // local CFile object
l_File.Open( "C:\\FileName.txt",
CFile::modeCreate | CFile::modeReadWrite );
// using the open flags CFile::modeCreate OR CFile::modeReadWrite
// wrting your file by calling CFile::Write()
...
}
|
|
|
|
|
Sir...
my existing create code is following..
void ARMManagementRecords::SaveDomains()
{
// For domains
BOOL bCanSave = FALSE;
UINT nFlags = CFile::typeBinary | CFile::modeWrite;
// file doesn't exist, so create it
if (_access(DATA_FILE_DOMAIN, 0))
{
nFlags |= CFile::modeCreate;
bCanSave = TRUE;
}
else
{
bCanSave = CanSerializeDomain();
}
if (bCanSave)
{
CFile file;
CFileException fe;
// file exists with read & write permissions
if (file.Open(DATA_FILE_DOMAIN, nFlags, &fe))
{
CArchive arDomain(&file, CArchive::store);
//CStringArray m_domainArray;
m_domainArray.Serialize(arDomain);
}
file.Close();
}
}
|
|
|
|
|
|
does anybody have an idea why c++ would not allow the following:
const char * * cp = NULL;
char * * p = NULL;
cp = p;
i'm getting really disappointed by the language... only intelligent ideas, please!
|
|
|
|
|
because if this would be allowed, you'll be able to modify the const objects.
See:
<br />
const char p1 = 'a';
char* p2;<br />
const char** p3 = &p2;
*p3 = &p1;
*p2 = 'b';
Normally C++ standard allows you to cast from char* to const char* as it only adds the const . But the conversion from char** to const char** is problematic as you can see above.
[example taken from compl.lang.c++]
|
|
|
|
|
|
//this is tree view class
//CLeftTreeCtrl class
void CLeftTreeCtrl::EditCategory()
{
CAddDlg dlg; //call dialog
dlg.GetDlgItem(IDC_COM1)->EnableWindow(FALSE);
}
when i run my mdi application,it have no error.
but i call dialog, my application is not work.
i don't know.what happen??
|
|
|
|
|
You need to call dlg.DoModal in order to make your dialog appear on the screen. But as DoModal doesn't return until the user close it, you'll need to call GetDlgItem(IDC_COM1)->EnableWindow(FALSE); in the OnInitDialog from your dialog.
Hope this helps...
|
|
|
|