|
It too is a reference to a const CString . In other words, the following are equivalent, just different styles:
const CString &str;
CString const &str;
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi All,
This is an existing paragraph formatting for bullet
pf=GetParaFormatSelection();
pf.dwMask = PFM_NUMBERING | PFM_STARTINDENT;
pf.wNumbering = PFN_BULLET;
pf.dxStartIndent = 300;
SetParaFormat(pf)
Like this I would like to create own paragraph formatting.For example"<>".
Thanks,
|
|
|
|
|
I have the handlers and message maps as below.
Whenever a child window is visible the following hanldler and its update function is not invoked.
When the Child window is closed they are invoked..
Can anyone explain this behaviour.
ON_COMMAND(ID_VIEW_DRAWTOOLBAR, OnDrawToolBar)
ON_UPDATE_COMMAND_UI(ID_VIEW_DRAWTOOLBAR, OnUpdateDrawToolBar)
void CMainFrame::OnDrawToolBar()
{
if (m_bUICtrlBar)
{
m_bUICtrlBar = false;
ShowControlBar(&m_UICtrlsBar, m_bUICtrlBar, false );
}
else
{
m_bUICtrlBar = true;
ShowControlBar(&m_UICtrlsBar, m_bUICtrlBar, false );
}
}
void CMainFrame::OnUpdateDrawToolBar(CCmdUI *pCmdUI)
{
if (m_UICtrlsBar.IsVisible())
m_bUICtrlBar = TRUE;
else
m_bUICtrlBar = FALSE;
if (m_bUICtrlBar)
{
pCmdUI->SetCheck(TRUE);
//AfxMessageBox("visible so check");
}
else
{
pCmdUI->SetCheck(FALSE);
//AfxMessageBox("Invisible so Uncheck");
}
}
laiju
|
|
|
|
|
hello!
i want to create check boxes on run time in the groupbox but i dont know how to do this plz tell me.and give detail procedure
|
|
|
|
|
Connect a variable to your groupbox: CButton m_Stat;
1-
CreateWindow("BUTTON","this is checkbox",WS_CHILD | WS_VISIBLE | BS_CHECKBOX | BS_AUTOCHECKBOX | WS_TABSTOP,20,10,200,20,m_Stat.m_hWnd,NULL,AfxGetApp()->m_hInstance,0);
-OR-
2-
You can also use CButton: Just make the CButton variable at class level.
static CButton b;
CRect rect;
rect.SetRect(20,20,200,40);
b.Create("Hello oo",WS_CHILD | WS_VISIBLE | BS_CHECKBOX | BS_AUTOCHECKBOX,rect,&m_Stat,20);
If you need to use plain win32, then it is a bit different.
this is this.
|
|
|
|
|
but this create only single checkbox and i want to display single check box on each click event.means i want to display 1 checkbox then on next click event another next to previous.
|
|
|
|
|
well you did not say so on your initial post ...
but I still don't understand what you want to do ?
you want to create a new checkbox control each time the user clicks somewhere ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
ya actually i want to open no of files at same time and each time when i click on open file on file menu a check box would be created on each open file action as i would open another file the next check box would be opened on group box next to previous one.
hope u'll understand now
|
|
|
|
|
Create a CPtrArray m_ptrArray; variable in your header.
Then when you want to create the checkbox,
CButton* pButton;
pButton = new CButton;
...
Create the button using the code in reply above.
...
Then add it to the array like this:
m_ptrArray.Add(pButton);
Now your checkbox is created and added to the array for later usage.
When you need to access it, use:
CButton* pButton;
pButton = (CButton*)m_ptrArray.GetAt(iLocation);
where iLocation is the index of the button starting with 0...to m_ptrArray.GetSize();
this is this.
|
|
|
|
|
StretchBlt can be done for Bitmaps.
How do I do the same for ICONS.
I need to zoom an icon.
Any suggestions plz.
laiju
|
|
|
|
|
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 .
|
|
|
|
|