|
Oh,do you think it is awful?
but how could I do much better?
since there isn't much code , I just post all.\
I have no other way
I'm so sorry
|
|
|
|
|
Tcpip2005 wrote:
but how could I do much better?
by writing a bit more clearly, more spaced... using <pre></pre> around your code why not ?!
Tcpip2005 wrote:
since there isn't much code
and you would post much more again ?????
don't you think it's enough already ?
would you be happy one overload your servers that way for 'unansweredable' question ?
didn't you wonder that if anybody was answering, it could be just the simple fact that nobody knows the answer to your problem... ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I'm so sorry.
I have post the code again
Thank you very much!
|
|
|
|
|
I'm sorry.
I haven't see the words just now.
sorry. this is my last time to post this question here.
last time, I will never post this again.
I'm so sorry.
god forgives me
|
|
|
|
|
Yes,you are right.
I have pasted the same qustion here for three time until now.
I am so sad. I can't fix it until now . So sad.
there is a C# writen program on codeproject. but I have to use vc6,not .Net Framework.
please! give me a help.
|
|
|
|
|
#define _WIN32_DCOM
#include <Wbemidl.h>
#pragma comment(lib,"Wbemuuid.lib")
#include <atlbase.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 (pszW == NULL)
{
*ppszA = NULL;
return NOERROR;
}
cCharacters = wcslen(pszW)+1;
cbAnsi = cCharacters*2;
*ppszA = (LPSTR) CoTaskMemAlloc(cbAnsi);
if (NULL == *ppszA)
return E_OUTOFMEMORY;
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"19.9.20.19");
CreateOneElementBstrArray(&var2, L"255.255.0.0");
CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (void**)&pLocator);
hr = pLocator->ConnectServer(Path,NULL, NULL, NULL, 0, NULL, NULL,
&pNamespace);
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
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;
}
|
|
|
|
|
|
Hello Tcpip2005, How are you doing? when ever you are trying to copy code in code project, then just try to use html tags. like this.
< is used for less than symbol. = "<"
> is used for grater than symbol. = ">"
Then your code can be readable.
Or check the Check Box(Do not treat <'s as HTML tags) when ever you post question?
Nice talking to you.
|
|
|
|
|
Ok the situation is this, Im doing some applications , the first one is an application with 3 buttons that also has an Ip control with that application I put the Ip adress of the application (Server) that is an audio application that capture Audio.
with the first application (the one with the 3 buttons, starting, stoping and exit button, I send one character to the audio application)
I took one audio capture application from the codeproject to use it on my project, the problem is that I dont know how to put support to windows sockets, the audio application is made it in Visual C++ in a MFC, somebody knows how to paste the code to give support to the sockets.
something like the wizzard does when you are generating the MFC application that you can add support to 3d buttons, and sockets.
and also, somebofy knows about another audio capture application that I could use to my project.
another question that I have, if somebody can help me, is that Im just starting in the world of the code, and the POO,
so I need to take this data ( the buffer of the captured audio and send it through the socket, but I dont know how to do it.
can I use the function RECV(s2, &buffer,1,0)
where s2 is the socket that Im using, but I dont know what to put in the other params)
if somebody could help me,
GOD BLESS YOU
my email is
rubencia@yahoo.com
thanx again to everybody
SHALOM
|
|
|
|
|
REU,
Is this homework? Be honest...
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
Hi!Dear,
when building my project on vc++6.0,i got a link error.
It says:
"strmbasd.lib(wxdebug.obj):error LNK2001:unresolved symbol_imp_strrchr"
so,how to settle this problem?
thanks!
|
|
|
|
|
try using any of these LIBC.LIB or LIBCMT.LIB or MSVCRT.LIB ,make sure it is linked before strmbasd.lib
|
|
|
|
|
Hello,
I would to have an Dialog with PassQuerry...
The User shouldn't leave the Dialog and Click anything else on Desktop..
The Windowskey or STRG-ALT-ENTF, STRG-TAB and other Keys must be Inactive...
The User should Interact with the Dialog ONLY....
What's the answer???
Thanx,
Dachs
|
|
|
|
|
make that dialog system modal by checking system modal property.
I'm not sure about second point but, you can definitely trap those messages
|
|
|
|
|
prasad_som wrote:
make that dialog system modal by checking system modal property.
AFAIK, System Modal dialog no longer work in NT based System...
Sorry for correcting you again....
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
Ok the situation is this, Im doing some applications , the first one is an application with 3 buttons that also has an Ip control with that application I put the Ip adress of the application (Server) that is an audio application that capture Audio.
with the first application (the one with the 3 buttons, starting, stoping and exit button, I send one character to the audio application)
I took one audio capture application from the codeproject to use it on my project, the problem is that I dont know how to put support to windows sockets, the audio application is made it in Visual C++ in a MFC, somebody knows how to paste the code to give support to the sockets.
something like the wizzard does when you are generating the MFC application that you can add support to 3d buttons, and sockets.
and also, somebofy knows about another audio capture application that I could use to my project.
another question that I have, if somebody can help me, is that Im just starting in the world of the code, and the POO,
so I need to take this data ( the buffer of the captured audio and send it through the socket, but I dont know how to do it.
can I use the function RECV(s2, &buffer,1,0)
where s2 is the socket that Im using, but I dont know what to put in the other params)
if somebody could help me,
GOD BLESS YOU
my email is
rubencia@yahoo.com
thanx again to everybody
SHALOM
REUBEN JAIM
|
|
|
|
|
I have referred to the FAQ but the answer does not solve the problem actually...
Below is my code of creating srevice:
--------------------------------------------------------------------------------------------------
SC_HANDLE hService =
::CreateService(
handle, // handle to SCM database
servicename.c_str(), // name of the service to install
servicename.c_str(), // name that is displayed on SCM
SERVICE_ALL_ACCESS, // can be accessed only by administrators
SERVICE_WIN32_OWN_PROCESS, // service runs its own process
SERVICE_AUTO_START, // started by SCM when StartService() is called
SERVICE_ERROR_IGNORE, // error logged but service started
ss, // pathname of the executable
NULL, // service does not belong to any group
NULL, // service does not use a tag
NULL, // requires NtLmsSp and EventLog service to be running
".\\Administrator", // user name to log on
"s" // password
);
--------------------------------------------------------------------------------------------------
|
|
|
|
|
how to move the word sequntially from left to right in my window(vc++ application).
Sunsen
|
|
|
|
|
Where are these words displayed ? Drawn by yourself on the client area of a window, in an edit box, ... ??
For the first case, simply create a timer and at each time it fires, redraw the the window and put the text at another position.
|
|
|
|
|
use Getwindowrect, ScreentoClient then use MoveWindow using the rect. if u've placed the text in a control. or use CDC::TextOut(x,y,string)..
eg:
int x=100,y=100;
{
this->GetWindowDC()->TextOut(x,y,"codeproject");
x+=10;
}
Regards,
V
|
|
|
|
|
Vivekuniq wrote:
GetWindowDC()->TextOut(x,y,"codeproject");
Nice, Using that you can Write even on title of Window , NICE
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Plz Give the code to draw colourful dialog boxes.
means , to change back ground color and fore ground.
Plz give GUI of dialog boxes.
Reply Urgently
Praveen Chowdam Kumar
|
|
|
|
|
parims wrote:
Plz Give the code to draw colourful dialog boxes.
means , to change back ground color and fore ground.
Plz give GUI of dialog boxes.
OK.
Handle the OnEraseBkgnd() like this:
.... OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(&rect);
pDC->FillSolidRect(&rect,RGB(255,0,0));
return TRUE;
}
The events list for a dialog box does not normally display this message to be handled in VC6. You need to change the "Filter for messages.." combo box to "Window".
Now the background will be bright Red.
To change the foreground, do you mean Static text etc?
Then you will need to subclass the CStatic, and handle its painting yourself. You can find many CStatic samples here on CP.
this is this.
|
|
|
|
|
there's no need to be so hurrying, because if anyone knows the answer, or if anyone want to answer you, you will stay in the same state.
moreover, you seem so hurry that i doubt you googled your problem, or even searched CodeProject for that.
CodeProject[^]
Google[^]
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|