|
how do i programatically determine wheather the user has chosen webview or not programatically.
I have tried ShGetSettings but no luck.
Thanx in advance.
Toughest Steel Comes From Hottest Furnance
|
|
|
|
|
Hi,
I'm using CHtmlEditView/CHtmlEditDoc in VC 6.0. It's working well but in testing I found one bug and I could not trace it out yet. i.e. In some times while the user working with editor, suddenly the view becomes blank and the source file size becomes zero. Still I could not find which action makes it blank, I could not trace it out.
Kindly help, what could be the problem to make the entire file blank and is there any chance to happen this in edit/view mode of CHtmlEditView/Doc?
Is anybody hit with this problem?
Very thanks.
Regards,
Palani VS
|
|
|
|
|
I have a bitmap in my app that contains two icons.
I load the bitmap into an image list and associate it with a list control
During run time I set the bitmap list this
LV_ITEM lvItem;
lvItem.mask = LVIF_IMAGE;
lvItem.iItem = itemIndex;
lvItem.iImage = imageIndex;
m_listTest.SetItem(&lvItem);
where imageIndex is 0 or 1
In debug mode this works fine I can swap between icons no worries but in release mode I always get the icon at position 0 no matter what imageIndex is set to!
Im so sick of release problems with MFC. Can anyone help.
|
|
|
|
|
I'm currently trying to obtain some information about my mother board using WMI in VC++6. I've had a read of the MSDN documenation on the Win32_BaseBoard class but I'm still not sure of how WMI all works. Would someone who knows a bit about WMI please provide some code samples to get me started.
Much appreciated.
|
|
|
|
|
Here's one way:
HRESULT hr;
_variant_t v;
ULONG ulReturned;
DWORD dwAuthLevel;
IWbemLocator *pLocator;
IWbemServices *pService = NULL;
IEnumWbemClassObject *pEnum = NULL;
IWbemClassObject *pClass;
hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLocator);
if (S_OK == hr)
{
hr = pLocator->ConnectServer(_bstr_t(L"root\\cimv2"), NULL, NULL, NULL, NULL, 0, NULL, &pService);
if (WBEM_S_NO_ERROR == hr)
{
hr = CoQueryProxyBlanket(pService, NULL, NULL, NULL, &dwAuthLevel, NULL, NULL, NULL);
hr = CoSetProxyBlanket(pService, RPC_C_AUTHN_DEFAULT, RPC_C_AUTHZ_NONE, NULL, dwAuthLevel, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);
hr = pService->CreateInstanceEnum(_bstr_t("Win32_Baseboard"), WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, NULL, &pEnum);
if (WBEM_S_NO_ERROR == hr)
{
do
{
hr = pEnum->Next(WBEM_INFINITE, 1, &pClass, &ulReturned);
if (WBEM_S_NO_ERROR == hr)
{
hr = pClass->Get(L"Caption", 0, &v, NULL, NULL);
if (VT_NULL != v.vt)
TRACE("Caption = %S\n", V_BSTR(&v));
hr = pClass->Get(L"ConfigOptions", 0, &v, NULL, NULL);
if (VT_NULL != v.vt)
{
LONG lBound;
BSTR Value;
SafeArrayGetUBound(V_ARRAY(&v), 1, &lBound);
while (lBound >= 0)
{
SafeArrayGetElement(V_ARRAY(&v), &lBound, &Value);
TRACE("ConfigOptions[%u] = %S\n", lBound, Value);
lBound--;
}
}
hr = pClass->Get(L"Depth", 0, &v, NULL, NULL);
if (VT_NULL != v.vt)
TRACE("Depth = %f\n", V_R4(&v));
pClass->Release();
}
} while (WBEM_S_NO_ERROR == hr);
pEnum->Release();
}
pService->Release();
}
pLocator->Release();
}
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I have a template Collection class defined as so (only a small portion of the class is shown here):
template < class T >
class Collection
{
public:
Collection();
virtual ~Collection();
public:
long add (T* pObject);
T* getAt (long nIndex);
...
}
I declare an instance of a Collection like so:
Collection< Foo > m_collectionOfFooObjects;
My project compiles fine, but I get several unresolved symbol link errors, one for each Collection method that returns a T* or void . The linker seems to have no problem finding methods that return long (eg: add() ). I'm sure I'm doing something wrong but can't figure out what. Any help would be appreciated. Thanks!
(PS: The Collection class does more than store a collection of objects, hence it's more convenient to brew my own than use an STL or MFC object.)
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Where are these functions declared? They can not be placed in a cpp file. They must be in with the H file.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Yes, they're in a .cpp file. Drat, I wanted to hide their implementation from the user, but I guess that may not be easy/possible.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
guess that may not be easy/possible.
Not possible (since templates are a compile-time thing). There was a bit of talk a while back about (proprietary) compiler extensions to allow template implementations to be hidden in a .LIB but I haven't anything about that for a while.
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 1.2.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Thanks! Nemanja's article explains why what I was trying to do won't work.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
It's a template, not a class! Thanks, I get it now!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
bascially i have an IP Address contained in a CString "10.10.10.1"
i need a unsigned long representation of it.
here is the function im using below but
im not sure, if its right..
its hit and miss, works sometimes not others..
can anyone recommend an easier way of doing it
or point out errors in the function
int check1;
CString m_ipSrc;
unsigned long srcIp
check1 = convertAddress(m_ipSrc, &srcIp)
int DlgClass::convertAddress(const char *sIp, unsigned long *lIp)
{
int octets[4];
int i;
const char * auxCad = sIp;
*lIp = 0;
for(i = 0; i < 4; i++)
{
octets[i] = atoi(auxCad);
*lIp |= (octets[i] << (i*8));
auxCad = strchr(auxCad, '.');
auxCad++;
}
return 0;
}
|
|
|
|
|
|
I have created a dialog to handle the joystick inputs, just to check that I obtain the data.
However the move joystick and joy button changed events dont seem to be firing.
BEGIN_MESSAGE_MAP(CMSCPPDlg, CDialog)
//{{AFX_MSG_MAP(CMSCPPDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_GET_STATUS, OnGetStatus)
ON_BN_CLICKED(IDC_START, OnStart)
//}}AFX_MSG_MAP
ON_MESSAGE(MM_JOY1BUTTONDOWN, OnJoy1ButtonDown)
ON_MESSAGE(MM_JOY1BUTTONUP, OnJoy1ButtonUp)
ON_MESSAGE(MM_JOY1MOVE, OnJoy1Move)
END_MESSAGE_MAP()
I start the capture via:
void CMSCPPDlg::OnStart()
{
/* This procedure starts or stops the capture of the Joystick movement and
button presses. */
static bool capture = false;
int error;
if(!capture)
{ // Start the capture
error = joySetCapture(this->m_hWnd, JOYSTICKID1, NULL, FALSE);
if (error == MMSYSERR_NODRIVER)
MessageBox("The joystick driver is not present", "Error when capturing", MB_ICONERROR);
if (error == MMSYSERR_INVALPARAM)
MessageBox("Windows 95/98/Me: Invalid joystick ID or hwnd is NULL.", "Error when capturing", MB_ICONERROR);
if (error == JOYERR_NOCANDO)
MessageBox("Cannot capture joystick input because a required service (such as a Windows timer) is unavailable.", "Error when capturing", MB_ICONERROR);
if (error == JOYERR_UNPLUGGED)
MessageBox("The specified joystick is not connected to the system. ", "Error when capturing", MB_ICONERROR);
else
{
MessageBox("The joystick has been captured");
capture = true;
}
}
else
{ // Release the Joystick capture
joyReleaseCapture(JOYSTICKID1);
capture = false;
MessageBox("The joystick has been released");
}
}
I have placed breakpoints in the OnJoy1Move & JOY1BUTTONDOWN and they are never reached.
grahamfff
|
|
|
|
|
I have a question. Which one of these is a faster network architecture: using blocking calls with a multithreaded pool or just using the asynchronous protocol?
|
|
|
|
|
Hi guys!
I have a MDI programm. and now, i want to call a function in CSampleViw which is in cmainframe. the function makes a new childframe.
how could I do that?
<br />
void CMainFrame::OnStartRenderView()<br />
{<br />
CMDIChildWnd* pActiveChild = MDIGetActive();<br />
CDocument* pDocument;<br />
if (pActiveChild == NULL ||<br />
(pDocument = pActiveChild->GetActiveDocument()) == NULL) {<br />
TRACE("Warnung: Kein aktives Dokument für WindowNew vorhanden\n");<br />
AfxMessageBox(AFX_IDP_COMMAND_FAILURE);<br />
return;
}<br />
<br />
CDocTemplate* pTemplate =<br />
((CSampleApp*) AfxGetApp())->m_pTemplateRender;<br />
ASSERT_VALID(pTemplate);<br />
CFrameWnd* pFrame =<br />
pTemplate->CreateNewFrame(pDocument, pActiveChild);<br />
if (pFrame == NULL) {<br />
TRACE("Warnung: Neuer Rahmen konnte nicht erstellt werden\n");<br />
AfxMessageBox(AFX_IDP_COMMAND_FAILURE);<br />
return;
}<br />
<br />
pTemplate->InitialUpdateFrame(pFrame, pDocument);<br />
}<br />
|
|
|
|
|
If I understand correctly, you want to call OnStartRenderView() from CSampleView . To do this, make sure the method is declared public in your mainframe class. Then, do this in your view class:
((CMainFrame *) AfxGetMainWnd())->OnStartRenderView();
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I am programming a dialog box in MFC. Is there a way that I can have my dialog application open up a game window? For example, my dialog is the active window, and Counter Strike is alt tabbed. Is there a way that I can:
1. See if CS is alt tabbed
2. Open up CS from my dialog
I have tried using SetActiveWindow(), but I can't seem to make a pointer to CS. Any help would be great.
-Dev578
|
|
|
|
|
When you say open up, are you referring to executing a program or set a window active?
Kuphryn
|
|
|
|
|
Setting the window active. Sorry, should have been more clear. The program is already running, I just want to make it the active window.
-Dev578
|
|
|
|
|
You will need to get the HWND of the other window. You can do this several ways, either by calling EnumWindows once you have defined a EnumWindowsProc callback or use FindWindow to get the HWND .
- Nick Parker My Blog
|
|
|
|
|
I am using this code
while (ERROR_SUCCESS == RegEnumValue(theSettings._rgk,dwIdx,szValueName, &dwValueNameLen,NULL,&dwType,(LPBYTE)buff,
&dwSize))
{
pairVec.push_back(std::make_pair(_bstr_t(szValueName),_bstr_t(buff)));
dwIdx++;
}
i have 5 entries in the registry, the above loop only finds the last one and
then exits.....
can any1 help?
thanks
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
You need to reset dwValueNameLen and dwSize to the sizes of your buffers before each call to RegEnumValue()
--Mike--
Personal stuff:: Ericahist Updated Feb 6! | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2
Pinky, are you pondering what I'm pondering?
I think so Brain, but how will we fit the hamster inside the accordion?
|
|
|
|
|
thanks
works like a charm
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|