|
Comment out each of the SetWindowText() statements and recompile. Does the problem go away? If so, remove the comment from each statement individually and see which causes the problem to start.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Also try "rebuild all." One of my pet peeves with VC6 is that it will not allow one to make Resource.h a dependency. That thoroughly annoys me. I can understand the rationale to not want it to be but to prohibit it from being one is stupid I think.
|
|
|
|
|
|
Rick York wrote:
One of my pet peeves with VC6 is that it will not allow one to make Resource.h a dependency.
In all of my projects, resource.h is indeed in the dependency list. What am I missing here?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Does anyone know of a good piece of code for formating phone numbers. By good, I mean formating based on country code (at the very least). Most of the hits I am seeing, on the WWW, seem to think it is pretty neat to be able to format a US phone number, but any programmer can do that (if someone cann't, there not a programmer).
Thanks for any help!
John R. Shaw
"If I was at home, I would not be Anonymous."
|
|
|
|
|
See the discussion here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks David, thats about what I thought!
According to every thing I have now read even Microsoft cann't do it, except for certain countries with fixed formats (and problems may occur even for those). There is no garantee that any format will not change in the future; thereby breaking code depending on it.
John R. Shaw
"If I was at home, I would not be Anonymous."
|
|
|
|
|
Hi,
I'm havin a silly problem with a scroll bar. It works but it never scrolls all the way to the maximum range value.
For example here's the code:
<br />
SCROLLINFO ScrollInfo;<br />
ScrollInfo.cbSize = sizeof(ScrollInfo); <br />
ScrollInfo.fMask = SIF_ALL; <br />
ScrollInfo.nMin = 0; <br />
ScrollInfo.nMax = 125<br />
ScrollInfo.nPage = ScrollInfo.nMax / 10;<br />
ScrollInfo.nPos = 0;<br />
ScrollInfo.nTrackPos = 0; <br />
m_ImageHorizontalScroll.SetScrollInfo(&ScrollInfo); <br />
int result = m_ImageHorizontalScroll.SetScrollPos(10);
result = m_ImageHorizontalScroll.SetScrollPos(123);
result = m_ImageHorizontalScroll.GetScrollPos();
So I have to set the nMax to my value + a fudge number? What should that number be?
Thanks.
|
|
|
|
|
I have this code to change screen resolution, and it works for win98/2000
but it does not work for WinXP knowing that i log in as Administrator.
<br />
DEVMODE dm;<br />
dm.dmFields=DM_PELSWIDTH|DM_PELSHEIGHT;<br />
dm.dmPelsHeight=600;<br />
dm.dmPelsWidth=800;<br />
ChangeDisplaySettings(&dm,0);
can anybody tell me whats wrong with this code, or another way that may work?
thanx all
Mohammad
A candle looses nothing by lighting another candle
|
|
|
|
|
Mohammad A Gdeisat wrote:
but it does not work...
What does ChangeDisplaySettings() return?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
thanx DavidCrow,
the strange thing is that ChangeDisplaySettings(...) returns DISP_CHANGE_SUCCESSFUL, and ofcourse, i dont see any results on my screen.
have any info?
thank you very much
Mohammad
|
|
|
|
|
I have this class declared as
-------------------------------------------------------------------
class CMyArray : public CTypedPtrArray< CObArray, CMyDataClass* ><br />
{<br />
public:<br />
...<br />
CMyArray();<br />
virtual ~CMyArray();<br />
protected:<br />
...<br />
};
-------------------------------------------------------------------
where the CMyDataClass is declared as
-------------------------------------------------------------------
class CMyDataClass:public CObject<br />
{<br />
public:<br />
CMyDataClass( );<br />
virtual ~CMyDataClass( );<br />
... <br />
protected:<br />
... <br />
};
-------------------------------------------------------------------
Upon compile I get this error:
error C2653: 'CMyArray' : is not a class or namespace name
What?! The strangest thing is that I have other classes defined in the exact same way, compiling without problems.
I searched the documentation using the error code for keyword and found some vague references to this being a known bug, but I could not work out a solution from the text. Obviously, I am doing something wrong with the CMyDataClass, since I do get the exact same construction to work with other generic classes.
------------------------------------------------------------
"Pooollyyy!! ...Polly Parrot! Wakey-wakey!"
|
|
|
|
|
I am using folowing code to insert BMP in RichEdit.
InsertPlotBitmap(CString szFileName)
{
USES_CONVERSION;
SCODE sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &m_lpLockBytes);
if (sc != S_OK)
AfxThrowOleException(sc);
ASSERT(m_lpLockBytes != NULL);
sc = ::StgCreateDocfileOnILockBytes(m_lpLockBytes,
STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE, 0, &m_lpStorage);
if (sc != S_OK)
{
VERIFY(m_lpLockBytes->Release() == 0);
m_lpLockBytes = NULL;
AfxThrowOleException(sc);
}
// CString szFileName=strSmile;
// attempt to create the object
sc = ::OleCreateFromFile(CLSID_NULL, T2COLE(szFileName),
IID_IUnknown, OLERENDER_DRAW, NULL, NULL, m_lpStorage, (void **) &m_lpObject);
if ( sc != S_OK )
{
TCHAR * lpMsgBuf;
::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM, NULL,
::GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL );
CString msg( lpMsgBuf );
msg += _T("\n\n\n" );
msg += szFileName;
AfxMessageBox( msg, MB_OK );
::LocalFree( lpMsgBuf );
return;
}
// m_lpObject is currently an IUnknown, convert to IOleObject
if (m_lpObject != NULL)
{
LPUNKNOWN lpUnk = m_lpObject;
m_lpObject = QUERYINTERFACE(lpUnk, IOleObject);
lpUnk->Release();
if (m_lpObject == NULL)
AfxThrowOleException(E_OUTOFMEMORY);
}
// cache the IViewObject interface
m_lpViewObject = QUERYINTERFACE(m_lpObject, IViewObject2);
if (m_lpViewObject == NULL)
return;
// setup for advises; we assume that OLE cleans them up properly
LPADVISESINK lpAdviseSink =
(LPADVISESINK)GetInterface(&IID_IAdviseSink);
// set up view advise
VERIFY(m_lpViewObject->SetAdvise(DVASPECT_CONTENT, 0, lpAdviseSink)
== S_OK);
// the server shows these in its user-interface
// (as document title and in File Exit menu)
m_lpObject->SetHostNames(T2COLE(AfxGetAppName()),
T2COLE(_T("Test")));
// all items are "contained" -- this makes our reference to this object
// weak -- which is needed for links to embedding silent update.
OleSetContainedObject(m_lpObject, TRUE);
// CHARRANGE cr;
//m_Ctrl_RichEdit.GetSel( cr );
//cr.cpMin = cr.cpMax -1;
//m_Ctrl_RichEdit.SetSel( cr );
REOBJECT reo;
memset( &reo, 0, sizeof( reo ) );
reo.cbStruct = sizeof( reo );
CLSID classID;
if ( m_lpObject->GetUserClassID( &classID ) != S_OK)
classID = CLSID_NULL;
reo.clsid = classID;
reo.cp = REO_CP_SELECTION;
reo.poleobj = m_lpObject;
reo.pstg = m_lpStorage;
LPOLECLIENTSITE lpClientSite;
GetIRichEditOle()->GetClientSite( &lpClientSite );
reo.polesite = lpClientSite;
SIZEL sizel;
sizel.cx = sizel.cy = 0; // let richedit determine initial size
reo.sizel = sizel;
reo.dvaspect = DVASPECT_CONTENT;
reo.dwFlags = REO_RESIZABLE;
reo.dwUser = 0;
HRESULT hr = GetIRichEditOle()->InsertObject( &reo );
}
This code works fine if i call from same window.But it gives error if i invoke from another dialog it gives error in the following line .
GetIRichEditOle()->GetClientSite( &lpClientSite );
can any body help me .
Learner always
|
|
|
|
|
rver wrote:
But it gives error...
And what would that error be?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
It Gives "Assertion Failed" in following function
IRichEditOle* CRichEditCtrl::GetIRichEditOle() const
{
ASSERT(::IsWindow(m_hWnd));
...
}
As in this it cannt get m_hWnd is 0x00000000.
Learner always
|
|
|
|
|
hi all,
how to prevent mfc dialog based app beign displayed on taskbar ?
Either when maximised and minimised.
Thanks.
|
|
|
|
|
hi friend,
I quote the folowing from MSDN 2003, I dont know if it really works but I hope so:
I will simply tell you the answer: you must create your dialog as a child of an invisible window that has WS_EX_TOOLWINDOW set, and you must make sure your dialog has the WS_EX_APPWINDOW style turned off. If you read the documentation’s fine print, you might figure this out—but only if you use a powerful magnifying glass.
<br />
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
if (CFrameWnd::PreCreateWindow(cs)) {<br />
cs.dwExStyle |= WS_EX_TOOLWINDOW;<br />
return TRUE;<br />
}<br />
return FALSE;<br />
}<br />
.<br />
.<br />
.<br />
<br />
BOOL CMyApp::InitInstance()<br />
{<br />
CMainFrame* pFrame = new CMainFrame;<br />
m_pMainWnd = pFrame;<br />
pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPED, NULL, NULL);<br />
CMyDlg dlg(pFrame);<br />
int nResponse = dlg.DoModal();<br />
if (nResponse == IDOK) {<br />
} else if (nResponse == IDCANCEL) {<br />
}<br />
return FALSE;<br />
}
hope it helps
good luck
A candle looses nothing by lighting another candle
|
|
|
|
|
hi friend,
I found something on MSDN 2003 and i hope its helpful:
quote says:
I will simply tell you the answer: you must create your dialog as a child of an invisible window that has WS_EX_TOOLWINDOW set, and you must make sure your dialog has the WS_EX_APPWINDOW style turned off. If you read the documentation’s fine print, you might figure this out—but only if you use a powerful magnifying glass.
<br />
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
if (CFrameWnd::PreCreateWindow(cs)) {<br />
cs.dwExStyle |= WS_EX_TOOLWINDOW;<br />
return TRUE;<br />
}<br />
return FALSE;<br />
}<br />
.<br />
.<br />
.<br />
BOOL CMyApp::InitInstance()<br />
{<br />
CMainFrame* pFrame = new CMainFrame;<br />
m_pMainWnd = pFrame;<br />
pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPED, NULL, NULL);<br />
CMyDlg dlg(pFrame);<br />
int nResponse = dlg.DoModal();<br />
if (nResponse == IDOK) {<br />
} else if (nResponse == IDCANCEL) {<br />
}<br />
return FALSE;<br />
}
I hope its helpful
Mohammad.
A candle looses nothing by lighting another candle
|
|
|
|
|
I have a SDI project. When I run the project there is a resource loaded that appears in the main window that has buttons, edit boxes, list boxes, etc....the user interface. I have never really understood where in the code or when a resource is loaded so that it appears in the main window. Can someone help me with this?
Thanks.
Jerry
|
|
|
|
|
Assuming you are talking about a CFormView app.
The resource is loaded and created in the CFormView::Create function. (viewform.cpp)
Which is called from the CMainFrame::OnCreate function via the CFrameWnd::OnCreate call.
Michael
CP Blog [^]
|
|
|
|
|
Hello guys and gals,
First of i'm not a programmer myself so take it easy on the programming lingo
But i'm confident you guys can help me with what im looking for or at least guide me in the right direction.
What i want to do:
I want to be able to read/search a specific processes allocated memory for specified data and then export it to notepad or whatever. For those of you that ever tried GameHack might understand better the thing im after.
Are there any tools you know of that can help me with this? If not do you have any other ideas on how i can achive this?
Thanks a bunch guys!
|
|
|
|
|
See this thread and this article for ideas.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks... Kinda helpfull. TSearch seems to be usefull in "automating" the feature. Meaning i can assign hotkeys to take snapshots (and hopefully export to txt format) at any given time.
Someone mentioned to me that perl maybe the best language to create the "ultimate" tool im looking for. Any comments on whether or not perl would be usefull for this?
|
|
|
|
|
stumdoes wrote:
Any comments on whether or not perl would be usefull for this?
The only thing I know about Perl is how to spell it.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
ha ha ha.. Kinda saw that one comming since im in the C++ fora
Merry Xmas mate and thanks for the help so far!
|
|
|
|