|
eli15021979 wrote:
with CMonthCalCtrl I can use the GetCurSel() to get the selected date.
Makes much more sense. Glad you are working now.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi all !
I have developed the application. in my main class, I call 8 thread . The main class must to wait all 8 Thread end to continute do something. How to known all 8 Thread ended ?
pls, help me !
Thank alots
|
|
|
|
|
You can use the WaitForMultipleObjects function using HANDLEs to your threads and setting bWaitAll to TRUE.
|
|
|
|
|
Take a look at WaitForSingleObject in the MSDN[^]
|
|
|
|
|
Don't you mean WaitForMultipleObjects() ?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Yes, but it's monday so you have to be indulgent
I tried to modify my post but I was unable to do it.
|
|
|
|
|
|
Hello everybody?
I am trying to know how I can detect changes in data streams.
But I don’t have any practice this field.
I found 1 paper and read it. But I didn’t understand fluently it. ( http://www.cs.technion.ac.il/~shai/vldb04.pdf)
If you have any idea about detecting changes in data streams, can you help me?
Also can you explain to me algorithm that presented paper?
What is distance anything?
My e-mail address is u_bulga@yahoo.com.
Thank you so much for your help.
Thank you
|
|
|
|
|
ah ah ah
well, don't move, i do it for you, and i send it into you check box, this way, nobody will benefit the work, and you will be the only owner after that...
do you really think an email is welcome on a forum where SHARING is the word ???
moreover, for a first post, i find it of a very bad gust : how many forums are you going to cross post[^] ?
get out of here and do your homework yourself !
sorry, but i had to vote you down
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
My english ability is so bad. So I didn't understand that paper and algorithm.
If you understand it can you explain to me pls?
|
|
|
|
|
how can i trick a sdi application in such a way so i can insert a dialog area next to it ? or... what to do to insert that sdi aplication, over a dialog form ?.... My application has to be a Windows Explorer embedded on a dialog form, that has several others buttons on it... so... i have found an aplication simillar with what i need... an Windos Explorer kind .. but it's a SDI using a splitter... is there any simple way for gettin that on the Dialog's area ?
I need to make it done in VC6.0 !
Thanks
|
|
|
|
|
You could add another splitter pane for the dialog or use a CDialogBar. There are probably many more ways to go.
|
|
|
|
|
|
Anyone know how to do this?
I've tried calling CMultiDocTemplate::OpenDocumentFile() with bMakeVisible=FALSE but how do you then initialize and show the window correctly *without* bringing it to the front.
Or is there another way?
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.1.2 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
make your function ActivateFrame look like this,
void CChildFrame::ActivateFrame(int nCmdShow) <br />
{<br />
CMDIChildWnd::ActivateFrame(nCmdShow);<br />
BOOL ret=SetWindowPos(&CMDIChildWnd::wndBottom, 0, 0, 0, 0,<br />
SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);<br />
<br />
}
|
|
|
|
|
Thanks for this. Unfortunately, it doesn't quite work. The window that is currently active loses focus to the new window and things don't draw properly if the child windows are maximized.
I tried saving the currently-active MDI child window (by calling MDIGetActive()) and then making it active again after creating the new background window but this is problematic for me since my app does some processing when child windows gain and lose focus.
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.1.2 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hi,
I grouped some buttons in the Group box and When I hiding the Groupbox, I want to hide all the controls in it without doing individual hide.
How can i do that...?
OR
Any other controls in MFC to act like this?
please help mee
thanks in advance
shijuck
|
|
|
|
|
as it is not VB, you cannot act directly on all the controls of a group box by setting its property to hide/show. you can however write a function which will do the job, and then, call the function once.
there is anyway one bad method which need you to set the controls IDs consecutive, and then making something like this :
<font color=blue>void</font> MyGroupBox::theFunction(<font color=blue>int</font> newState) {
<font color=green>
<font color=blue>int</font> iFirstId = <font color=purple>IDC_CONTROL_1</font>;
<font color=blue>int</font> iLastId = <font color=purple>IDC_CONTROL_N</font>;
<font color=blue>for</font> (<font color=blue>int</font> i = iFirstId; i < iLastId; i++) {
((CWnd*)GetDlgItem(i))->ShowWindow(newState);
}
}
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You can use GetDlgItem() and then GetNextWindow() to iterate over all controls in a group (checking the WS_GROUP flag). You need however to be very diciplined when setting these flags in your dialog/form.
|
|
|
|
|
See here and here (I've used this one).
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I have compiled my code in VC 7.1. It was written in VC 6.0.
Following is the compilation error I get:-
error C2872: 'IXMLDOMNodePtr' : ambiguous symbol
Has any one face a similar problem ? Any solution for it.
Best Regards,
|
|
|
|
|
try using namespace::IXMLDOMNodePtr instead...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
This error comes in file which is in the folder of the MS VS 2003. I cant modify it. How can I remove this ambuigity, any idea ???
Best Regards,
|
|
|
|
|
I used the function bellow:
HRESULT ConfigNet()
{
IWbemLocator *pLocator=NULL;
IWbemServices *pNamespace=NULL;
IWbemClassObject *pClass=NULL;
IWbemClassObject *pInputParamClass=NULL;
IWbemClassObject *pInputParamInstance=NULL;
IWbemClassObject * pOutInst = NULL;
BSTR InstancePath = SysAllocString(L"Win32_NetworkAdapterConfiguration=2");
HRESULT hr;
BSTR Path = SysAllocString(L"\\\\MyComputerName\\root\\cimv2");
BSTR ClassPath = SysAllocString(L"Win32_NetworkAdapterConfiguration");
BSTR MethodName = SysAllocString(L"EnableStatic");
LPCWSTR Arg1Name = L"IPAddress";
VARIANT var1;
LPCWSTR Arg2Name = L"SubnetMask";
VARIANT var2;
__try
{
CreateOneElementBstrArray(&var1, L"10.0.0.101");
CreateOneElementBstrArray(&var2, L"255.255.255.0");
CoCreateInstance(CLSID_WbemLocator, 0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID*)&pLocator);
hr = pLocator->ConnectServer(Path,NULL, NULL, NULL, 0, NULL, NULL,
&pNamespace);
hr = CoSetProxyBlanket( pNamespace,
RPC_C_AUTHN_WINNT,
RPC_C_AUTHZ_NONE,
NULL,
RPC_C_AUTHN_LEVEL_CALL,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE);
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pNamespace->GetObject(ClassPath, 0, NULL, &pClass, NULL);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pClass->GetMethod(MethodName, 0, &pInputParamClass, NULL);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pInputParamClass->SpawnInstance(0, &pInputParamInstance);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pInputParamInstance->Put(Arg1Name, 0, &var1, 0);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pInputParamInstance->Put(Arg2Name, 0, &var2, 0);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pNamespace->ExecMethod(InstancePath, MethodName, 0, NULL,
pInputParamInstance, &pOutInst, NULL);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
}
__finally
{
if(pInputParamInstance)
pInputParamInstance->Release();
if(pInputParamClass)
pInputParamClass->Release();
if(pClass)
pClass->Release();
if(pNamespace)
pNamespace->Release();
if(pLocator)
pLocator->Release();
}
return hr;
}
every function works well. but nothing changed.
Why??
BSTR Path = SysAllocString(L"\\\\MyComputerName\\root\\cimv2");
for a test,the above line must be modified.replace "MyComputerName" with your own computer name.
Thank you everyone.
|
|
|
|
|
I found i'd better post all the code here. a console application.;P
#define _WIN32_DCOM
#include <wbemidl.h>
#pragma comment(lib,"Wbemuuid.lib")
#include <atlbase.h>
//#include "wbemcli.h"
#include "objbase.h"
#include <windows.h>
#include <comutil.h>
#pragma comment(lib, "comsupp.lib")
void CreateOneElementBstrArray(VARIANT* v, LPCWSTR s)
{
SAFEARRAYBOUND bound[1];
SAFEARRAY* array;
bound[0].lLbound = 0;
bound[0].cElements = 1;
array = SafeArrayCreate(VT_BSTR, 1, bound);
long index = 0;
BSTR bstr = SysAllocString(s);
SafeArrayPutElement(array, &index, bstr);
SysFreeString(bstr);
VariantInit(v);
v->vt = VT_BSTR | VT_ARRAY;
v->parray = array;
}
HRESULT __fastcall UnicodeToAnsi(LPCOLESTR pszW, LPSTR* ppszA)
{
ULONG cbAnsi, cCharacters;
DWORD dwError;
// If input is null then just return the same.
if (pszW == NULL)
{
*ppszA = NULL;
return NOERROR;
}
cCharacters = wcslen(pszW)+1;
// Determine number of bytes to be allocated for ANSI string. An
// ANSI string can have at most 2 bytes per character (for Double
// Byte Character Strings.)
cbAnsi = cCharacters*2;
// Use of the OLE allocator is not required because the resultant
// ANSI string will never be passed to another COM component. You
// can use your own allocator.
*ppszA = (LPSTR) CoTaskMemAlloc(cbAnsi);
if (NULL == *ppszA)
return E_OUTOFMEMORY;
// Convert to ANSI.
if (0 == WideCharToMultiByte(CP_ACP, 0, pszW, cCharacters, *ppszA,
cbAnsi, NULL, NULL))
{
dwError = GetLastError();
CoTaskMemFree(*ppszA);
*ppszA = NULL;
return HRESULT_FROM_WIN32(dwError);
}
return NOERROR;
}
void PrintWMIError(HRESULT hr)
{
IWbemStatusCodeText * pStatus = NULL;
HRESULT hres = CoCreateInstance(CLSID_WbemStatusCodeText, 0,
CLSCTX_INPROC_SERVER,IID_IWbemStatusCodeText, (LPVOID *) &pStatus);
if(S_OK == hres)
{
BSTR bstrError;
hres = pStatus->GetErrorCodeText(hr, 0, 0, &bstrError);
if(S_OK != hres)
bstrError = SysAllocString(L"Get last error failed");
LPSTR pszStatusTextA;
UnicodeToAnsi(bstrError, &pszStatusTextA);
printf("%s\n",pszStatusTextA);
CoTaskMemFree(pszStatusTextA);
pStatus->Release();
SysFreeString(bstrError);
}
}
HRESULT ConfigNet()
{
IWbemLocator *pLocator=NULL;
IWbemServices *pNamespace=NULL;
IWbemClassObject *pClass=NULL;
IWbemClassObject *pInputParamClass=NULL;
IWbemClassObject *pInputParamInstance=NULL;
IWbemClassObject * pOutInst = NULL;
BSTR InstancePath = SysAllocString(L"Win32_NetworkAdapterConfiguration=2");
HRESULT hr;
BSTR Path = SysAllocString(L"\\\\MyComputerName\\root\\cimv2");
BSTR ClassPath = SysAllocString(L"Win32_NetworkAdapterConfiguration");
BSTR MethodName = SysAllocString(L"EnableStatic");
LPCWSTR Arg1Name = L"IPAddress";
VARIANT var1;
LPCWSTR Arg2Name = L"SubnetMask";
VARIANT var2;
__try
{
CreateOneElementBstrArray(&var1, L"10.0.0.101");
CreateOneElementBstrArray(&var2, L"255.255.255.0");
CoCreateInstance(CLSID_WbemLocator, 0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID*)&pLocator);
hr = pLocator->ConnectServer(Path,NULL, NULL, NULL, 0, NULL, NULL,
&pNamespace);
hr = CoSetProxyBlanket( pNamespace,
RPC_C_AUTHN_WINNT,
RPC_C_AUTHZ_NONE,
NULL,
RPC_C_AUTHN_LEVEL_CALL,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE);
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pNamespace->GetObject(ClassPath, 0, NULL, &pClass, NULL);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pClass->GetMethod(MethodName, 0, &pInputParamClass, NULL);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pInputParamClass->SpawnInstance(0, &pInputParamInstance);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pInputParamInstance->Put(Arg1Name, 0, &var1, 0);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pInputParamInstance->Put(Arg2Name, 0, &var2, 0);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pNamespace->ExecMethod(InstancePath, MethodName, 0, NULL,
pInputParamInstance, &pOutInst, NULL);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
}
__finally
{
if(pInputParamInstance)
pInputParamInstance->Release();
if(pInputParamClass)
pInputParamClass->Release();
if(pClass)
pClass->Release();
if(pNamespace)
pNamespace->Release();
if(pLocator)
pLocator->Release();
}
return hr;
}
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
ConfigNet();
CoUninitialize();
printf("Program end\n");
return 0;
}
|
|
|
|
|