|
Look at the declaration of SetWindowPos()
Greetings,
D.
|
|
|
|
|
Got it working perfectly with that! Thanks a lot!
|
|
|
|
|
I have a function in CDocument file which I declared inline. When I call it from CView class, the linker reports LNK2001 error. If it's not inline then it works fine. Does anyone know what might be the problem?
|
|
|
|
|
dart13 wrote:
Does anyone know what might be the problem?
Are you declaring a function inline that you have overridden from an MFC class CDocument? Just a wild guess. Does the link error give any other info?
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
The function is a member function of derived CDocument class, and I use it to access protected member variable which I created. If it is used within CMyDoc then it's ok, but when I call it from CMyView then the linker reports that error.
Here is a full text of the error msg:
<br />
MyVew.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CMyDoc::IsButtonPressed(void)const " <br />
(?IsButtonPressed@CMyDoc@@QBE_NXZ)<br />
|
|
|
|
|
|
isn't the inline keyword made for declaring a function inline, wherever the code is written ?
TOXCCT >>> GEII power
|
|
|
|
|
no it's not. the compiler has to know to sources to "convert" it to code that fits in the calling function!
Don't try it, just do it!
|
|
|
|
|
Thanks for help. The inline function was in a CPP file. Does this rule of putting inline functions in a header file applies only to VC++ or it is a part of standard?
|
|
|
|
|
I have what is according to MSDN and a fairly common problem--so common, in fact, that
a web page has been devoted to not only the problem but also the solution. This page is:
http://support.microsoft.com/default.aspx?scid=kb;en-us;q148652
I am trying to build a managed C++ DLL, and this DLL is designed to consume the LIB
file generated by an unmanaged C++ code base. Both projects use MFC in a shared
DLL, neither uses ATL, and the unmanaged C++ LIB runs just fine when linked against
an unmanaged unit test application. I'm using Visual Studio .NET 2002.
Apparently, the _DllMain@12 symbol is being exported by two .libs, and according to this
article noted above, they are linking in the wrong order. These two libs seem to be the ones
mentioned in the support article above (as generated by the linker output):
------ Build started: Project: <project-name>, Configuration: Debug Win32 ------
Linking...
Processed /NODEFAULTLIB:mfcs70d.lib
Processed /NODEFAULTLIB:MSVCRTD.lib
Processed /NODEFAULTLIB:mfcs70d.lib
Processed /NODEFAULTLIB:MSVCRTD.lib
// output omitted, the above there because I attempt to exclude the two offending
libs and force a link in the correct order...
Found _DllMain@12
Referenced in MSVCRTD.lib(crtdll.obj)
Loaded MSVCRTD.lib(dllmain.obj)
// more omitted, only to arrive at...
mfcs70d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)
The support article insists that the solution (the only viable one in this case, I believe,
since both of system libs) is to exclude MSVCRTD.lib and mfcs70d.lib from the default set
(Project Properties->Linker->Input->Ignore Specific Libraries set to "mfcs70d.lib;MSVCRTD.lib",
without the qoutes), and to re-introduce them in the order I specify (Project Properties->Linker->
Input->Additional Dependencies set to "MyUnmanagedLib.lib mfcs70d.lib MSVCRTD.lib", without
the quotes, the first being my own library, and the order of the second and third being what I think
it needs to be.
In spite of this, it appears from the linker output above that
MSVCRTD.lib is being linked against first. The solution requires that the
MFC lib be linked first, and the C lib be linked afterwards, but I can't seem
to force this.
Any ideas at all? I can only assume that something else is forcing the link order, but
I'm at the end of my wits in trying to figure this out. If it helps, the linker command
line is included below (with the requisite "MyUnmanagedProject" placeholders.)
Any help would be greatly appreciated.
Cheers,
Jerry Cain
jerry@cs.stanford.edu
Linker Command Line:
/VERBOSE /OUT:"Debug/MyManagedLib.dll" /NOLOGO /LIBPATH:"..\MyUnmanagedProject\Debug" /DLL
/NODEFAULTLIB:"mfcs70d.lib" /NODEFAULTLIB:"MSVCRTD.lib" /DEBUG /PDB:"Debug/MyManagedProject.pdb"
MyUnmanagedProject.lib mfcs70d.lib MSVCRTD.lib <two long="" references="" to="" local="" libraries="" of="" my="" own="">
|
|
|
|
|
Hi all,
I'm new to C++ (a Delphi programmer), and I need to force the execution of OnSize event handler of my CAppView on my MFC app. I know I can simply post a WM_SIZE message for the main window for that to happen, but, if this is the simplest way, how can I get the current width and height of the window to pass it as unchanged parameters?
Thanks for any help!
|
|
|
|
|
I now realize I don't need to know any sizes for simply executing a CWnd::PostMessage(WM_SIZE).
However, I did try a forceResize function that simply executes
"theApp.m_pMainWnd->PostMessage(WM_SIZE)".
I call it from CAppView and it doesn't work (I don't see the resize effects after the call).
Any guess on what's the problem?
Thanks for any help ^_^;
|
|
|
|
|
I tried doing the obvious thing, actually calling the PostMessage(WM_SIZE) from the CAppView instead of for the Main Window.
However the results were exquisite (at least I did got some results which ressembled the OnSize function executed in a distorted way).
I guess I'm way too sleepy and with a headache, I'll sleep for now and see on this tomorrow. Hopefully someone may have some light to shed
Sorry for all the annoying monologue so far hehe
|
|
|
|
|
Hello,
i like to know if someone has source code of a dock start bar like ObjectDock or MobiDock?
I would like to fix the problem with full screen games that all these bars have. Or if someone could give me hint how to program a bar like this.
With best regards
puresilence2002
|
|
|
|
|
|
My application (Doc/View) has to handle large documents and therefore I have had to implement view scrolling using the SCROLLINFO structure to take advantage of it's 32-bit capability (I'm NOT using CScrollView). I am now trying to implement auto-scrolling, where, if the mouse cursor is near the window edge, then the view scrolls automatically in that direction. My problem is that I can't find a way to determine whether the relevant scrollbar control exists, and therefore whether to enable the auto-scrolling or not - CWnd::GetScrollBarCntrl() seems to return a null pointer no matter whether the scrollbar exists or not. I must admit that I don't quite know HOW the scrollbars ARE created, as all I do is to use ::SetScrollInfo() to set the page size, document size, etc and the scroll bars magically appear when the relevant document size exceeds the corresponding window size (I don't use the window styles WS_VSCROLL or WS_HSCROLL). So my question is what test to use to determine whether scroll bars exist. Alternatively, is there a "direct" way to implement auto-scrolling which I'm not aware of ?
Doug
|
|
|
|
|
Check out my CWindowScroller article (http://www.codeproject.com/miscctrl/windowscroller.asp[^]). While it does not do exactly what you want, it does contain code on finding the existance of the scrollbars, and finding out how far the view can be scrolled.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I have checked out the refenced article and can only find the following code snippet about existance of scrollbars :-
// ensure the parent window allows vertical scrolling
CScrollBar* pBar = m_pParentWnd->GetScrollBarCtrl(SB_VERT);
BOOL bHasBar = ((pBar != NULL) && pBar->IsWindowEnabled()) || (dwStyle & WS_VSCROLL);
if (!bHasBar)
m_Alignment &= ~Vertical;
As my original posting stated, I get a null pointer returned from CWnd::GetScrollBarCtrl(), so that doesn't work in this situation. Or have I missed something else in your article ?
Doug
|
|
|
|
|
Even with a NULL pointer, the WS_VSCROLL /WS_HSCROLL style should still be set. The code checks for both.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Ahhhhhhhhhh ! I SHOULD have read that line of code more carefully - I was concentrating TOO much on getting a pointer to the scrollbar and missed the use of GetStyle() !! Thanks very much for your help - it now works, and I've learnt something (which is the bonus !)
Doug
|
|
|
|
|
Hi, I want to import data from hundreds if not thousands of password protected excel spreadsheets.
Instead of manually opening them and unprotecting them by hand, how can I modify my program, which already imports the un-protected ones, so that it can read them even tough they are password protected.
|
|
|
|
|
hi all,
I've been experimenting with device contexts and bitmaps for abt 2 weeks now. I'm having difficulty in doing the following and would like some help/advice on it.
The project i'm trying out involves splitting up a bitmap image stored locally on the hard disk into a number of blocks...16 in a 4x4 pattern. The project then involves reading each block for its HSI (hue, sat and intensity) and plotting a histogram on that. By this i basically aim to compare images based on the resulting histogram and find matches out of a database of images.
The problem i'm having is in storing the blocks in memory. The following loads the bitmap...
bool CTemp2Dlg::LoadBitmap(CString sBitmap)
{
CBitmap bmp;
CBitmap* oldBMP;
HBITMAP hBmp;
COLORREF rgb[35][35] = {0};
CString rgbHex [35][35];
CString cTemp;
//////Load Bitmap into file.....
hBmp = (HBITMAP) LoadImage(AfxGetInstanceHandle(), sBitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
bmp.Attach(hBmp);
bmp.GetBitmap (&stBitmap);
oldBMP = m_dcMem.SelectObject(&bmp);
.........
.........
}
m_dcMem is a CDC object defined in the class header file which is initialised as....
void CTemp2Dlg::OnInitDialog()
{
CClientDC dc(this);
m_dcMem.CreateCompatibleDC (&dc);
pDC.CreateCompatibleDC (&dc);
}
....in the OnInitDialog method. Here pDC is a CDC object to which i'm trying to copy a block into. The copy takes place as follows....
void CTemp2Dlg::GetPartOfBitmap(POINT begin, POINT end)
{
bool bError;
CBitmap bitmap;
bError = pDC->BitBlt (begin.x, begin.y, end.x - begin.x, end.y - begin.y, &m_dcMem, 0, 0, SRCCOPY);
}
....where begin and end are point structs for the block dimensions. I've found out that this copy actually doesn't copy over anything. When copied to the CPaintDC dc(this) in OnPaint() nothing comes up on screen and the HSI values for this results in garbage. I can compute the HSI values when using the m_dcMem object (which is the entire picture) but not with the pDC object. Does anyone know how do i copy over a portion of a bitmap image in a CDC object to another one..??
Thanks in advance,
Hari
|
|
|
|
|
Have a look at http://www.codeproject.com/tools/imageviewer.asp[^]. It is a tool I wrote to help me figure out these sorts of problems.
Have you selected a bitmap (drawing surface) into the pDC device context? If not, then the bitmap in the pDC will be the default 1 X 1 pixel monochrome bitmap.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
i have this error :
: error C2664: 'SendMessageA' : cannot convert parameter 1 from 'char' to 'struct HWND__ *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
[code]
// Simple Sub Call
void __declspec(dllexport) TestSubb
(char& A, char& B, char& C, char& D)
{
A*= A; // handle of destination window
B*= B; // message to send
C*= C; // first message parameter
D*= D; // second message parameter
::SendMessage (A, B, C, D);
return;
}
[/code]
Why ? im missing somthing ?
i cant get this to work
help p:
jeroen
|
|
|
|
|
The prototype of SendMessage is the following:
LRESULT SendMessage(<br />
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
you use wrong data types.
Greetings,
D.
|
|
|
|