|
How about DrawIcon into a memory DC, then BitBlt from the mmemory DC to your destination DC?
|
|
|
|
|
StretchBlt can used with bitmaps to implement zooming.
How can I do the same for Icons to bring about its zooming effect
laiju
|
|
|
|
|
Hi all,
Since starting to use STL (mainly vectors), I've found that VC++6 (latest SP) is crashing more and more frequently when compiling, the more STL code I use. It then compiles OK if I restart the IDE. Is this a common problem? Any fixes?
TIA,
Steve.
|
|
|
|
|
never seen this, but instead of restarting the whole IDE, what about just rebuild all ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
The IDE itself locks up and has to be killed with the Task Manager.
|
|
|
|
|
Anyone knows how to set the description text for a Windows Service? (the text in the second column of the Services MMC window).
Tnx
|
|
|
|
|
If your program only runs on Windows 2000 or later, use ChangeServiceConfig2 with the SERVICE_CONFIG_DESCRIPTION if the service is already installed.
Otherwise, you will need to edit/add a registry entry under your service.
Hive = HKEY_LOCAL_MACHINE
Key = SYSTEM\CurrentControlSet\Services\<servicename>
Value = Description
Type = REG_SZ
Supply the text you want for the descripiton.
|
|
|
|
|
|
Here's how I do it.
SERVICE_DESCRIPTION Descr = {(LPSTR)GetServiceDescription()};
ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &Descr);
|
|
|
|
|
|
Hi all:
i am having a problem connecting to query wmi object
HRESULT hres;
// Step 1: --------------------------------------------------
// Initialize COM. ------------------------------------------
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
std::cout << "Failed to initialize COM library. Error code = 0x" << hex << hres << std::endl;
return 1; // Program has failed.
}
// Step 2: --------------------------------------------------
// Set general COM security levels --------------------------
// Note: If you are using Windows 2000, you need to specify -
// the default authentication credentials for a user by using
// a SOLE_AUTHENTICATION_LIST structure in the pAuthList ----
// parameter of CoInitializeSecurity ------------------------
hres = CoInitializeSecurity(
NULL,
-1, // COM authentication
NULL, // Authentication services
NULL, // Reserved
RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication
RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation
NULL, // Authentication info
EOAC_NONE, // Additional capabilities
NULL // Reserved
);
if (FAILED(hres))
{
std::cout << "Failed to initialize security. Error code = 0x"
<< hex << hres << endl;
CoUninitialize();
return 1; // Program has failed.
}
// Step 3: ---------------------------------------------------
// Obtain the initial locator to WMI -------------------------
IWbemLocator *pLoc = NULL;
hres = CoCreateInstance(
CLSID_WbemLocator,
0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID *) &pLoc);
if (FAILED(hres))
{
std::cout << "Failed to create IWbemLocator object."
<< " Err code = 0x"
<< hex << hres << endl;
CoUninitialize();
return 1; // Program has failed.
}
// Step 4: -----------------------------------------------------
// Connect to WMI through the IWbemLocator::ConnectServer method
IWbemServices *pSvc = NULL;
// Connect to the remote root\cimv2 namespace
// and obtain pointer pSvc to make IWbemServices calls.
//---------------------------------------------------------
// change the computerName and domain
// strings below to the full computer name and domain
// of the remote computer
hres = pLoc->ConnectServer(
_bstr_t(L"\\\\192.168.1.243\\ROOT\\cimv2"),
_bstr_t(L"username"), // User name
_bstr_t(L"password"), // User password
_bstr_t(L"MS_409"), // Locale
NULL, // Security flags
NULL, //_bstr_t(L"ntlmdomain:domain"), // Authority
0, // Context object
&pSvc // IWbemServices proxy
);
// When you have finished using the credentials,
// erase them from memory.
//SecureZeroMemory(pszName, sizeof(pszName));
//SecureZeroMemory(pszPwd, sizeof(pszPwd));
if (FAILED(hres))
{
std::cout << "Could not connect. Error code = 0x"
<< hex << hres << endl;
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
std::cout << "Connected to ROOT\\CIMV2 WMI namespace" << endl;
if (FAILED(hres))
{
std::cout << "Could not set proxy blanket. Error code = 0x"
<< hex << hres << endl;
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
// Step 6: --------------------------------------------------
// Use the IWbemServices pointer to make requests of WMI ----
// For example, get the name of the operating system
IEnumWbemClassObject* pEnumerator = NULL;
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("Select * from Win32_OperatingSystem"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
if (FAILED(hres))
{
std::cout << "Query for operating system name failed."
<< " Error code = 0x"
<< hex << hres << endl;
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
// Step 7: -------------------------------------------------
// Get the data from the query in step 6 -------------------
IWbemClassObject *pclsObj;
ULONG uReturn = 0;
while (pEnumerator)
{
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
&pclsObj, &uReturn);
if(0 == uReturn)
{
break;
}
VARIANT vtProp;
VariantInit(&vtProp);
// Get the value of the Name property
hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0);
wcout << " OS Name : " << vtProp.bstrVal << endl;
// Get the value of the FreePhysicalMemory property
hr = pclsObj->Get(L"FreePhysicalMemory",
0, &vtProp, 0, 0);
wcout << " Free physical memory (in kilobytes): "
<< vtProp.uintVal << endl;
VariantClear(&vtProp);
}
// Cleanup
// ========
pSvc->Release();
pLoc->Release();
pEnumerator->Release();
pclsObj->Release();
CoUninitialize();
return 0; // Program successfully completed.
running this program, it shows the followings
Connected to ROOT\CIMV2 WMI namespace
Query for operating system name failed. Error code = 0x80070005
anyone helps?
|
|
|
|
|
Hi
Im in a fix regarding accessing the flexgrid control of my dialog.
Im calling my dll(MFC) through an exe. In the dll there is a dialog that contains the FlexGrid. on calling of the dll the dialog box gets called. now i want to populate the grid with some data but im unable to access the flexgrid. On accessing the method of the grid it is showing Assertion error.
I know there are gurus in VC++ and hope you will assist me or give me any pointers.
Your help is greatly appreciated.
|
|
|
|
|
How can I detect when the ALT key is pressed and no other key is pressed? I wanted to change my cursor when the ALT is pressed. So i wanted to know which message is sent in this case.
Thanks
|
|
|
|
|
Try with WM_SYSKEYDOWN
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
It works only if i press a key followed by ALT. I want an event which fires when i press just the ALT key .
|
|
|
|
|
Is GetAsyncKeyState() of any help?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Yes i am using it get the state of the ALT key but the point is I want to change my cursor as soon as the user presses the ALT key so for that i would require an event being fired or Currently i am using a timer which uses GetAsyncKeyState() to get the state and then i change the app cursor.
Thanks
|
|
|
|
|
Vikash Dubey wrote:
It works only if i press a key followed by ALT.
Could you show me how and where you have written the code.
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
What about the WM_CHAR message?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi Everybody!
what shude I do for create and develop a simple Windows Service in "Visual Studio.Net 2003" with "Visual C++" Project Type?
Is it possible that I use the "MFC" instructions in this?
If the answer is "Yes" please tel me "What To Do?"
and if not, please help me in another way.
Thanks for your guidance.
|
|
|
|
|
|
Hello everybody,
I'm looking for a client library to get and delete mails from an imap server.
Now, I use the IP Works library and the delete of the mails is too long (30 sec).
Thanks
BriceDeNice
|
|
|
|
|
On one of my dialogs I have about 70 check boxes which when checked toggle the associated bool value in an array (one bool for every check box).
Rather than create 70 check boxes on the dialog and also then write (copy) the handling code for each check box, is there an easy way to do this?
|
|
|
|
|
I would do it like that: you keep an array of CButton (I think this is the class that handle check boxes messages), then in OnInitDialog, I will instantiate this array and create the check boxes:
BOOL CyourDlg::OnInitDialog()<br />
{<br />
m_pCheckBoxesArray = new CButton[m_ChckBoxCount];<br />
for (int i=0;i<ChckBoxCount;i++)<br />
m_pCheckBoxesArray[i].Create(......);<br />
}
In the Create function, you will need to pass the Id of the control and its position. For the Id, edit the ressource file and use consecutive Id's so you can just do something like that:
for (int i=0;i<ChckBoxCount;i++)<br />
m_pCheckBoxesArray[i].Create(.., IDC_FIRSTCHCKBOX+i ,....);<br />
In the ressource file, you can do something like that:
#define IDC_FIRSTCHCKBOX 10000<br />
#define IDC_LASTCHCKBOX 10070
Then you can use the ON_CONTROL_RANGE macro instead of ON_COMMAND to map the notification messages of all your check boxes (take a look in the MSDN).
Hope this helps
|
|
|
|
|
thanks, I'll give this a try,
Andy
|
|
|
|